In function (): object {...} object is a predefined type, but
in function (object: any): object is foo{} object is now
a regular identifier. The previous grammar was not able
to parse the second example, probably because when the parser
sees the second ':' for the return type, the contextual lexer
does not know yet if it's a type predicate or predefined type, so
it accepts 'object' as a predefined type and only fails later when
it sees 'is'.
test plan:
I tried in astexplorer.net and the second example is valid typescript
code (sadly).
Checklist:
[x] All tests pass in CI.
[x] There are sufficient tests for the new fix/feature.
[x] Grammar rules have not been renamed unless absolutely necessary.
[x] The conflicts section hasn't grown too much.
[x] The parser size hasn't grown too much (check the value of STATE_COUNT in src/parser.c).
In
function (): object {...}
object is a predefined type, but infunction (object: any): object is foo{}
object is now a regular identifier. The previous grammar was not able to parse the second example, probably because when the parser sees the second ':' for the return type, the contextual lexer does not know yet if it's a type predicate or predefined type, so it accepts 'object' as a predefined type and only fails later when it sees 'is'.test plan:
I tried in astexplorer.net and the second example is valid typescript code (sadly).
Checklist: