tc39 / ecmarkup

An HTML superset/Markdown subset source format for ECMAScript and related specifications
https://tc39.es/ecmarkup/
MIT License
222 stars 63 forks source link

fix "there exists"/"such that" not followed by a var name #538

Closed bakkot closed 1 year ago

bakkot commented 1 year ago

Should unblock https://github.com/tc39/ecma262/pull/3102.

Concretely, the problem was that the variable def-use lint treats there exists [...] _X_ as declaring _X_, which is true for uses like there exists an integer _X_ such that or there exists an element _A_ of _B_, but not for there exists a value in _X_, which is the form in used in the relevant line in the PR.

Specifically, the line in 262 is If there exists a CharSetElement in _A_ containing exactly one character _a_ such that [...], which should use _A_ but declare _a_; prior to this PR it was treating both as declarations.

The linter wasn't tripping earlier because a separate issue in ecma262 (introduced in https://github.com/tc39/ecma262/pull/2418 and fixed in https://github.com/tc39/ecma262/pull/3102) caused _A_ not to be captured, which basically canceled out the bug here.