Unknown constant in go dependencies conflicts with Lisette's built-in Unknown type The…
- User
Unknown constant in go dependencies conflicts with Lisette's built-in Unknown type The discordgo package defines a constant named
Unknown(used for unrecognized types/events), which conflicts with Lisette's built-in Unknown type. When Lisette generates bindings for discordgo, any function signature that uses Unknown as a type parameter is misinterpreted — the compiler sees the discordgo value Unknown in a type position, causing a resolve.value_in_type_position error.Error output:
code🔴 Value in type position ╭─[go:github.com_bwmarrin_discordgo.d.lis:4693:46] 4692 │ /// Logger can be used to replace the standard logging for discordgo 4693 │ pub var Logger: fn(int, int, string, VarArgs<Unknown>) -> () · ───┬─── · ╰── expected type, found value 4694 │ ╰──── help: Only a type is allowed here · code: [resolve.value_in_type_position] 🔴 Value in type position ╭─[go:github.com_bwmarrin_discordgo.d.lis:4695:21] 4694 │ 4695 │ pub var Marshal: fn(Unknown) -> Result<Slice<byte>, error> · ───┬─── · ╰── expected type, found value 4696 │ ╰──── help: Only a type is allowed here · code: [resolve.value_in_type_position] 🔴 Value in type position ╭─[go:github.com_bwmarrin_discordgo.d.lis:4697:36] 4696 │ 4697 │ pub var Unmarshal: fn(Slice<byte>, Unknown) -> Result<(), error> · ───┬─── · ╰── expected type, found value 4698 │ ╰──── help: Only a type is allowed here · code: [resolve.value_in_type_position] - Assistant
Now let me write a failing test to confirm the reproduction:
- Assistant
Both tests reproduce the bug. Now the fix in
resolve_type_with_arity: - Assistant
Now update the local user-code test — it should lock in that user code keeps the diagnostic. Let me check
assert_infer_code: - Assistant
My change broke 10 emit snapshot tests. Let me see what changed:
- Assistant
Massive failure count — need to confirm it's the pre-existing missing-Go environment issue. Compare against pristine baseline:
- Assistant
Zero failures outside the Go-toolchain-dependent suites in both runs. Now run clippy, fmt, and the LSP test suite (semantics changed):
- Assistant
Everything passes. Let me review the final diff:
- Assistant
One correction — I referenced an issue number I can't verify. Let me drop it:
- Assistant
Fixed. Summary of what was done:
Root cause
When resolving a name in a type position,
resolve_type_with_arity(crates/semantics/src/checker/registration/convert.rs:292) returned the first in-scope match as long as its generic arity matched — even when that match was a definition. In generated Go bindings like discordgo's, the module declares and also uses the built-in type in signatures (). The constant won resolution, and then emitted .
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.