v-analyzer
v-analyzer copied to clipboard
No type infer for inlined functions called instantly
Describe the bug
When creating an inline function and instantly calling it, the type does not correctly get inferred:
// Inferred type for t is `unknown`
t := fn () string {
return ''
}()
However, does infer the type correctly:
test := fn () string {
return ''
}
t := test()
Expected Behavior
I expect the type to be correctly inferred. In the code examples, t should be inferred to string.
Current Behavior
The type is inferred as unknown.
Reproduction Steps
// Inferred type for t is `unknown`
t := fn () string {
return ''
}()
Possible Solution
No response
Additional Information/Context
No response
Environment details (v doctor output)
V full version: V 0.4.4 365bd18
OS: macos, macOS, 14.4, 23E214
Processor: 10 cpus, 64bit, little endian, Apple M1 Max
getwd: X
vexe: X
vexe mtime: 2024-03-12 15:26:32
vroot: OK, value: X
VMODULES: OK, value: X
VTMP: OK, value: X
Git version: git version 2.44.0
Git vroot status: weekly.2024.11-9-g365bd185
.git/config present: true
CC version: Apple clang version 15.0.0 (clang-1500.3.9.4)
thirdparty/tcc status: thirdparty-macos-arm64 5c1d002f
Editor name
VS Code
v-analyzer Version
0.0.3-beta.1.a796f25
VS Code Extension Version
v0.0.2
Could be related to: https://github.com/v-analyzer/v-analyzer/issues/17