Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
CodSpeed Instrumentation Performance ReportMerging #11234 will not alter performanceComparing Summary
|
ccbcb98 to
9fe6e80
Compare
9fe6e80 to
1bff337
Compare
|
@Dunqing will take a look at how tsc works. |
|
Wait... I just found out the current implementation is correct, there is no error in JavaScript. See Oxc Playground. The current implementation has covered this case. oxc/crates/oxc_semantic/src/binder.rs Lines 182 to 189 in 1846b03 |
|
yes, the current implementation is correct however the symbol_declarations node id points to the I wonder wether we should just move the debug assertion 🤔 |
Thank you for explaining the problem more. I finally figure out what happened here. Currently, the implementation not exactly handle variable hoisting in the same way as the specification, and I don't think it is worth dealing with it just for this case. In this case, I think we can use oxc/crates/oxc_semantic/src/scoping.rs Lines 18 to 23 in 1846b03 |
|
ok, so we will leave semantic as is with this bug and fix in the lint rule. are there any other cases other than e.g. here it has scope flags function, but doens't point to a function, do we need to consider that for any other types |
As far as I know, no other cases we need to care about. I've sent a fix in #11280 and copied over a test from this PR. Thank you for the help! |

Fixes #11215
I'm really not happy with this fix, but I can't see a better solution.
Since we only do 1x pass in semantic we can't hoist the function declaraions + declare them before the var declarations, hence here, we have to update the original declaration to point to the function declaration.