Skip to content

Commit 0b1cb74

Browse files
committed
fix order and tests
1 parent fd4ecce commit 0b1cb74

4 files changed

+24
-20
lines changed

src/compiler/checker.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -26324,19 +26324,18 @@ namespace ts {
2632426324
);
2632526325
}
2632626326

26327+
let headMessage = isCall ? Diagnostics.This_expression_is_not_callable : Diagnostics.This_expression_is_not_constructable;
26328+
2632726329
// Diagnose get accessors incorrectly called as functions
2632826330
if (isCallExpression(errorTarget.parent) && errorTarget.parent.arguments.length === 0) {
2632926331
const { resolvedSymbol } = getNodeLinks(errorTarget);
2633026332
if (resolvedSymbol && resolvedSymbol.flags & SymbolFlags.GetAccessor) {
26331-
errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without);
26333+
headMessage = Diagnostics.This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without;
2633226334
}
2633326335
}
2633426336

2633526337
return {
26336-
messageChain: chainDiagnosticMessages(
26337-
errorInfo,
26338-
isCall ? Diagnostics.This_expression_is_not_callable : Diagnostics.This_expression_is_not_constructable
26339-
),
26338+
messageChain: chainDiagnosticMessages(errorInfo, headMessage),
2634026339
relatedMessage: maybeMissingAwait ? Diagnostics.Did_you_forget_to_use_await : undefined,
2634126340
};
2634226341
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
tests/cases/compiler/accessorAccidentalCallDiagnostic.ts(6,14): message TS6232: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
1+
tests/cases/compiler/accessorAccidentalCallDiagnostic.ts(6,14): message TS6234: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
2+
Type 'Number' has no call signatures.
23

34

45
==== tests/cases/compiler/accessorAccidentalCallDiagnostic.ts (1 errors) ====
@@ -9,7 +10,7 @@ tests/cases/compiler/accessorAccidentalCallDiagnostic.ts(6,14): message TS6232:
910
function test24554(x: Test24554) {
1011
return x.property();
1112
~~~~~~~~
12-
!!! message TS6232: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
13-
!!! related TS2728 tests/cases/compiler/accessorAccidentalCallDiagnostic.ts:3:9: 'property' is declared here.
13+
!!! message TS6234: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
14+
!!! message TS6234: Type 'Number' has no call signatures.
1415
}
1516

tests/baselines/reference/instancePropertiesInheritedIntoClassType.errors.txt

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(4,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
22
tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(7,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
3-
tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(19,16): message TS6232: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
3+
tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(19,16): message TS6234: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
4+
Type 'Number' has no call signatures.
45
tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(26,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
56
tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(29,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
6-
tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(41,16): message TS6232: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
7+
tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(41,16): message TS6234: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
8+
Type 'String' has no call signatures.
79

810

911
==== tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts (6 errors) ====
@@ -31,8 +33,8 @@ tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIn
3133
r.y = 4;
3234
var r6 = d.y(); // error
3335
~
34-
!!! message TS6232: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
35-
!!! related TS2728 tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts:4:13: 'y' is declared here.
36+
!!! message TS6234: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
37+
!!! message TS6234: Type 'Number' has no call signatures.
3638

3739
}
3840

@@ -60,6 +62,6 @@ tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIn
6062
r.y = '';
6163
var r6 = d.y(); // error
6264
~
63-
!!! message TS6232: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
64-
!!! related TS2728 tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts:26:13: 'y' is declared here.
65+
!!! message TS6234: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
66+
!!! message TS6234: Type 'String' has no call signatures.
6567
}

tests/baselines/reference/instancePropertyInClassType.errors.txt

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(4,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
22
tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(7,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
3-
tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(17,16): message TS6232: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
3+
tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(17,16): message TS6234: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
4+
Type 'Number' has no call signatures.
45
tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(24,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
56
tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(27,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
6-
tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(37,16): message TS6232: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
7+
tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(37,16): message TS6234: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
8+
Type 'String' has no call signatures.
79

810

911
==== tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts (6 errors) ====
@@ -29,8 +31,8 @@ tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.t
2931
r.y = 4;
3032
var r6 = c.y(); // error
3133
~
32-
!!! message TS6232: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
33-
!!! related TS2728 tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts:4:13: 'y' is declared here.
34+
!!! message TS6234: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
35+
!!! message TS6234: Type 'Number' has no call signatures.
3436

3537
}
3638

@@ -56,6 +58,6 @@ tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.t
5658
r.y = '';
5759
var r6 = c.y(); // error
5860
~
59-
!!! message TS6232: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
60-
!!! related TS2728 tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts:24:13: 'y' is declared here.
61+
!!! message TS6234: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
62+
!!! message TS6234: Type 'String' has no call signatures.
6163
}

0 commit comments

Comments
 (0)