Skip to content
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

[Merged by Bors] - Initialize var bindings in runtime environments with undefined #2860

Closed
wants to merge 2 commits into from

Conversation

raskad
Copy link
Member

@raskad raskad commented Apr 23, 2023

Currently in draft, because it breaks some of the annexB Block-Level Function Declarations Web Legacy Compatibility Semantics tests.

This Pull Request fixes #2795, fixes #2779 and fixes #2760.

It changes the following:

  • Initialize var bindings in runtime environments with undefined
  • Add a missing environment at class construction time.

@raskad raskad added bug Something isn't working execution Issues or PRs related to code execution vm Issues and PRs related to the Boa Virtual Machine. labels Apr 23, 2023
@raskad raskad added this to the v0.17.0 milestone Apr 23, 2023
@github-actions
Copy link

github-actions bot commented Apr 23, 2023

Test262 conformance changes

Test result main count PR count difference
Total 94,593 94,593 0
Passed 73,210 73,184 -26
Ignored 17,532 17,532 0
Failed 3,851 3,877 +26
Panics 0 0 0
Conformance 77.39% 77.37% -0.03%
Fixed tests (22):
test/language/expressions/generators/unscopables-with.js (previously Failed)
test/language/expressions/async-function/nameless-unscopables-with.js (previously Failed)
test/language/expressions/async-function/named-unscopables-with.js (previously Failed)
test/language/expressions/async-arrow-function/unscopables-with.js (previously Failed)
test/language/expressions/async-generator/named-unscopables-with.js (previously Failed)
test/language/expressions/async-generator/unscopables-with.js (previously Failed)
test/language/expressions/arrow-function/unscopables-with.js (previously Failed)
test/language/expressions/function/unscopables-with.js (previously Failed)
test/language/identifier-resolution/S10.2.2_A1_T3.js [strict mode] (previously Failed)
test/language/identifier-resolution/S10.2.2_A1_T3.js (previously Failed)
test/language/statements/generators/unscopables-with.js (previously Failed)
test/language/statements/async-function/unscopables-with.js (previously Failed)
test/language/statements/async-generator/unscopables-with.js (previously Failed)
test/language/statements/with/S12.10_A1.12_T3.js (previously Failed)
test/language/statements/with/S12.10_A1.7_T3.js (previously Failed)
test/language/statements/with/S12.10_A1.11_T5.js (previously Failed)
test/language/statements/with/S12.10_A1.7_T5.js (previously Failed)
test/language/statements/with/S12.10_A1.8_T3.js (previously Failed)
test/language/statements/with/S12.10_A1.12_T5.js (previously Failed)
test/language/statements/with/S12.10_A1.8_T5.js (previously Failed)
test/language/statements/with/S12.10_A1.11_T3.js (previously Failed)
test/language/statements/function/unscopables-with.js (previously Failed)
Broken tests (48):
test/annexB/language/function-code/if-decl-no-else-func-skip-early-err-for.js (previously Passed)
test/annexB/language/function-code/switch-case-func-skip-early-err-for-of.js (previously Passed)
test/annexB/language/function-code/block-decl-func-skip-early-err-for-of.js (previously Passed)
test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-for-of.js (previously Passed)
test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-for.js (previously Passed)
test/annexB/language/function-code/block-decl-func-skip-early-err-for.js (previously Passed)
test/annexB/language/function-code/if-decl-no-else-func-skip-early-err-for-in.js (previously Passed)
test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-block.js (previously Passed)
test/annexB/language/function-code/switch-case-func-skip-early-err-try.js (previously Passed)
test/annexB/language/function-code/if-decl-no-else-func-skip-early-err-switch.js (previously Passed)
test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-try.js (previously Passed)
test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-for-of.js (previously Passed)
test/annexB/language/function-code/switch-dflt-func-skip-early-err-block.js (previously Passed)
test/annexB/language/function-code/if-decl-no-else-func-skip-early-err-try.js (previously Passed)
test/annexB/language/function-code/switch-dflt-func-skip-early-err-for.js (previously Passed)
test/annexB/language/function-code/if-decl-no-else-func-skip-early-err-for-of.js (previously Passed)
test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-for-in.js (previously Passed)
test/annexB/language/function-code/block-decl-func-skip-early-err-for-in.js (previously Passed)
test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-switch.js (previously Passed)
test/annexB/language/function-code/if-decl-no-else-func-skip-early-err-block.js (previously Passed)
test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-for-of.js (previously Passed)
test/annexB/language/function-code/block-decl-func-skip-early-err-block.js (previously Passed)
test/annexB/language/function-code/switch-dflt-func-skip-early-err-for-of.js (previously Passed)
test/annexB/language/function-code/switch-case-func-skip-early-err-block.js (previously Passed)
test/annexB/language/function-code/switch-dflt-func-skip-early-err-for-in.js (previously Passed)
test/annexB/language/function-code/switch-dflt-func-skip-early-err-try.js (previously Passed)
test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-for.js (previously Passed)
test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-switch.js (previously Passed)
test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-switch.js (previously Passed)
test/annexB/language/function-code/switch-case-func-skip-early-err-for-in.js (previously Passed)
test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-for-in.js (previously Passed)
test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-for-of.js (previously Passed)
test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-switch.js (previously Passed)
test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-for.js (previously Passed)
test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-block.js (previously Passed)
test/annexB/language/function-code/switch-case-func-skip-early-err-for.js (previously Passed)
test/annexB/language/function-code/block-decl-func-skip-early-err-switch.js (previously Passed)
test/annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-block.js (previously Passed)
test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-try.js (previously Passed)
test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-try.js (previously Passed)
test/annexB/language/function-code/switch-dflt-func-skip-early-err-switch.js (previously Passed)
test/annexB/language/function-code/switch-case-func-skip-early-err-switch.js (previously Passed)
test/annexB/language/function-code/block-decl-func-skip-early-err-try.js (previously Passed)
test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-for-in.js (previously Passed)
test/annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-for-in.js (previously Passed)
test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-block.js (previously Passed)
test/annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-try.js (previously Passed)
test/annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-for.js (previously Passed)

@codecov
Copy link

codecov bot commented Apr 23, 2023

Codecov Report

Merging #2860 (435252b) into main (1f4ff6d) will increase coverage by 0.02%.
The diff coverage is 92.00%.

@@            Coverage Diff             @@
##             main    #2860      +/-   ##
==========================================
+ Coverage   50.95%   50.98%   +0.02%     
==========================================
  Files         419      419              
  Lines       41940    41963      +23     
==========================================
+ Hits        21372    21393      +21     
- Misses      20568    20570       +2     
Impacted Files Coverage Δ
boa_engine/src/environments/runtime.rs 69.92% <87.50%> (+0.19%) ⬆️
boa_engine/src/bytecompiler/class.rs 15.69% <90.90%> (+2.15%) ⬆️
boa_engine/src/environments/compile.rs 95.00% <100.00%> (+0.31%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@jedel1043
Copy link
Member

jedel1043 commented Apr 25, 2023

Currently in draft, because it breaks some of the annexB Block-Level Function Declarations Web Legacy Compatibility Semantics tests.

I'm pretty sure we currently don't have support for that part of the annex, which probably means that the regressed tests were false positives, right? If that's the case, I think we can merge this with no problems.

@raskad
Copy link
Member Author

raskad commented Apr 25, 2023

Currently in draft, because it breaks some of the annexB Block-Level Function Declarations Web Legacy Compatibility Semantics tests.

I'm pretty sure we currently don't have support for that part of the annex, which probably means that the regressed tests were false positives, right? If that's the case, I think we can merge this with no problems.

Yeah, sort of. Im currently at +235 -291 with all broken tests annexB and some more "normal" tests fixed. I'm currently trying to make the annexB stuff work at least partially.

@raskad raskad marked this pull request as ready for review April 26, 2023 01:02
@raskad
Copy link
Member Author

raskad commented Apr 26, 2023

There are a couple of refactors and a bit of aligning with the spec before we can fix the annexB tests. So I think @jedel1043 is right, let's go ahead and ship this change to fix the bugs.

Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

boa_engine/src/bytecompiler/class.rs Outdated Show resolved Hide resolved
@raskad raskad force-pushed the fix-var-hoisting branch from d9fd074 to 435252b Compare April 26, 2023 01:24
Copy link
Member

@HalidOdat HalidOdat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

@Razican
Copy link
Member

Razican commented Apr 26, 2023

After this, do we need the hoistable re-ordering of nodes?

@jedel1043
Copy link
Member

After this, do we need the hoistable re-ordering of nodes?

Probably not. We can try to remove that after we merge this and see if anything breaks.

@raskad
Copy link
Member Author

raskad commented Apr 26, 2023

After this, do we need the hoistable re-ordering of nodes?

We still need it, but I am working on refactoring the relevant parts of the compiler so that they work more like the spec. That refactor should remove the reordering. We also need to remove it to implement the annexB function syntax.

@raskad
Copy link
Member Author

raskad commented Apr 26, 2023

bors r+

bors bot pushed a commit that referenced this pull request Apr 26, 2023
…2860)

Currently in draft, because it breaks some of the annexB [`Block-Level Function Declarations Web Legacy Compatibility Semantics`](https://tc39.es/ecma262/#sec-block-level-function-declarations-web-legacy-compatibility-semantics) tests.

This Pull Request fixes #2795, fixes #2779 and fixes  #2760.

It changes the following:

- Initialize `var` bindings in runtime environments with `undefined`
- Add a missing environment at class construction time.
@bors
Copy link

bors bot commented Apr 26, 2023

Pull request successfully merged into main.

Build succeeded:

@bors bors bot changed the title Initialize var bindings in runtime environments with undefined [Merged by Bors] - Initialize var bindings in runtime environments with undefined Apr 26, 2023
@bors bors bot closed this Apr 26, 2023
@bors bors bot deleted the fix-var-hoisting branch April 26, 2023 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working execution Issues or PRs related to code execution vm Issues and PRs related to the Boa Virtual Machine.
Projects
None yet
4 participants