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
Let me write a reproduction test using this harness.
Assistant
Now let me create a temporary test to reproduce.
Assistant
Now let me remove the temporary tests and do a final full verification.
Assistant
All work is complete. Here's my checklist review:
1. If an error was reported in the issue description, I have successfully reproduced it.
Yes. I wrote a temporary test using the repo's harness with a Go typedef module declaring plus (exactly the discordgo shape). It produced — "Value in type position … expected type, found value" — matching the issue output.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
discordgo defines 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.
Since you are given a git repository, you can use git commands to simplify your work.
For example, if you made a mistake and want to revert your changes, you can use git checkout <file> to restore the file to its original state.
You can also reset all changes in the repository using git reset --hard command.
Additionally, you can use git stash and git stash pop to temporarily save your changes and restore them later.
Finally, you can see the changes that you've made (which will be submitted when you call submit) using git status or git diff commands.
However you don't need to use git add or git commit before submitting your changes. In fact,
submit only submits currently unstaged changes because it uses git diff to get the changes that need to be submitted.
CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
If an error was reported in the issue description, I have successfully reproduced it.
If an error was reported in the issue description, I have confirmed that my fix resolves the error.
I have thought about edge cases and made sure my fix handles them as well.
I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass.
I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /lisette, current file: none) bash-$
infer_with_go_typedefs
pub const Unknown = 0
pub var Marshal: fn(Unknown) -> Result<Slice<byte>, error>
resolve.value_in_type_position
2. If an error was reported, I have confirmed that my fix resolves the error.
Yes. After the change in crates/semantics/src/checker/registration/convert.rs (resolve_type_with_arity now prefers the prelude type when the resolved name is a value definition shadowing a built-in type), the repro test passes with zero errors, including the Logger: fn(int, int, string, VarArgs<Unknown>), Marshal, and Unmarshal signatures. I also emitted Go for that program and confirmed valid output (dg.Unknown value use and dg.Marshal(42) still work).
3. I have thought about edge cases and made sure my fix handles them as well.
Qualified names (dg.Unknown) are skipped — a package member in type position still errors correctly.
Prelude values (None, Some) shadowed in type position still produce value_in_type_position (verified with the existing infer_not_a_type_* UI snapshot tests, which pass).
A Go package declaring a real type named Unknown still wins over prelude (verified with a temp test).
Generic built-ins (Map<K,V>, Slice<T>) shadowed by Go functions of the same name now resolve with correct arity (verified).
A value shadowing a name that has no prelude type counterpart still errors as before (verified).
The redirect only applies to type positions; value resolution/emission is untouched.
4. I have run existing tests that might have been affected and confirmed they pass.
Yes. I captured the full cargo test failure set before and after my change: they are byte-identical (1576 pre-existing failures, all snapshot tests that need a Go toolchain/gofmt, which is not installed in this environment — the same failures occur on the pristine checkout). Targeted resolution/diagnostic tests pass, cargo fmt --check and cargo clippy are clean. All temporary tests and generated .snap.new files were removed; the final diff contains only the resolver fix and a short docs note.