Skip to content

Commit

Permalink
Change diagnostic wording
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebailey committed Jun 24, 2022
1 parent da5eb1a commit db3e062
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/compiler/diagnosticMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1493,7 +1493,7 @@
"category": "Message",
"code": 1476
},
"Instantiation expression cannot be followed by property access.": {
"An instantiation expression cannot be followed by a property access.": {
"category": "Error",
"code": 1477
},
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5649,7 +5649,7 @@ namespace ts {
if (isExpressionWithTypeArguments(expression) && expression.typeArguments) {
const pos = expression.typeArguments.pos - 1;
const end = skipTrivia(sourceText, expression.typeArguments.end) + 1;
parseErrorAt(pos, end, Diagnostics.Instantiation_expression_cannot_be_followed_by_property_access);
parseErrorAt(pos, end, Diagnostics.An_instantiation_expression_cannot_be_followed_by_a_property_access);
}
return finishNode(propertyAccess, pos);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/genericCallWithoutArgs.errors.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tests/cases/compiler/genericCallWithoutArgs.ts(4,2): error TS1477: Instantiation expression cannot be followed by property access.
tests/cases/compiler/genericCallWithoutArgs.ts(4,2): error TS1477: An instantiation expression cannot be followed by a property access.
tests/cases/compiler/genericCallWithoutArgs.ts(4,18): error TS1003: Identifier expected.


Expand All @@ -8,6 +8,6 @@ tests/cases/compiler/genericCallWithoutArgs.ts(4,18): error TS1003: Identifier e

f<number,string>.
~~~~~~~~~~~~~~~
!!! error TS1477: Instantiation expression cannot be followed by property access.
!!! error TS1477: An instantiation expression cannot be followed by a property access.

!!! error TS1003: Identifier expected.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiationExpressionErrors.ts(7,13): error TS1477: Instantiation expression cannot be followed by property access.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiationExpressionErrors.ts(8,13): error TS1477: Instantiation expression cannot be followed by property access.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiationExpressionErrors.ts(7,13): error TS1477: An instantiation expression cannot be followed by a property access.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiationExpressionErrors.ts(8,13): error TS1477: An instantiation expression cannot be followed by a property access.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiationExpressionErrors.ts(13,12): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'string[]'.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiationExpressionErrors.ts(13,14): error TS2693: 'number' only refers to a type, but is being used as a value here.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiationExpressionErrors.ts(18,12): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'number'.
Expand All @@ -25,10 +25,10 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiationExpr
const a2 = f.g<number>; // () => number
const a3 = f<number>.g; // <U>() => U
~~~~~~~~
!!! error TS1477: Instantiation expression cannot be followed by property access.
!!! error TS1477: An instantiation expression cannot be followed by a property access.
const a4 = f<number>.g<number>; // () => number
~~~~~~~~
!!! error TS1477: Instantiation expression cannot be followed by property access.
!!! error TS1477: An instantiation expression cannot be followed by a property access.
const a5 = f['g']<number>; // () => number

// `[` is an expression starter and cannot immediately follow a type argument list
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tests/cases/compiler/optionalChainWithInstantiationExpression1.ts(12,5): error TS1477: Instantiation expression cannot be followed by property access.
tests/cases/compiler/optionalChainWithInstantiationExpression1.ts(12,5): error TS1477: An instantiation expression cannot be followed by a property access.


==== tests/cases/compiler/optionalChainWithInstantiationExpression1.ts (1 errors) ====
Expand All @@ -15,7 +15,7 @@ tests/cases/compiler/optionalChainWithInstantiationExpression1.ts(12,5): error T

a?.b<c>.d;
~~~
!!! error TS1477: Instantiation expression cannot be followed by property access.
!!! error TS1477: An instantiation expression cannot be followed by a property access.

a?.b.d

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tests/cases/compiler/optionalChainWithInstantiationExpression1.ts(12,5): error TS1477: Instantiation expression cannot be followed by property access.
tests/cases/compiler/optionalChainWithInstantiationExpression1.ts(12,5): error TS1477: An instantiation expression cannot be followed by a property access.


==== tests/cases/compiler/optionalChainWithInstantiationExpression1.ts (1 errors) ====
Expand All @@ -15,7 +15,7 @@ tests/cases/compiler/optionalChainWithInstantiationExpression1.ts(12,5): error T

a?.b<c>.d;
~~~
!!! error TS1477: Instantiation expression cannot be followed by property access.
!!! error TS1477: An instantiation expression cannot be followed by a property access.

a?.b.d

Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ tests/cases/conformance/parser/ecmascript5/Generics/parserMemberAccessExpression
tests/cases/conformance/parser/ecmascript5/Generics/parserMemberAccessExpression1.ts(2,1): error TS2304: Cannot find name 'Foo'.
tests/cases/conformance/parser/ecmascript5/Generics/parserMemberAccessExpression1.ts(2,9): error TS2304: Cannot find name 'T'.
tests/cases/conformance/parser/ecmascript5/Generics/parserMemberAccessExpression1.ts(3,1): error TS2304: Cannot find name 'Foo'.
tests/cases/conformance/parser/ecmascript5/Generics/parserMemberAccessExpression1.ts(3,4): error TS1477: Instantiation expression cannot be followed by property access.
tests/cases/conformance/parser/ecmascript5/Generics/parserMemberAccessExpression1.ts(3,4): error TS1477: An instantiation expression cannot be followed by a property access.
tests/cases/conformance/parser/ecmascript5/Generics/parserMemberAccessExpression1.ts(4,1): error TS2304: Cannot find name 'Foo'.
tests/cases/conformance/parser/ecmascript5/Generics/parserMemberAccessExpression1.ts(4,4): error TS1477: Instantiation expression cannot be followed by property access.
tests/cases/conformance/parser/ecmascript5/Generics/parserMemberAccessExpression1.ts(4,4): error TS1477: An instantiation expression cannot be followed by a property access.
tests/cases/conformance/parser/ecmascript5/Generics/parserMemberAccessExpression1.ts(4,12): error TS2304: Cannot find name 'T'.


Expand All @@ -24,12 +24,12 @@ tests/cases/conformance/parser/ecmascript5/Generics/parserMemberAccessExpression
~~~
!!! error TS2304: Cannot find name 'Foo'.
~~~
!!! error TS1477: Instantiation expression cannot be followed by property access.
!!! error TS1477: An instantiation expression cannot be followed by a property access.
Foo<T>.Bar<T>();
~~~
!!! error TS2304: Cannot find name 'Foo'.
~~~
!!! error TS1477: Instantiation expression cannot be followed by property access.
!!! error TS1477: An instantiation expression cannot be followed by a property access.
~
!!! error TS2304: Cannot find name 'T'.

Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
tests/cases/conformance/parser/ecmascript5/Generics/parserMemberAccessOffOfGenericType1.ts(1,9): error TS2304: Cannot find name 'List'.
tests/cases/conformance/parser/ecmascript5/Generics/parserMemberAccessOffOfGenericType1.ts(1,13): error TS1477: Instantiation expression cannot be followed by property access.
tests/cases/conformance/parser/ecmascript5/Generics/parserMemberAccessOffOfGenericType1.ts(1,13): error TS1477: An instantiation expression cannot be followed by a property access.


==== tests/cases/conformance/parser/ecmascript5/Generics/parserMemberAccessOffOfGenericType1.ts (2 errors) ====
var v = List<number>.makeChild();
~~~~
!!! error TS2304: Cannot find name 'List'.
~~~~~~~~
!!! error TS1477: Instantiation expression cannot be followed by property access.
!!! error TS1477: An instantiation expression cannot be followed by a property access.

0 comments on commit db3e062

Please sign in to comment.