ISSUE DESCRIPTION Unknown constant in go dependencies conflicts with Lisette's built-in…
- User
ISSUE DESCRIPTION
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:
🔴 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]Root Cause
discordgodefines a constant named Unknown (e.g. Unknown Locale). Lisette also has a built-in type named Unknown used to represent opaque/untyped Go values in bindings. When the binding generator emits Unknown in a type position, the name resolves to the discordgo constant value instead of the Lisette type, triggering the error.Expected Behavior
Lisette's built-in Unknown type should take precedence in type positions, or the binding generator should qualify/disambiguate imported names that shadow built-in types.
Reproduction
Add github.com/bwmarrin/discordgo as a dependency and run lis run. The error appears immediately during binding resolution without any user-written code.
import "go:fmt" import "go:github.com/bwmarrin/discordgo" const TOKEN = "token" fn main() { let _discord = try { discordgo.New("Bot" + TOKEN)? } fmt.Println("Hello world!") } Assistant
Good,
DefinitionBodyis already imported. Now let's write a reproduction test first before making changes.Assistant
Good, exact pattern to reproduce this. Let's look at one example around types.rs:5100-5150 to craft my own.
Assistant
Now let's craft a temp test to reproduce the exact issue.
Assistant
Reproduced successfully. Now let's implement the fix in
resolve_type_with_arity.Assistant
All three exact signatures from the issue now compile without error. Now let's remove the scratch test and run the full test suite to check for regressions.
Assistant
Now let's run the full test suite to check for regressions.
Assistant
Builds cleanly. Now let's run the full test suite.
Assistant
Good, same baseline failures exist without my change — likely an environment/snapshot issue unrelated to my fix. Let's restore my change and check what's causing these baseline failures.
Assistant
Network is available. Let's install Go to get a clean test baseline.
Assistant
Confirmed pre-existing failure unrelated to my change (network/environment dependent, likely a large module download). All other 5147 tests pass with my fix. Let's clean up any leftover artifacts and do a final review of the diff.
Assistant
Clean. Now let's double check the exact issue reproduction with the full example from the issue (import statement, discordgo-like usage) using our test harness one more time, then verify with the checklist.
Assistant
The full end-to-end scenario from the issue now passes. Let's clean up the temp test.
Assistant
Now let's run the full test suite one final time to confirm everything is clean.
Assistant
Only the pre-existing network-dependent test fails (confirmed identical on baseline without my change). Let's clean up any snapshot artifacts once more and finalize.
Assistant
Final diff review:
Assistant
This is a minimal, targeted, and general fix. Let me go through the checklist:
Assistant
Everything looks good. Let me summarize the checklist review before submitting:
-
Reproduced the reported error: Yes — I built a temporary test using the
infer_with_go_typedefsharness that mimics a Go package defining a constant alongside generated bindings using as a builtin type (exactly matching the three signatures from the issue: , , ). This reproduced the exact error described in the issue.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.