Error message improvement for unexpected tokens in the following situations: * A word was parsed that seems to have a low edit distance from a known common keyword * A word was parsed that seems to be a known common keyword and a name _without_ a space in-between * Parsing in a particular type of node (mostly a class property declaration) got a different word or token than expected ___ * Specific diagnostic suggestions for unexpected keywords or identifier * Don't reach into there, that's not allowed * Improved error when there is already an initializer * Specific module error message for invalid template literal strings * Skip 'unexpected keyword or identifier' diagnostics for declare nodes * Improve error for function calls in type positions * Switch class properties to old diagnostic * Corrected errors in class members and reused existing textToKeywordObj map * Corrected more baselines from the merge * Update src/compiler/parser.ts Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com> * Mostly addressed feedback * Clarified function call type message * Split up and clarified parsing vs error functions * Swap interface name complaints back, and skip new errors on unknown (invalid) tokens * Used tokenToString, not a raw semicolon * Inline getExpressionText helper * Remove remarks in src/compiler/parser.ts Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
54 lines
3 KiB
Plaintext
54 lines
3 KiB
Plaintext
tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(1,10): error TS1003: Identifier expected.
|
|
tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(1,10): error TS1141: String literal expected.
|
|
tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(1,12): error TS1109: Expression expected.
|
|
tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(1,14): error TS1434: Unexpected keyword or identifier.
|
|
tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(1,14): error TS2304: Cannot find name 'from'.
|
|
tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(2,8): error TS1192: Module '"tests/cases/compiler/es6ImportNamedImportParsingError_0"' has no default export.
|
|
tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(2,24): error TS1005: '{' expected.
|
|
tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(3,1): error TS1128: Declaration or statement expected.
|
|
tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(3,8): error TS1128: Declaration or statement expected.
|
|
tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(3,16): error TS1434: Unexpected keyword or identifier.
|
|
tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(3,16): error TS2304: Cannot find name 'from'.
|
|
tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(4,13): error TS1005: 'from' expected.
|
|
tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(4,13): error TS1141: String literal expected.
|
|
tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(4,20): error TS1005: ';' expected.
|
|
|
|
|
|
==== tests/cases/compiler/es6ImportNamedImportParsingError_0.ts (0 errors) ====
|
|
export var a = 10;
|
|
export var x = a;
|
|
export var m = a;
|
|
|
|
==== tests/cases/compiler/es6ImportNamedImportParsingError_1.ts (14 errors) ====
|
|
import { * } from "es6ImportNamedImportParsingError_0";
|
|
~
|
|
!!! error TS1003: Identifier expected.
|
|
~
|
|
!!! error TS1141: String literal expected.
|
|
~
|
|
!!! error TS1109: Expression expected.
|
|
~~~~
|
|
!!! error TS1434: Unexpected keyword or identifier.
|
|
~~~~
|
|
!!! error TS2304: Cannot find name 'from'.
|
|
import defaultBinding, from "es6ImportNamedImportParsingError_0";
|
|
~~~~~~~~~~~~~~
|
|
!!! error TS1192: Module '"tests/cases/compiler/es6ImportNamedImportParsingError_0"' has no default export.
|
|
~~~~
|
|
!!! error TS1005: '{' expected.
|
|
import , { a } from "es6ImportNamedImportParsingError_0";
|
|
~~~~~~
|
|
!!! error TS1128: Declaration or statement expected.
|
|
~
|
|
!!! error TS1128: Declaration or statement expected.
|
|
~~~~
|
|
!!! error TS1434: Unexpected keyword or identifier.
|
|
~~~~
|
|
!!! error TS2304: Cannot find name 'from'.
|
|
import { a }, from "es6ImportNamedImportParsingError_0";
|
|
~
|
|
!!! error TS1005: 'from' expected.
|
|
~~~~~~
|
|
!!! error TS1141: String literal expected.
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS1005: ';' expected. |