-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Better error recovery when errant semicolon found in a class. #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
==== tests/cases/compiler/ambientGetters.ts (3 errors) ==== | ||
==== tests/cases/compiler/ambientGetters.ts (2 errors) ==== | ||
|
||
declare class A { | ||
get length() : number; | ||
~ | ||
!!! '{' expected. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a bad error because fixing it (by putting the braces) will just lead you to another error (no accessors in ambient context) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch - this is definitely something worth looking into. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Plan to resolve in #139. |
||
} | ||
~ | ||
!!! Declaration or statement expected. | ||
|
||
declare class B { | ||
get length() { return 0; } | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,19 @@ | ||
==== tests/cases/compiler/es6ClassTest3.ts (15 errors) ==== | ||
==== tests/cases/compiler/es6ClassTest3.ts (2 errors) ==== | ||
module M { | ||
class Visibility { | ||
public foo() { }; | ||
~ | ||
!!! Unexpected token. A constructor, method, accessor, or property was expected. | ||
private bar() { }; | ||
~~~~~~~ | ||
!!! Declaration or statement expected. | ||
~ | ||
!!! ';' expected. | ||
~~~ | ||
!!! Cannot find name 'bar'. | ||
~ | ||
!!! Unexpected token. A constructor, method, accessor, or property was expected. | ||
private x: number; | ||
~~~~~~~ | ||
!!! Declaration or statement expected. | ||
~~~~~~ | ||
!!! Cannot find name 'number'. | ||
public y: number; | ||
~~~~~~ | ||
!!! Declaration or statement expected. | ||
~~~~~~ | ||
!!! Cannot find name 'number'. | ||
public z: number; | ||
~~~~~~ | ||
!!! Declaration or statement expected. | ||
~~~~~~ | ||
!!! Cannot find name 'number'. | ||
|
||
constructor() { | ||
~ | ||
!!! ';' expected. | ||
~~~~~~~~~~~ | ||
!!! Cannot find name 'constructor'. | ||
this.x = 1; | ||
~~~~ | ||
!!! 'this' cannot be referenced in a module body. | ||
this.y = 2; | ||
~~~~ | ||
!!! 'this' cannot be referenced in a module body. | ||
} | ||
} | ||
} | ||
~ | ||
!!! Declaration or statement expected. | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserEqualsGreaterThanAfterFunction2.ts (4 errors) ==== | ||
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserEqualsGreaterThanAfterFunction2.ts (5 errors) ==== | ||
function (a => b; | ||
~ | ||
!!! Identifier expected. | ||
~~ | ||
!!! ',' expected. | ||
~ | ||
!!! ',' expected. | ||
|
||
!!! ')' expected. | ||
~~~~~~~~~~~~~~~~~ | ||
!!! Function implementation expected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay!! Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well it wasn't easy, but I did it all for you Jason. 🎂