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 look at how
resolve_type_nameis used elsewhere and checkstore.get_typebehavior for a const: - Assistant
Now let me write a reproduction test first. Let me check the test harness:
- Assistant
Let me add a reproduction test first:
- Assistant
Reproduced. Now implement the fix in
resolve_type_with_arity: - Assistant
Now run the full test suite:
- Assistant
Many failures — let me inspect one:
- Assistant
This failure looks like missing
gofmtformatting, possibly environmental. Let me check against the pristine tree: - Assistant
No Go toolchain in PATH, which explains the formatting-related failures. Let me diff failure sets between baseline and my change:
- Assistant
The fix is complete. Final diff:
- Assistant
Fixed. Summary of what was done:
Root cause
When the binding generator emits a package like discordgo, the generated
.d.lismodule contains bothpub const Unknown: Locale(the package's constant) and signatures using Lisette's built-inUnknowntype (e.g.pub var Marshal: fn(Unknown) -> ...). During type resolution,resolve_type_with_arity(crates/semantics/src/checker/registration/convert.rs:292) resolves to the module's own constant definition first — the current module wins over the prelude — and the caller then flags it with .
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.