Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #203 from Microsoft/arrowLookAhead
Improved lookahead for arrow functions.
- Loading branch information
Showing
14 changed files
with
276 additions
and
106 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
115 changes: 115 additions & 0 deletions
115
tests/baselines/reference/arrowFunctionsMissingTokens.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,115 @@ | ||
==== tests/cases/compiler/arrowFunctionsMissingTokens.ts (24 errors) ==== | ||
|
||
module missingArrowsWithCurly { | ||
var a = () { }; | ||
~ | ||
!!! '=>' expected. | ||
|
||
var b = (): void { } | ||
~ | ||
!!! '=>' expected. | ||
|
||
var c = (x) { }; | ||
~ | ||
!!! '=>' expected. | ||
|
||
var d = (x: number, y: string) { }; | ||
~ | ||
!!! '=>' expected. | ||
|
||
var e = (x: number, y: string): void { }; | ||
~ | ||
!!! '=>' expected. | ||
} | ||
|
||
module missingCurliesWithArrow { | ||
module withStatement { | ||
var a = () => var k = 10;}; | ||
~~~ | ||
!!! '{' expected. | ||
|
||
var b = (): void => var k = 10;} | ||
~~~ | ||
!!! '{' expected. | ||
|
||
var c = (x) => var k = 10;}; | ||
~~~ | ||
!!! '{' expected. | ||
|
||
var d = (x: number, y: string) => var k = 10;}; | ||
~~~ | ||
!!! '{' expected. | ||
|
||
var e = (x: number, y: string): void => var k = 10;}; | ||
~~~ | ||
!!! '{' expected. | ||
|
||
var f = () => var k = 10;} | ||
~~~ | ||
!!! '{' expected. | ||
} | ||
|
||
module withoutStatement { | ||
var a = () => }; | ||
~ | ||
!!! Expression expected. | ||
|
||
var b = (): void => } | ||
~ | ||
!!! Expression expected. | ||
|
||
var c = (x) => }; | ||
~ | ||
!!! Expression expected. | ||
|
||
var d = (x: number, y: string) => }; | ||
~ | ||
!!! Expression expected. | ||
|
||
var e = (x: number, y: string): void => }; | ||
~ | ||
!!! Expression expected. | ||
|
||
var f = () => } | ||
~ | ||
!!! Expression expected. | ||
} | ||
~ | ||
!!! Declaration or statement expected. | ||
} | ||
~ | ||
!!! Declaration or statement expected. | ||
|
||
module ce_nEst_pas_une_arrow_function { | ||
var a = (); | ||
~ | ||
!!! Expression expected. | ||
|
||
var b = (): void; | ||
~ | ||
!!! '=>' expected. | ||
|
||
var c = (x); | ||
~ | ||
!!! Cannot find name 'x'. | ||
|
||
var d = (x: number, y: string); | ||
~ | ||
!!! '=>' expected. | ||
|
||
var e = (x: number, y: string): void; | ||
~ | ||
!!! '=>' expected. | ||
} | ||
|
||
module okay { | ||
var a = () => { }; | ||
|
||
var b = (): void => { } | ||
|
||
var c = (x) => { }; | ||
|
||
var d = (x: number, y: string) => { }; | ||
|
||
var e = (x: number, y: string): void => { }; | ||
} |
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 |
---|---|---|
@@ -1,11 +1,9 @@ | ||
==== tests/cases/compiler/emptyMemberAccess.ts (2 errors) ==== | ||
==== tests/cases/compiler/emptyMemberAccess.ts (1 errors) ==== | ||
function getObj() { | ||
|
||
().toString(); | ||
~ | ||
!!! '=>' expected. | ||
~~~~~~~~ | ||
!!! Cannot find name 'toString'. | ||
~ | ||
!!! Expression expected. | ||
|
||
} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser566700.ts (1 errors) ==== | ||
var v = ()({}); | ||
~ | ||
!!! '=>' expected. | ||
~ | ||
!!! Expression expected. |
8 changes: 3 additions & 5 deletions
8
tests/baselines/reference/parserEmptyParenthesizedExpression1.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 |
---|---|---|
@@ -1,8 +1,6 @@ | ||
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserEmptyParenthesizedExpression1.ts (2 errors) ==== | ||
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserEmptyParenthesizedExpression1.ts (1 errors) ==== | ||
function getObj() { | ||
().toString(); | ||
~ | ||
!!! '=>' expected. | ||
~~~~~~~~ | ||
!!! Cannot find name 'toString'. | ||
~ | ||
!!! Expression expected. | ||
} |
4 changes: 2 additions & 2 deletions
4
tests/baselines/reference/parserErrorRecovery_Expression1.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/Expressions/parserErrorRecovery_Expression1.ts (1 errors) ==== | ||
var v = ()({}); | ||
~ | ||
!!! '=>' expected. | ||
~ | ||
!!! Expression expected. |
12 changes: 4 additions & 8 deletions
12
tests/baselines/reference/parserErrorRecovery_ParameterList5.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 |
---|---|---|
@@ -1,10 +1,6 @@ | ||
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ParameterLists/parserErrorRecovery_ParameterList5.ts (4 errors) ==== | ||
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ParameterLists/parserErrorRecovery_ParameterList5.ts (2 errors) ==== | ||
(a:number => { } | ||
~ | ||
!!! ')' expected. | ||
~~ | ||
!!! ';' expected. | ||
~ | ||
!!! Cannot find name 'a'. | ||
~~~~~~ | ||
!!! Cannot find name 'number'. | ||
!!! ',' expected. | ||
~ | ||
!!! ')' expected. |
Oops, something went wrong.