Skip to content

Commit dddd539

Browse files
authored
expr-parser: "for some" counts as a declaration (#496)
1 parent b763a69 commit dddd539

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/lint/rules/variable-use-def.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,8 @@ function walkAlgorithm(steps: OrderedListNode | UnorderedListNode, scope: Scope,
257257
const prev = parts[i - 1];
258258
if (
259259
prev.name === 'text' &&
260-
/\b(?:for any |there exists |there is |there does not exist )(\w+ )*$/.test(prev.contents)
260+
// prettier-ignore
261+
/\b(?:for any |for some |there exists |there is |there does not exist )(\w+ )*$/.test(prev.contents)
261262
) {
262263
scope.declare(varName, part);
263264
declaredThisLine.add(part);

test/lint-variable-use-def.js

+11
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,17 @@ describe('variables are declared and used appropriately', () => {
368368
);
369369
});
370370

371+
it('"for some" counts as a declaration"', async () => {
372+
await assertLintFree(
373+
`
374+
<emu-alg>
375+
1. If some property of _i_ holds for some integer _i_ in the interval from 0 to 10, return _i_.
376+
1. Return -1.
377+
</emu-alg>
378+
`
379+
);
380+
});
381+
371382
it('declarations from explicit attributes are visible', async () => {
372383
await assertLintFree(
373384
`

0 commit comments

Comments
 (0)