Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix parser regression for bad related diagnostic on missing matching …
…brackets (#44158) * Revert "Revert #43460 and #40884 (#44175)" This reverts commit 5770434. * fix missing opening brace match error * refactor parseExpectedMatchingBrackets * use getNodePos * accept baselines * delete mistakenly added files * Revert getNodePos addition Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
- Loading branch information
Showing
60 changed files
with
299 additions
and
353 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
tests/baselines/reference/missingCloseBracketInArray.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
tests/cases/compiler/missingCloseBracketInArray.ts(1,48): error TS1005: ']' expected. | ||
|
||
|
||
==== tests/cases/compiler/missingCloseBracketInArray.ts (1 errors) ==== | ||
var alphas:string[] = alphas = ["1","2","3","4" | ||
|
||
!!! error TS1005: ']' expected. | ||
!!! related TS1007 tests/cases/compiler/missingCloseBracketInArray.ts:1:32: The parser expected to find a ']' to match the '[' token here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//// [missingCloseBracketInArray.ts] | ||
var alphas:string[] = alphas = ["1","2","3","4" | ||
|
||
//// [missingCloseBracketInArray.js] | ||
var alphas = alphas = ["1", "2", "3", "4"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
=== tests/cases/compiler/missingCloseBracketInArray.ts === | ||
var alphas:string[] = alphas = ["1","2","3","4" | ||
>alphas : Symbol(alphas, Decl(missingCloseBracketInArray.ts, 0, 3)) | ||
>alphas : Symbol(alphas, Decl(missingCloseBracketInArray.ts, 0, 3)) | ||
|
11 changes: 11 additions & 0 deletions
11
tests/baselines/reference/missingCloseBracketInArray.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
=== tests/cases/compiler/missingCloseBracketInArray.ts === | ||
var alphas:string[] = alphas = ["1","2","3","4" | ||
>alphas : string[] | ||
>alphas = ["1","2","3","4" : string[] | ||
>alphas : string[] | ||
>["1","2","3","4" : string[] | ||
>"1" : "1" | ||
>"2" : "2" | ||
>"3" : "3" | ||
>"4" : "4" | ||
|
32 changes: 32 additions & 0 deletions
32
tests/baselines/reference/missingCloseParenStatements.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
tests/cases/compiler/missingCloseParenStatements.ts(2,26): error TS1005: ')' expected. | ||
tests/cases/compiler/missingCloseParenStatements.ts(4,5): error TS1005: ')' expected. | ||
tests/cases/compiler/missingCloseParenStatements.ts(8,39): error TS1005: ')' expected. | ||
tests/cases/compiler/missingCloseParenStatements.ts(11,35): error TS1005: ')' expected. | ||
|
||
|
||
==== tests/cases/compiler/missingCloseParenStatements.ts (4 errors) ==== | ||
var a1, a2, a3 = 0; | ||
if ( a1 && (a2 + a3 > 0) { | ||
~ | ||
!!! error TS1005: ')' expected. | ||
!!! related TS1007 tests/cases/compiler/missingCloseParenStatements.ts:2:4: The parser expected to find a ')' to match the '(' token here. | ||
while( (a2 > 0) && a1 | ||
{ | ||
~ | ||
!!! error TS1005: ')' expected. | ||
!!! related TS1007 tests/cases/compiler/missingCloseParenStatements.ts:3:10: The parser expected to find a ')' to match the '(' token here. | ||
do { | ||
var i = i + 1; | ||
a1 = a1 + i; | ||
with ((a2 + a3 > 0) && a1 { | ||
~ | ||
!!! error TS1005: ')' expected. | ||
!!! related TS1007 tests/cases/compiler/missingCloseParenStatements.ts:8:18: The parser expected to find a ')' to match the '(' token here. | ||
console.log(x); | ||
} | ||
} while (i < 5 && (a1 > 5); | ||
~ | ||
!!! error TS1005: ')' expected. | ||
!!! related TS1007 tests/cases/compiler/missingCloseParenStatements.ts:11:17: The parser expected to find a ')' to match the '(' token here. | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
//// [missingCloseParenStatements.ts] | ||
var a1, a2, a3 = 0; | ||
if ( a1 && (a2 + a3 > 0) { | ||
while( (a2 > 0) && a1 | ||
{ | ||
do { | ||
var i = i + 1; | ||
a1 = a1 + i; | ||
with ((a2 + a3 > 0) && a1 { | ||
console.log(x); | ||
} | ||
} while (i < 5 && (a1 > 5); | ||
} | ||
} | ||
|
||
//// [missingCloseParenStatements.js] | ||
var a1, a2, a3 = 0; | ||
if (a1 && (a2 + a3 > 0)) { | ||
while ((a2 > 0) && a1) { | ||
do { | ||
var i = i + 1; | ||
a1 = a1 + i; | ||
with ((a2 + a3 > 0) && a1) { | ||
console.log(x); | ||
} | ||
} while (i < 5 && (a1 > 5)); | ||
} | ||
} |
Oops, something went wrong.