diff --git a/src/parser.ts b/src/parser.ts index 5ab1cd69..7c9141cf 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -650,10 +650,14 @@ export class Parser extends DiagnosticEmitter { } } while (tn.skip(Token.COMMA)); if (!tn.skip(Token.CLOSEPAREN)) { - this.error( - DiagnosticCode._0_expected, - tn.range(), ")" - ); + if (isSignature) { + this.error( + DiagnosticCode._0_expected, + tn.range(), ")" + ); + } else { + tn.reset(state); + } this.tryParseSignatureIsSignature = isSignature; return null; } diff --git a/tests/parser/var.ts b/tests/parser/var.ts index c4a24a39..28ee26e8 100644 --- a/tests/parser/var.ts +++ b/tests/parser/var.ts @@ -8,3 +8,5 @@ var e; // 1155: 'const' declarations must be initialized. const f: i32; + +const t = 0 < (c / 10); diff --git a/tests/parser/var.ts.fixture.ts b/tests/parser/var.ts.fixture.ts index 0140bb28..52e138a1 100644 --- a/tests/parser/var.ts.fixture.ts +++ b/tests/parser/var.ts.fixture.ts @@ -4,5 +4,6 @@ const c: i32 = 0; var d = 2; var e; const f: i32; +const t = 0 < (c / 10); // ERROR 1110: "Type expected." in var.ts:7:5 // ERROR 1155: "'const' declarations must be initialized." in var.ts:10:6