fix order and tests
This commit is contained in:
parent
fd4eccee6c
commit
0b1cb74530
|
@ -26324,19 +26324,18 @@ namespace ts {
|
|||
);
|
||||
}
|
||||
|
||||
let headMessage = isCall ? Diagnostics.This_expression_is_not_callable : Diagnostics.This_expression_is_not_constructable;
|
||||
|
||||
// Diagnose get accessors incorrectly called as functions
|
||||
if (isCallExpression(errorTarget.parent) && errorTarget.parent.arguments.length === 0) {
|
||||
const { resolvedSymbol } = getNodeLinks(errorTarget);
|
||||
if (resolvedSymbol && resolvedSymbol.flags & SymbolFlags.GetAccessor) {
|
||||
errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without);
|
||||
headMessage = Diagnostics.This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
messageChain: chainDiagnosticMessages(
|
||||
errorInfo,
|
||||
isCall ? Diagnostics.This_expression_is_not_callable : Diagnostics.This_expression_is_not_constructable
|
||||
),
|
||||
messageChain: chainDiagnosticMessages(errorInfo, headMessage),
|
||||
relatedMessage: maybeMissingAwait ? Diagnostics.Did_you_forget_to_use_await : undefined,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
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 '()'?
|
||||
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 '()'?
|
||||
Type 'Number' has no call signatures.
|
||||
|
||||
|
||||
==== tests/cases/compiler/accessorAccidentalCallDiagnostic.ts (1 errors) ====
|
||||
|
@ -9,7 +10,7 @@ tests/cases/compiler/accessorAccidentalCallDiagnostic.ts(6,14): message TS6232:
|
|||
function test24554(x: Test24554) {
|
||||
return x.property();
|
||||
~~~~~~~~
|
||||
!!! message TS6232: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
|
||||
!!! related TS2728 tests/cases/compiler/accessorAccidentalCallDiagnostic.ts:3:9: 'property' is declared here.
|
||||
!!! message TS6234: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
|
||||
!!! message TS6234: Type 'Number' has no call signatures.
|
||||
}
|
||||
|
|
@ -1,9 +1,11 @@
|
|||
tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(4,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(7,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
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 '()'?
|
||||
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 '()'?
|
||||
Type 'Number' has no call signatures.
|
||||
tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(26,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(29,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
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 '()'?
|
||||
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 '()'?
|
||||
Type 'String' has no call signatures.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts (6 errors) ====
|
||||
|
@ -31,8 +33,8 @@ tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIn
|
|||
r.y = 4;
|
||||
var r6 = d.y(); // error
|
||||
~
|
||||
!!! message TS6232: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
|
||||
!!! related TS2728 tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts:4:13: 'y' is declared here.
|
||||
!!! message TS6234: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
|
||||
!!! message TS6234: Type 'Number' has no call signatures.
|
||||
|
||||
}
|
||||
|
||||
|
@ -60,6 +62,6 @@ tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIn
|
|||
r.y = '';
|
||||
var r6 = d.y(); // error
|
||||
~
|
||||
!!! message TS6232: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
|
||||
!!! related TS2728 tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts:26:13: 'y' is declared here.
|
||||
!!! message TS6234: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
|
||||
!!! message TS6234: Type 'String' has no call signatures.
|
||||
}
|
|
@ -1,9 +1,11 @@
|
|||
tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(4,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(7,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
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 '()'?
|
||||
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 '()'?
|
||||
Type 'Number' has no call signatures.
|
||||
tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(24,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(27,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
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 '()'?
|
||||
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 '()'?
|
||||
Type 'String' has no call signatures.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts (6 errors) ====
|
||||
|
@ -29,8 +31,8 @@ tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.t
|
|||
r.y = 4;
|
||||
var r6 = c.y(); // error
|
||||
~
|
||||
!!! message TS6232: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
|
||||
!!! related TS2728 tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts:4:13: 'y' is declared here.
|
||||
!!! message TS6234: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
|
||||
!!! message TS6234: Type 'Number' has no call signatures.
|
||||
|
||||
}
|
||||
|
||||
|
@ -56,6 +58,6 @@ tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.t
|
|||
r.y = '';
|
||||
var r6 = c.y(); // error
|
||||
~
|
||||
!!! message TS6232: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
|
||||
!!! related TS2728 tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts:24:13: 'y' is declared here.
|
||||
!!! message TS6234: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
|
||||
!!! message TS6234: Type 'String' has no call signatures.
|
||||
}
|
Loading…
Reference in a new issue