-
-
Notifications
You must be signed in to change notification settings - Fork 482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
transformer: incorrect semantic check #4999
Comments
We may need to solve this problem as soon as possible. Since we can't catch valid any regression in semantic changes, I am a bit afraid to refactor the transformer 🥲 |
I'm going to look at this tomorrow. Will try to wrap it up as quickly as possible. |
@Dunqing Can you give us a test case? Ideally what's wrong and the expected result? |
In the following test used Input// nullish-coalescing/transform-in-function/input.js
function foo(opts) {
var foo = opts.foo ?? "default";
} Output// nullish-coalescing/transform-in-function/output.js
function foo(opts) {
var _opts$foo;
var foo = (_opts$foo = opts.foo) !== null && _opts$foo !== void 0 ? _opts$foo : "default";
} The Both of the different phases' symbols are correct. The root cause is we use |
Fixed in #5035. |
I saw nearly all tests have a
Symbols mismatch after transform
error. This error is thrown hereoxc/crates/oxc_semantic/src/post_transform_checker.rs
Lines 129 to 132 in 081e2a3
After looking into it, what happened here, I found a bug in
PostTransformChecker
. From the code above, it can be seen that this is due to the unequal length of semantic symbols in the two different phases.The
previous_collect
is collected inafter_semantic
and thecurrent_collect
is collected inafter_transform
. This is the cause of the problem. After the transformation, theSemantic
will definitely change.So we shouldn't use
after_semantic
's semantic to compare withafter_transform
's semantic. Instead, we should rebuild the semantic after the transformation, and compare it toafter_transform
's semanticThe text was updated successfully, but these errors were encountered: