Skip to content

Conversation

@mug1wara26
Copy link
Contributor

Description

Closes #1820

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How to test

Try running let b = 2; for (const a = 4; b < 10; b = b + 1) {display(b);} in the repl. This should now throw an error. All the test suites still pass

Checklist

  • I have tested this code.
    • Tests pass with yarn test
    • js-slang executable is verified to work
    • Did I have to reduce the strength of some tests?
  • I have updated the documentation

@mug1wara26 mug1wara26 linked an issue Oct 12, 2025 that may be closed by this pull request
@coveralls
Copy link

coveralls commented Oct 12, 2025

Pull Request Test Coverage Report for Build 18446711997

Details

  • 11 of 11 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 77.457%

Totals Coverage Status
Change from base Build 17723186191: 0.02%
Covered Lines: 8207
Relevant Lines: 10298

💛 - Coveralls

Copy link
Member

@martin-henz martin-henz left a comment

Choose a reason for hiding this comment

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

Nice!

@martin-henz martin-henz merged commit 45ec35b into master Oct 13, 2025
5 checks passed
@martin-henz martin-henz deleted the 1820-disallow-const-declaration-in-for-loop-init-part branch October 13, 2025 04:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disallow const declaration in for loop init part

4 participants