diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 9ec45f91d12..b27366c953c 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4093,7 +4093,7 @@ module ts { function checkForAtLeastOneTypeArgument(typeArguments: NodeArray) { if (typeArguments && typeArguments.length === 0) { var start = typeArguments.pos - "<".length; - var end = typeArguments.end + ">".length; + var end = skipTrivia(sourceText, typeArguments.end) + ">".length; return grammarErrorAtPos(start, end - start, Diagnostics.Type_argument_list_cannot_be_empty); } } @@ -4402,7 +4402,7 @@ module ts { if (typeParameters && typeParameters.length === 0) { var start = typeParameters.pos - "<".length; - var end = typeParameters.end + ">".length; + var end = skipTrivia(sourceText, typeParameters.end) + ">".length; return grammarErrorAtPos(start, end - start, Diagnostics.Type_parameter_list_cannot_be_empty); } } diff --git a/tests/baselines/reference/parserConstructorDeclaration12.errors.txt b/tests/baselines/reference/parserConstructorDeclaration12.errors.txt index 1af651d6ca9..949098e91da 100644 --- a/tests/baselines/reference/parserConstructorDeclaration12.errors.txt +++ b/tests/baselines/reference/parserConstructorDeclaration12.errors.txt @@ -39,22 +39,22 @@ tests/cases/compiler/parserConstructorDeclaration12.ts(9,3): error TS2392: Multi ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2392: Multiple constructor implementations are not allowed. constructor< >() { } - ~~ + ~~~ !!! error TS1098: Type parameter list cannot be empty. ~~~~~~~~~~~~~~~~~~~~ !!! error TS2392: Multiple constructor implementations are not allowed. constructor< > () { } - ~~ + ~~~ !!! error TS1098: Type parameter list cannot be empty. ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2392: Multiple constructor implementations are not allowed. constructor < >() { } - ~~ + ~~~ !!! error TS1098: Type parameter list cannot be empty. ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2392: Multiple constructor implementations are not allowed. constructor < > () { } - ~~ + ~~~ !!! error TS1098: Type parameter list cannot be empty. ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2392: Multiple constructor implementations are not allowed.