Multiple type definitions appear for same type
Zig Version
0.11.0-dev.1863+a63134a4a
Zig Language Server Version
latest
Steps to Reproduce
Code:
var zig_str = if (value.isString())
value.getZigString(globalThis)
else
ZigString.Empty;
if (!zig_str.isAllASCII()) {
// ^ cursor here
zig_str = ZigString.Empty;
}
#1031 is a very nice improvement. It looks like there's a missing edgecase where when values branch but have the same type, they appear as two distinct types (both return ZigString here). Possibly related to that, I've noticed worse performance today compared to two days ago.
Expected Behavior
Show one type definition per unique type
Actual Behavior
Shows duplicate results
Different but related issue with
const abc = if (1 == 1) SomeStruct else null;
Where it just assumes abc is SomeStruct or null (determined at comptime) and not ?SomeStruct... oops
Don't you mean ?type?
#1067 will also have this problem for now.
The fix is using a StringArrayHashMapUnmanaged based on the resolved node index or something which should remove duplicates.
Same issue on:
const lib = if (shared)
b.addSharedLibrary(.{
.name = "winpthreads",
.optimize = optimize,
.target = target,
.version = .{
.major = 1,
.minor = 0,
.patch = 0,
},
})
else
b.addStaticLibrary(.{
.name = "winpthreads",
.optimize = optimize,
.target = target,
.version = .{
.major = 1,
.minor = 0,
.patch = 0,
},
});
The auto-completion mechanism stops working.