Skip to content

Commit 889392a

Browse files
authored
fix(resolve): function call with same name variable in scope (#159)
Fixes #149
1 parent 327e942 commit 889392a

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

server/src/e2e/suite/testcases/resolve/basic.test

+12
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@ fun test() {
4343
------------------------------------------------------------------------
4444
4:4 -> 3:8 resolved
4545

46+
========================================================================
47+
Local variable resolve with same name function in call
48+
========================================================================
49+
fun value() {}
50+
51+
fun test() {
52+
let value = 1;
53+
<caret>value();
54+
}
55+
------------------------------------------------------------------------
56+
4:4 -> 0:4 resolved
57+
4658
========================================================================
4759
Parameter resolve
4860
========================================================================

server/src/psi/Reference.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -312,14 +312,21 @@ export class Reference {
312312
}
313313
}
314314

315-
if (!this.processBlock(proc, state)) return false
316-
317315
if (parent?.type === "asm_arrangement_args") {
318316
// `asm(cell self) extends fun storeRef(self: Builder, cell: Cell): Builder`
319317
// ^^^^ this
320318
return this.resolveAsmArrangementArgs(parent, proc, state)
321319
}
322320

321+
if (parent?.type === "static_call_expression") {
322+
// let context = context();
323+
// context();
324+
// ^^^^^^^ resolve only as global symbol
325+
return this.processAllEntities(proc, state)
326+
}
327+
328+
if (!this.processBlock(proc, state)) return false
329+
323330
return this.processAllEntities(proc, state)
324331
}
325332

0 commit comments

Comments
 (0)