diff --git a/crates/oxc_transformer/src/es2020/nullish_coalescing_operator.rs b/crates/oxc_transformer/src/es2020/nullish_coalescing_operator.rs index 6f89dfe1acc54..9316824c525e5 100644 --- a/crates/oxc_transformer/src/es2020/nullish_coalescing_operator.rs +++ b/crates/oxc_transformer/src/es2020/nullish_coalescing_operator.rs @@ -116,7 +116,7 @@ impl<'a, 'ctx> NullishCoalescingOperator<'a, 'ctx> { let current_scope_id = if is_parent_formal_parameter { ctx.create_child_scope_of_current(ScopeFlags::Arrow | ScopeFlags::Function) } else { - ctx.current_scope_id() + ctx.current_hoist_scope_id() }; // Add `var _name` to scope diff --git a/tasks/coverage/snapshots/semantic_test262.snap b/tasks/coverage/snapshots/semantic_test262.snap index e2dd848fd929f..e3295b26cc97f 100644 --- a/tasks/coverage/snapshots/semantic_test262.snap +++ b/tasks/coverage/snapshots/semantic_test262.snap @@ -2,7 +2,7 @@ commit: dc0082c5 semantic_test262 Summary: AST Parsed : 44096/44096 (100.00%) -Positive Passed: 43569/44096 (98.80%) +Positive Passed: 43577/44096 (98.82%) tasks/coverage/test262/test/annexB/language/function-code/if-decl-else-decl-a-func-block-scoping.js semantic error: Symbol scope ID mismatch for "f": after transform: SymbolId(3): ScopeId(4294967294) @@ -1209,68 +1209,6 @@ Scope children mismatch: after transform: ScopeId(2): [ScopeId(3)] rebuilt : ScopeId(4): [] -tasks/coverage/test262/test/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-assignment-expression-coalesce.js -semantic error: Bindings mismatch: -after transform: ScopeId(0): ["C", "_x10", "_x11", "_x12", "_x5", "_x6", "_x7", "_x8", "_x9", "c", "x"] -rebuilt : ScopeId(0): ["C", "_x", "_x10", "_x11", "_x12", "_x2", "_x3", "_x4", "_x5", "_x6", "_x7", "_x8", "_x9", "c", "x"] -Bindings mismatch: -after transform: ScopeId(1): ["_x", "_x2", "_x3", "_x4"] -rebuilt : ScopeId(1): [] -Symbol scope ID mismatch for "_x": -after transform: SymbolId(5): ScopeId(1) -rebuilt : SymbolId(0): ScopeId(0) -Symbol scope ID mismatch for "_x2": -after transform: SymbolId(6): ScopeId(1) -rebuilt : SymbolId(1): ScopeId(0) -Symbol scope ID mismatch for "_x3": -after transform: SymbolId(7): ScopeId(1) -rebuilt : SymbolId(2): ScopeId(0) -Symbol scope ID mismatch for "_x4": -after transform: SymbolId(8): ScopeId(1) -rebuilt : SymbolId(3): ScopeId(0) - -tasks/coverage/test262/test/language/expressions/class/cpn-class-expr-computed-property-name-from-assignment-expression-coalesce.js -semantic error: Bindings mismatch: -after transform: ScopeId(0): ["C", "_x3", "_x4", "_x5", "_x6", "c", "x"] -rebuilt : ScopeId(0): ["C", "_x", "_x2", "_x3", "_x4", "_x5", "_x6", "c", "x"] -Bindings mismatch: -after transform: ScopeId(1): ["_x", "_x2"] -rebuilt : ScopeId(1): [] -Symbol scope ID mismatch for "_x": -after transform: SymbolId(3): ScopeId(1) -rebuilt : SymbolId(0): ScopeId(0) -Symbol scope ID mismatch for "_x2": -after transform: SymbolId(4): ScopeId(1) -rebuilt : SymbolId(1): ScopeId(0) - -tasks/coverage/test262/test/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-assignment-expression-coalesce.js -semantic error: Bindings mismatch: -after transform: ScopeId(0): ["C", "_x3", "_x4", "_x5", "_x6", "c", "x"] -rebuilt : ScopeId(0): ["C", "_x", "_x2", "_x3", "_x4", "_x5", "_x6", "c", "x"] -Bindings mismatch: -after transform: ScopeId(1): ["_x", "_x2"] -rebuilt : ScopeId(1): [] -Symbol scope ID mismatch for "_x": -after transform: SymbolId(3): ScopeId(1) -rebuilt : SymbolId(0): ScopeId(0) -Symbol scope ID mismatch for "_x2": -after transform: SymbolId(4): ScopeId(1) -rebuilt : SymbolId(1): ScopeId(0) - -tasks/coverage/test262/test/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-assignment-expression-coalesce.js -semantic error: Bindings mismatch: -after transform: ScopeId(0): ["C", "_x3", "_x4", "_x5", "_x6", "c", "x"] -rebuilt : ScopeId(0): ["C", "_x", "_x2", "_x3", "_x4", "_x5", "_x6", "c", "x"] -Bindings mismatch: -after transform: ScopeId(1): ["_x", "_x2"] -rebuilt : ScopeId(1): [] -Symbol scope ID mismatch for "_x": -after transform: SymbolId(3): ScopeId(1) -rebuilt : SymbolId(0): ScopeId(0) -Symbol scope ID mismatch for "_x2": -after transform: SymbolId(4): ScopeId(1) -rebuilt : SymbolId(1): ScopeId(0) - tasks/coverage/test262/test/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-empty-init.js semantic error: Scope children mismatch: after transform: ScopeId(6): [ScopeId(3)] @@ -3849,68 +3787,6 @@ Scope children mismatch: after transform: ScopeId(2): [ScopeId(3)] rebuilt : ScopeId(4): [] -tasks/coverage/test262/test/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-assignment-expression-coalesce.js -semantic error: Bindings mismatch: -after transform: ScopeId(0): ["C", "_x10", "_x11", "_x12", "_x5", "_x6", "_x7", "_x8", "_x9", "c", "x"] -rebuilt : ScopeId(0): ["C", "_x", "_x10", "_x11", "_x12", "_x2", "_x3", "_x4", "_x5", "_x6", "_x7", "_x8", "_x9", "c", "x"] -Bindings mismatch: -after transform: ScopeId(1): ["_x", "_x2", "_x3", "_x4"] -rebuilt : ScopeId(1): [] -Symbol scope ID mismatch for "_x": -after transform: SymbolId(5): ScopeId(1) -rebuilt : SymbolId(0): ScopeId(0) -Symbol scope ID mismatch for "_x2": -after transform: SymbolId(6): ScopeId(1) -rebuilt : SymbolId(1): ScopeId(0) -Symbol scope ID mismatch for "_x3": -after transform: SymbolId(7): ScopeId(1) -rebuilt : SymbolId(2): ScopeId(0) -Symbol scope ID mismatch for "_x4": -after transform: SymbolId(8): ScopeId(1) -rebuilt : SymbolId(3): ScopeId(0) - -tasks/coverage/test262/test/language/statements/class/cpn-class-decl-computed-property-name-from-assignment-expression-coalesce.js -semantic error: Bindings mismatch: -after transform: ScopeId(0): ["C", "_x3", "_x4", "_x5", "_x6", "c", "x"] -rebuilt : ScopeId(0): ["C", "_x", "_x2", "_x3", "_x4", "_x5", "_x6", "c", "x"] -Bindings mismatch: -after transform: ScopeId(1): ["_x", "_x2"] -rebuilt : ScopeId(1): [] -Symbol scope ID mismatch for "_x": -after transform: SymbolId(3): ScopeId(1) -rebuilt : SymbolId(0): ScopeId(0) -Symbol scope ID mismatch for "_x2": -after transform: SymbolId(4): ScopeId(1) -rebuilt : SymbolId(1): ScopeId(0) - -tasks/coverage/test262/test/language/statements/class/cpn-class-decl-fields-computed-property-name-from-assignment-expression-coalesce.js -semantic error: Bindings mismatch: -after transform: ScopeId(0): ["C", "_x3", "_x4", "_x5", "_x6", "c", "x"] -rebuilt : ScopeId(0): ["C", "_x", "_x2", "_x3", "_x4", "_x5", "_x6", "c", "x"] -Bindings mismatch: -after transform: ScopeId(1): ["_x", "_x2"] -rebuilt : ScopeId(1): [] -Symbol scope ID mismatch for "_x": -after transform: SymbolId(3): ScopeId(1) -rebuilt : SymbolId(0): ScopeId(0) -Symbol scope ID mismatch for "_x2": -after transform: SymbolId(4): ScopeId(1) -rebuilt : SymbolId(1): ScopeId(0) - -tasks/coverage/test262/test/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-assignment-expression-coalesce.js -semantic error: Bindings mismatch: -after transform: ScopeId(0): ["C", "_x3", "_x4", "_x5", "_x6", "c", "x"] -rebuilt : ScopeId(0): ["C", "_x", "_x2", "_x3", "_x4", "_x5", "_x6", "c", "x"] -Bindings mismatch: -after transform: ScopeId(1): ["_x", "_x2"] -rebuilt : ScopeId(1): [] -Symbol scope ID mismatch for "_x": -after transform: SymbolId(3): ScopeId(1) -rebuilt : SymbolId(0): ScopeId(0) -Symbol scope ID mismatch for "_x2": -after transform: SymbolId(4): ScopeId(1) -rebuilt : SymbolId(1): ScopeId(0) - tasks/coverage/test262/test/language/statements/class/definition/methods-async-super-call-param.js semantic error: Symbol reference IDs mismatch for "_superprop_getMethod": after transform: SymbolId(5): [ReferenceId(8)] diff --git a/tasks/coverage/snapshots/semantic_typescript.snap b/tasks/coverage/snapshots/semantic_typescript.snap index 7798098d799c0..b60ce1b25ae13 100644 --- a/tasks/coverage/snapshots/semantic_typescript.snap +++ b/tasks/coverage/snapshots/semantic_typescript.snap @@ -2,7 +2,7 @@ commit: d85767ab semantic_typescript Summary: AST Parsed : 6503/6503 (100.00%) -Positive Passed: 2700/6503 (41.52%) +Positive Passed: 2701/6503 (41.53%) tasks/coverage/typescript/tests/cases/compiler/2dArrays.ts semantic error: Symbol reference IDs mismatch for "Cell": after transform: SymbolId(0): [ReferenceId(1)] @@ -46417,17 +46417,6 @@ semantic error: Scope children mismatch: after transform: ScopeId(0): [ScopeId(1)] rebuilt : ScopeId(0): [] -tasks/coverage/typescript/tests/cases/conformance/expressions/nullishCoalescingOperator/nullishCoalescingOperator12.ts -semantic error: Bindings mismatch: -after transform: ScopeId(0): ["obj"] -rebuilt : ScopeId(0): ["_obj$arr", "obj"] -Bindings mismatch: -after transform: ScopeId(1): ["_obj$arr", "i"] -rebuilt : ScopeId(1): ["i"] -Symbol scope ID mismatch for "_obj$arr": -after transform: SymbolId(2): ScopeId(1) -rebuilt : SymbolId(0): ScopeId(0) - tasks/coverage/typescript/tests/cases/conformance/expressions/nullishCoalescingOperator/nullishCoalescingOperator2.ts semantic error: Bindings mismatch: after transform: ScopeId(0): ["a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "aa1", "aa2", "aa3", "aa4", "aa5", "aa6", "aa7", "aa8", "aa9"] diff --git a/tasks/transform_conformance/snapshots/babel.snap.md b/tasks/transform_conformance/snapshots/babel.snap.md index ad00408a59ded..921cd86d5b7c3 100644 --- a/tasks/transform_conformance/snapshots/babel.snap.md +++ b/tasks/transform_conformance/snapshots/babel.snap.md @@ -1,6 +1,6 @@ commit: 54a8389f -Passed: 599/927 +Passed: 602/927 # All Passed: * babel-plugin-transform-class-static-block @@ -464,7 +464,7 @@ x Output mismatch x Output mismatch -# babel-plugin-transform-optional-chaining (33/45) +# babel-plugin-transform-optional-chaining (36/45) * assumption-noDocumentAll/assignment/input.js Symbol reference IDs mismatch for "_obj$a": after transform: SymbolId(5): [ReferenceId(7), ReferenceId(8), ReferenceId(9)] @@ -476,17 +476,6 @@ Symbol reference IDs mismatch for "_obj$a2": after transform: SymbolId(7): [ReferenceId(15), ReferenceId(16), ReferenceId(17)] rebuilt : SymbolId(2): [ReferenceId(12), ReferenceId(14)] -* assumption-noDocumentAll/cast-to-boolean/input.js -Bindings mismatch: -after transform: ScopeId(25): ["_o$a$b$c$non_existent", "_o$a$b$c$non_existent3", "_o$a$b10", "_o$a$b6", "_o$a$b7", "_o$a$b8", "_o$a$b9", "o"] -rebuilt : ScopeId(25): ["_o$a$b$c$non_existent", "_o$a$b$c$non_existent2", "_o$a$b$c$non_existent3", "_o$a$b10", "_o$a$b6", "_o$a$b7", "_o$a$b8", "_o$a$b9", "o"] -Bindings mismatch: -after transform: ScopeId(26): ["_o$a$b$c$non_existent2"] -rebuilt : ScopeId(26): [] -Symbol scope ID mismatch for "_o$a$b$c$non_existent2": -after transform: SymbolId(31): ScopeId(26) -rebuilt : SymbolId(33): ScopeId(25) - * assumption-noDocumentAll/in-function-params/input.js Scope children mismatch: after transform: ScopeId(0): [ScopeId(1), ScopeId(2), ScopeId(3), ScopeId(4), ScopeId(5)] @@ -593,17 +582,6 @@ Symbol reference IDs mismatch for "_foo$bar9$baz": after transform: SymbolId(15): [ReferenceId(66), ReferenceId(67), ReferenceId(68)] rebuilt : SymbolId(15): [ReferenceId(59), ReferenceId(61)] -* general/cast-to-boolean/input.js -Bindings mismatch: -after transform: ScopeId(25): ["_o$a$b$c$non_existent", "_o$a$b$c$non_existent3", "_o$a$b10", "_o$a$b6", "_o$a$b7", "_o$a$b8", "_o$a$b9", "o"] -rebuilt : ScopeId(25): ["_o$a$b$c$non_existent", "_o$a$b$c$non_existent2", "_o$a$b$c$non_existent3", "_o$a$b10", "_o$a$b6", "_o$a$b7", "_o$a$b8", "_o$a$b9", "o"] -Bindings mismatch: -after transform: ScopeId(26): ["_o$a$b$c$non_existent2"] -rebuilt : ScopeId(26): [] -Symbol scope ID mismatch for "_o$a$b$c$non_existent2": -after transform: SymbolId(31): ScopeId(26) -rebuilt : SymbolId(33): ScopeId(25) - * general/delete-in-function-params/input.js Scope children mismatch: after transform: ScopeId(0): [ScopeId(1)] @@ -775,17 +753,6 @@ Symbol scope ID mismatch for "b": after transform: SymbolId(13): ScopeId(5) rebuilt : SymbolId(16): ScopeId(9) -* loose/cast-to-boolean/input.js -Bindings mismatch: -after transform: ScopeId(25): ["_o$a$b$c$non_existent", "_o$a$b$c$non_existent3", "_o$a$b10", "_o$a$b6", "_o$a$b7", "_o$a$b8", "_o$a$b9", "o"] -rebuilt : ScopeId(25): ["_o$a$b$c$non_existent", "_o$a$b$c$non_existent2", "_o$a$b$c$non_existent3", "_o$a$b10", "_o$a$b6", "_o$a$b7", "_o$a$b8", "_o$a$b9", "o"] -Bindings mismatch: -after transform: ScopeId(26): ["_o$a$b$c$non_existent2"] -rebuilt : ScopeId(26): [] -Symbol scope ID mismatch for "_o$a$b$c$non_existent2": -after transform: SymbolId(31): ScopeId(26) -rebuilt : SymbolId(33): ScopeId(25) - * transparent-expr-wrappers/ts-as-function-call-loose/input.ts Unresolved references mismatch: after transform: ["A", "B", "foo"] diff --git a/tasks/transform_conformance/snapshots/oxc.snap.md b/tasks/transform_conformance/snapshots/oxc.snap.md index 6e902dcfc7b6f..6f8993b9bd7d6 100644 --- a/tasks/transform_conformance/snapshots/oxc.snap.md +++ b/tasks/transform_conformance/snapshots/oxc.snap.md @@ -1,10 +1,11 @@ commit: 54a8389f -Passed: 117/136 +Passed: 119/136 # All Passed: * babel-plugin-transform-class-static-block * babel-plugin-transform-logical-assignment-operators +* babel-plugin-transform-nullish-coalescing-operator * babel-plugin-transform-optional-catch-binding * babel-plugin-transform-async-generator-functions * babel-plugin-transform-object-rest-spread @@ -15,24 +16,7 @@ Passed: 117/136 * regexp -# babel-plugin-transform-class-properties (18/24) -* interaction-with-other-transforms/input.js -Bindings mismatch: -after transform: ScopeId(0): ["C", "C2", "_ref", "_ref2"] -rebuilt : ScopeId(0): ["C", "C2", "_a", "_e", "_g", "_ref", "_ref2"] -Bindings mismatch: -after transform: ScopeId(1): ["_a", "_e", "_g"] -rebuilt : ScopeId(1): [] -Symbol scope ID mismatch for "_a": -after transform: SymbolId(4): ScopeId(1) -rebuilt : SymbolId(0): ScopeId(0) -Symbol scope ID mismatch for "_e": -after transform: SymbolId(5): ScopeId(1) -rebuilt : SymbolId(1): ScopeId(0) -Symbol scope ID mismatch for "_g": -after transform: SymbolId(6): ScopeId(1) -rebuilt : SymbolId(2): ScopeId(0) - +# babel-plugin-transform-class-properties (19/24) * static-block-this-and-class-name/input.js Symbol flags mismatch for "inner": after transform: SymbolId(8): SymbolFlags(BlockScopedVariable | Function) @@ -55,19 +39,6 @@ after transform: SymbolId(0): [ReferenceId(0), ReferenceId(2), ReferenceId(6), R rebuilt : SymbolId(0): [ReferenceId(0), ReferenceId(2), ReferenceId(6), ReferenceId(10)] -# babel-plugin-transform-nullish-coalescing-operator (2/3) -* in-nested-block/input.js -Bindings mismatch: -after transform: ScopeId(0): [] -rebuilt : ScopeId(0): ["_x"] -Bindings mismatch: -after transform: ScopeId(1): ["_x"] -rebuilt : ScopeId(1): [] -Symbol scope ID mismatch for "_x": -after transform: SymbolId(0): ScopeId(1) -rebuilt : SymbolId(0): ScopeId(0) - - # babel-plugin-transform-async-to-generator (14/15) * super/nested/input.js x Output mismatch