v-analyzer icon indicating copy to clipboard operation
v-analyzer copied to clipboard

Server crashed when method called on `it`

Open benash opened this issue 1 year ago • 0 comments

Describe the bug

When calling a method on a variable named it, the server managed by the VSCode extension crashes.

Expected Behavior

No crash

Current Behavior

The server crashes with message: Connection to server got closed. Server will not be restarted.

Reproduction Steps

Minimal example that causes a crash:

fn foo() {
	it.bar()
}

That code in itself is not valid V, but the server shouldn't crash. Additionally, the following code that is valid V still causes a crash:

struct Baz {}
fn (b Baz) bar() {}

fn foo() {
	it := Baz{}
	it.bar()
}

Possible Solution

No response

Additional Information/Context

No response

Environment details (v doctor output)

V full version: V 0.4.5 ec59760
OS: macos, macOS, 13.6.6, 22G630
Processor: 12 cpus, 64bit, little endian, Apple M2 Pro

getwd: /Users/ben/git/abc
vexe: /Users/ben/git/v/v
vexe mtime: 2024-04-29 14:58:21

vroot: OK, value: /Users/ben/git/v
VMODULES: OK, value: /Users/ben/.vmodules
VTMP: OK, value: /tmp/v_501

Git version: git version 2.39.3 (Apple Git-145)
Git vroot status: weekly.2024.18-6-gec597608 (3 commit(s) behind V master)
.git/config present: true

CC version: Apple clang version 15.0.0 (clang-1500.1.0.2.5)
thirdparty/tcc status: thirdparty-macos-arm64 5c1d002f

Editor name

VSCode

v-analyzer Version

v-analyzer version 0.0.4-beta.1.7e11a6f

VS Code Extension Version

v0.0.2

benash avatar Apr 29 '24 18:04 benash