Add _0_is_declared_here pointing to accessor declaration
This commit is contained in:
parent
61f60057f1
commit
d00a5c954f
4 changed files with 9 additions and 1 deletions
|
@ -25856,7 +25856,10 @@ namespace ts {
|
||||||
// Diagnose get accessors incorrectly called as functions
|
// Diagnose get accessors incorrectly called as functions
|
||||||
const { resolvedSymbol } = getNodeLinks(node.expression);
|
const { resolvedSymbol } = getNodeLinks(node.expression);
|
||||||
if (resolvedSymbol && resolvedSymbol.flags & SymbolFlags.GetAccessor) {
|
if (resolvedSymbol && resolvedSymbol.flags & SymbolFlags.GetAccessor) {
|
||||||
relatedInformation.push(createDiagnosticForNode(node.expression, Diagnostics._0_is_a_get_accessor_did_you_mean_to_use_it_without, getTextOfNode(node.expression)));
|
relatedInformation.push(
|
||||||
|
createDiagnosticForNode(node.expression, Diagnostics._0_is_a_get_accessor_did_you_mean_to_use_it_without, getTextOfNode(node.expression)),
|
||||||
|
createDiagnosticForNode(resolvedSymbol.valueDeclaration, Diagnostics._0_is_declared_here, symbolToString(resolvedSymbol))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (node.arguments.length === 1) {
|
else if (node.arguments.length === 1) {
|
||||||
|
|
|
@ -13,5 +13,6 @@ tests/cases/compiler/accessorAccidentalCallDiagnostic.ts(6,14): error TS2349: Th
|
||||||
!!! error TS2349: This expression is not callable.
|
!!! error TS2349: This expression is not callable.
|
||||||
!!! error TS2349: Type 'Number' has no call signatures.
|
!!! error TS2349: Type 'Number' has no call signatures.
|
||||||
!!! related TS6232 tests/cases/compiler/accessorAccidentalCallDiagnostic.ts:6:12: 'x.property' is a 'get' accessor; did you mean to use it without '()'?
|
!!! related TS6232 tests/cases/compiler/accessorAccidentalCallDiagnostic.ts:6:12: 'x.property' is a 'get' accessor; did you mean to use it without '()'?
|
||||||
|
!!! related TS2728 tests/cases/compiler/accessorAccidentalCallDiagnostic.ts:3:9: 'property' is declared here.
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIn
|
||||||
!!! error TS2349: This expression is not callable.
|
!!! error TS2349: This expression is not callable.
|
||||||
!!! error TS2349: Type 'Number' has no call signatures.
|
!!! error TS2349: Type 'Number' has no call signatures.
|
||||||
!!! related TS6232 tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts:19:14: 'd.y' is a 'get' accessor; did you mean to use it without '()'?
|
!!! related TS6232 tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts:19:14: 'd.y' 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.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,4 +67,5 @@ tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIn
|
||||||
!!! error TS2349: This expression is not callable.
|
!!! error TS2349: This expression is not callable.
|
||||||
!!! error TS2349: Type 'String' has no call signatures.
|
!!! error TS2349: Type 'String' has no call signatures.
|
||||||
!!! related TS6232 tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts:41:14: 'd.y' is a 'get' accessor; did you mean to use it without '()'?
|
!!! related TS6232 tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts:41:14: 'd.y' 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.
|
||||||
}
|
}
|
|
@ -34,6 +34,7 @@ tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.t
|
||||||
!!! error TS2349: This expression is not callable.
|
!!! error TS2349: This expression is not callable.
|
||||||
!!! error TS2349: Type 'Number' has no call signatures.
|
!!! error TS2349: Type 'Number' has no call signatures.
|
||||||
!!! related TS6232 tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts:17:14: 'c.y' is a 'get' accessor; did you mean to use it without '()'?
|
!!! related TS6232 tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts:17:14: 'c.y' 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.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,4 +63,5 @@ tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.t
|
||||||
!!! error TS2349: This expression is not callable.
|
!!! error TS2349: This expression is not callable.
|
||||||
!!! error TS2349: Type 'String' has no call signatures.
|
!!! error TS2349: Type 'String' has no call signatures.
|
||||||
!!! related TS6232 tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts:37:14: 'c.y' is a 'get' accessor; did you mean to use it without '()'?
|
!!! related TS6232 tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts:37:14: 'c.y' 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.
|
||||||
}
|
}
|
Loading…
Reference in a new issue