Skip to content
TheChatArchiveThe Chat Archive
x-ai/grok-4.5· unknownHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION Unknown constant in go dependencies conflicts with Lisette's built-in…

  1. 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

    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.

    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!")
    }
    

    Interface

    No new interfaces are introduced.

    ADDITIONAL ADVICE

    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-$

  2. Assistant

    I'll start by exploring the repository structure and understanding how Lisette handles Go bindings and the Unknown type.

  3. Assistant

    Let me explore the bindgen and crates directories more carefully for Unknown type handling.

  4. Assistant

    rg is not found, let me use grep instead.

  5. Assistant

    There's a predeclared_shadowing pass and bindgen — I'll inspect both for how Unknown is handled.

  6. Assistant

    Next I'll inspect bindgen generation of Unknown and how name resolution treats built-in types.

  7. Assistant

    Inspecting the bindgen emitter reserved names and type-name resolution paths.

  8. Assistant

    Looking at convert.rs where the value_in_type_position error is raised.

  9. Assistant

    Let me continue reading convert.rs around the value_in_type_position error.

  10. Assistant

    I need to find resolve_type_with_arity and classify_non_type_name and how type name resolution works, particularly when Unknown constant shadows Unknown type.

  11. Assistant

    Let me read those functions.

  12. Assistant

    So the issue is clear: when resolving Unknown as a type name, it finds the local module's Unknown constant (from discordgo) first, before checking the prelude's Unknown type. There's already a s...

  13. Assistant

    There's already similar handling for Unit and prelude fallback. Checking prelude_shadowing and related tests for the intended pattern.

  14. Assistant

    Checking git history and tests for similar shadowing fixes.

  15. Assistant

    There's a similar issue already fixed: SUS-167 about transitive imports not shadowing types.

  16. Assistant

    Checking prelude types and how bindgen might rename conflicting constants.

  17. Assistant

    There's already a reservedKeywords map — inspecting how bindgen handles name conflicts next.

  18. Assistant

    Looking at the expected behavior again more carefully: I think the cleanest fix is to make Lisette's built-in Unknown type take precedence in type positions when an imported name shadows it. Looking at the resolve_type_with_arity function, I see that it already checks for non-type values and falls back to prelude types in some cases. I should extend that logic to 1) prefer prelude Unknown when we hit a value in type position, and 2) ensure that qualified names like discordgo.Unknown still resolve correctly.

    The key insight is that types and values share namespaces in Lisette, so we need explicit precedence rules for built-in types. I'll modify the resolution logic to check prelude first when we detect a value in type position, and update the error handling to be more precise.

    Let me also verify that this won't break cases where users intentionally shadow types with local constants, or where enum variants conflict with prelude types. The current classify_non_type_name already handles some of these edge cases nicely.

  19. Assistant

    Confirming: local module symbols are preferred over prelude, so I'll adjust type-position resolution to prefer builtin types when a value shadows them.

  20. Assistant

    Checking CHANGELOG and similar past fixes for preferred approach.

  21. Assistant

    Looking up where Unknown is defined in the stdlib/prelude.

  22. Assistant

    There's alsoOrder NameUnknown etc - no conflict. Let me check if discordgo or any stdlib has const Unknown.

  23. Assistant

    There's already a couple of stdlib packages that have constUnknown - go/constant!

  24. Assistant

    go/constant already has both pub const Unknown and uses of Unknown as a type — checking whether that package typechecks today.

  25. Assistant

    Reproducing the issue with a minimal case that shadows Unknown.

  26. Assistant

    It seems cargo build finished but didn't show the lis binary path - maybe it's not emitting because any already built? Let me find and run it.

  27. Assistant

    Reproduced the issue. Implementing the fix so prelude types win in type position when a local value shadows them.

  28. Assistant

    I'll update resolve_type_with_arity to prefer prelude when local resolution is a non-type.

  29. Assistant

    Rebuilding and verifying the reproduction case resolves.

  30. Assistant

    value_in_type_position is fixed. Checking go/constant-style cases and that non-prelude values still error.

  31. Assistant

    Good — Unknown works as a type; Foo still errors. Verifying with an imported go package next.

  32. Assistant

    go/constant works. Reproducing with discordgo as in the issue.

  33. Assistant

    Go isn't available here; go/constant is enough. Running related unit/UI tests for regressions.

  34. Assistant

    All value_in_type tests pass. Checking other type-resolution call sites that need the same fix.

  35. Assistant

    Only one call site needed the change. Running a broader set of resolution-related tests.

  36. Assistant

    All 413 infer tests pass. Running package unit tests and one multi-module Go import case.

  37. Assistant

    Those look like pre-existing emit snapshot failures. Confirming they're unrelated to my change.

  38. Assistant

    Confirmed pre-existing. Cleaning up snapshot noise and verifying the final diff.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.