diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index f65f4c09f3f..766d53cb433 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1207,7 +1207,10 @@ namespace ts { return finishNode(node); } - return createMissingNode(SyntaxKind.Identifier, /*reportAtCurrentPosition*/ false, diagnosticMessage || Diagnostics.Identifier_expected); + // Only for end of file because the error gets reported incorrectly on embedded script tags. + const reportAtCurrentPosition = token() === SyntaxKind.EndOfFileToken; + + return createMissingNode(SyntaxKind.Identifier, reportAtCurrentPosition, diagnosticMessage || Diagnostics.Identifier_expected); } function parseIdentifier(diagnosticMessage?: DiagnosticMessage): Identifier { diff --git a/tests/baselines/reference/conflictMarkerTrivia4.errors.txt b/tests/baselines/reference/conflictMarkerTrivia4.errors.txt index 476dbbce6ce..5ea1b27f7f0 100644 --- a/tests/baselines/reference/conflictMarkerTrivia4.errors.txt +++ b/tests/baselines/reference/conflictMarkerTrivia4.errors.txt @@ -1,14 +1,14 @@ tests/cases/compiler/conflictMarkerTrivia4.ts(1,12): error TS2304: Cannot find name 'div'. +tests/cases/compiler/conflictMarkerTrivia4.ts(1,16): error TS1109: Expression expected. tests/cases/compiler/conflictMarkerTrivia4.ts(2,1): error TS1185: Merge conflict marker encountered. -tests/cases/compiler/conflictMarkerTrivia4.ts(2,13): error TS1109: Expression expected. ==== tests/cases/compiler/conflictMarkerTrivia4.ts (3 errors) ==== const x =
~~~ !!! error TS2304: Cannot find name 'div'. + +!!! error TS1109: Expression expected. <<<<<<< HEAD ~~~~~~~ -!!! error TS1185: Merge conflict marker encountered. - -!!! error TS1109: Expression expected. \ No newline at end of file +!!! error TS1185: Merge conflict marker encountered. \ No newline at end of file diff --git a/tests/baselines/reference/incompleteDottedExpressionAtEOF.errors.txt b/tests/baselines/reference/incompleteDottedExpressionAtEOF.errors.txt index fe5d93ec6c1..02348777190 100644 --- a/tests/baselines/reference/incompleteDottedExpressionAtEOF.errors.txt +++ b/tests/baselines/reference/incompleteDottedExpressionAtEOF.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/incompleteDottedExpressionAtEOF.ts(2,10): error TS2304: Cannot find name 'window'. -tests/cases/compiler/incompleteDottedExpressionAtEOF.ts(2,18): error TS1003: Identifier expected. +tests/cases/compiler/incompleteDottedExpressionAtEOF.ts(2,17): error TS1003: Identifier expected. ==== tests/cases/compiler/incompleteDottedExpressionAtEOF.ts (2 errors) ==== @@ -7,5 +7,5 @@ tests/cases/compiler/incompleteDottedExpressionAtEOF.ts(2,18): error TS1003: Ide var p2 = window. ~~~~~~ !!! error TS2304: Cannot find name 'window'. - + !!! error TS1003: Identifier expected. \ No newline at end of file diff --git a/tests/baselines/reference/jsxAndTypeAssertion.errors.txt b/tests/baselines/reference/jsxAndTypeAssertion.errors.txt index 5aa92086c37..d5df3915bf6 100644 --- a/tests/baselines/reference/jsxAndTypeAssertion.errors.txt +++ b/tests/baselines/reference/jsxAndTypeAssertion.errors.txt @@ -10,11 +10,13 @@ tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(14,45): error TS1005: '}' ex tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(18,2): error TS17008: JSX element 'foo' has no corresponding closing tag. tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(18,8): error TS17008: JSX element 'foo' has no corresponding closing tag. tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(18,13): error TS17008: JSX element 'foo' has no corresponding closing tag. +tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(18,83): error TS1109: Expression expected. tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(21,1): error TS1005: ':' expected. tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(21,1): error TS1005: '