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:
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
I'll start by exploring the repository structure and understanding how Lisette handles Go bindings and the Unknown type.
- Assistant
I'll search for how Unknown is defined and used in the binding generator.
- Assistant
rg is not available, I'll use grep instead.
- Assistant
There's a reserved-names list in the emitter — I'll inspect that and related name-resolution code.
- Assistant
Let me read the emitter.go file around that area to understand how names are handled.
- Assistant
I'll look at how the semantics crate resolves names and whether it already handles shadowing of builtins.
- Assistant
There's a predeclared_shadowing check that looks directly relevant — I'll inspect it and the type-position resolution path.
- Assistant
Let me look at the registration convert.rs where value_in_type_position is emitted, and at how name resolution works for type positions.
- Assistant
Let me continue reading where value_in_type_position is.
- Assistant
I'll inspect name resolution and how other builtins handle shadowing conflicts.
- Assistant
There's also a dedicated prelude_shadowing pass — let me read that next.
- Assistant
I need to understand how get_type works for constants vs types.
- Assistant
I'll inspect lookup_qualified_name, get_type, and how Unknown is defined in the prelude.
- Assistant
I'll check recent history and tests related to Unknown shadowing.
- Assistant
I'll look for existing name-collision handling in bindgen and similar builtins.
- Assistant
There's already a reservedKeywords map. Let me read converters.go around that.
- Assistant
I'll look at how bindings load packages and whether decorator_aliases already covers similar shadowing cases.
- Assistant
There's a related comment about package-local Option vs prelude.Option — I'll inspect that test.
- Assistant
I'll inspect get_type and how type registrations work for values.
- Assistant
I'll inspect how Unknown is registered in the prelude and which other arity-0 builtins exist.
- Assistant
Let me look at how Unknown is defined in Lispette prelude - maybe it's in d.lis files or syntax.
- Assistant
Let me look at how Unknown is defined in prelude.d.lis
- Assistant
I need to check whether go binding typedefs can reference prelude-qualified types.
- Assistant
Let me read putpendant file context and put_preludein more carefully.
- Assistant
I'll check registration order - when type annotations are resolved vs when consts are registered.
- Assistant
Let me look at register_types_and_values
- Assistant
Let me read those functions.
- Assistant
I'll look for related tests and then implement the fix.
- Assistant
I'll check for any existing branch/work and how go typedef fixtures are tested in the suite.
- Assistant
I'll look at nearby go-typedef tests for the pattern, then apply the fix.
- Assistant
I'll implement the fix so type resolution prefers the prelude builtin when a package value shadows it.
- Assistant
Updating
resolve_type_with_arityto prefer prelude types when a local value shadows them. - Assistant
I'll write a temporary reproduction test and run it to verify the fix.
- Assistant
I'll add a temporary regression test, run it, then remove it.
- Assistant
I'll fix the comment typo and run the regression test.
- Assistant
The filter didn't match — I'll find the correct test name and run it.
- Assistant
The test passed. I'll verify edge cases still error correctly, then remove the temporary test.
- Assistant
Need a single filter pattern
- Assistant
The non-prelude case didn't error — I need to inspect value-registration order.
- Assistant
I'll debug why the non-prelude value didn't produce an error.
- Assistant
Let me check InferResult and how to print errors properly.
- Assistant
Let me check how diagnostics provide code_str
- Assistant
I'll fix the debug test using public diagnostic APIs.
- Assistant
Typo in the script — I'll rewrite it cleanly.
- Assistant
I'll check how function signatures resolve type annotations.
- Assistant
Let me read extract_signature_parts and how r that's used around 766 for const.
- Assistant
I'll check whether function registration discards type errors too.
- Assistant
Type errors are discarded during signature registration — I'll check variable declaration handling and when errors surface.
- Assistant
I'll check whether we interface/method registration keeps type-position errors.
- Assistant
Removing temporary tests and running related existing tests.
- Assistant
I'll re-add just the main regression test once more, then run related tests.
- Assistant
All edge cases pass. Restoring the tests file and running related existing tests.
- Assistant
That snapshot drift looks unrelated. I'll run the resolve/type-position tests instead.
- Assistant
I'll do a final review of the change and confirm the working tree is clean aside from the fix.
- Assistant
Cleaning up the stray snapshot file from the unrelated test.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.