Skip to content

Commit 9aa60f2

Browse files
author
Andy
authored
goToDefinition: Don't add duplicate definitions for PropertyAssignment and ArrowFunction at m: () => {} (microsoft#24995)
* goToDefinition: Don't add duplicate definitions for PropertyAssignment and ArrowFunction at `m: () => {}` * Just use !isCallLikeExpression
1 parent e8e80d2 commit 9aa60f2

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/services/goToDefinition.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ namespace ts.GoToDefinition {
9999
*/
100100
function symbolMatchesSignature(s: Symbol, calledDeclaration: SignatureDeclaration) {
101101
return s === calledDeclaration.symbol || s === calledDeclaration.symbol.parent ||
102-
isVariableDeclaration(calledDeclaration.parent) && s === calledDeclaration.parent.symbol;
102+
!isCallLikeExpression(calledDeclaration.parent) && s === calledDeclaration.parent.symbol;
103103
}
104104

105105
export function getReferenceAtPosition(sourceFile: SourceFile, position: number, program: Program): { fileName: string, file: SourceFile } | undefined {

tests/cases/fourslash/goToDefinitionSignatureAlias.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,15 @@
1414
////[|/*useI*/i|]();
1515
////[|/*useJ*/j|]();
1616

17+
////const o = { m: /*m*/() => 0 };
18+
////o.[|/*useM*/m|]();
19+
1720
verify.goToDefinition({
1821
useF: "f",
1922
useG: ["g", "f"],
2023
useH: ["h", "f"],
2124

2225
useI: "i",
2326
useJ: ["j", "i"],
27+
useM: "m",
2428
});

0 commit comments

Comments
 (0)