Skip to content

fix: declare destructured for-of variables in semantic analyzer + map iteration tests#198

Merged
cs01 merged 1 commit intomainfrom
map-test-coverage
Mar 10, 2026
Merged

fix: declare destructured for-of variables in semantic analyzer + map iteration tests#198
cs01 merged 1 commit intomainfrom
map-test-coverage

Conversation

@cs01
Copy link
Copy Markdown
Owner

@cs01 cs01 commented Mar 10, 2026

Summary

  • Bug fix: for (const [k, v] of map.entries()) previously failed with "Reference to undeclared variable" because the semantic analyzer only declared single-variable for-of loops (variableName), not destructured ones (destructuredNames). Now both paths are handled.
  • New tests: 5 test fixtures covering Map iteration patterns that were previously untested:
    • map-entries.tsfor...of map.entries() with string keys/values
    • map-entries-bare.tsfor...of map (bare map iteration)
    • map-keys.tsmap.keys() iteration
    • map-values.tsmap.values() iteration
    • map-string-number-entries.tsMap<string, number> entries iteration

Test plan

  • All 458 tests pass
  • npm run verify:quick (in progress)

@cs01 cs01 merged commit e281510 into main Mar 10, 2026
12 checks passed
@cs01 cs01 deleted the map-test-coverage branch March 12, 2026 05:35
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.

1 participant