mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 04:43:37 -05:00
Proper spans for empty type arg/param lists.
This commit is contained in:
@@ -4093,7 +4093,7 @@ module ts {
|
||||
function checkForAtLeastOneTypeArgument(typeArguments: NodeArray<TypeNode>) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user