Skip to content
TheChatArchiveThe Chat Archive
Claudeclaude-sonnet-5· anthropicHugging 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. Claude Assistant

    Now let's build and check compilation.

  3. Claude Assistant

    Compiles fine. Now let's write a reproduction test to confirm the fix works, mimicking the discordgo scenario without needing actual network dependency.

  4. Claude Assistant

    Test passes with the fix. Let's confirm it fails without the fix (sanity check by reverting temporarily).

  5. Claude Assistant

    Confirmed the fix resolves the reported error. Now let's remove the temporary test files and run the full existing test suite to make sure nothing broke.

  6. Claude Assistant

    Now run the full test suite to check nothing is broken.

  7. Claude Assistant

    Same tests fail in both cases (pre-existing environment issues, likely related to insta snapshot testing needing baseline or parallel test races). This confirms these failures are unrelated to our change. Let's run tests single-threaded to get a more reliable comparison and specifically check tests related to types/convert that we touched.

  8. Claude Assistant

    Good — only our intended fix remains. Let's view the final diff for review.

  9. Claude Assistant

    All existing "not a type" error tests still pass. Let's also run broader infer and resolve related test groups, plus emit tests around types/shadowing, and the ui/errors full suite.

  10. Claude Assistant

    All ui::errors (608) and spec::infer (1276) tests pass with no failures. This confirms the fix works correctly without regressions in the relevant test suites (emit/build snapshot failures are pre-existing environment issues due to missing go/gofmt binary, unrelated to this change).

  11. Claude Assistant

    Checklist review

    • If an error was reported in the issue description, I have successfully reproduced it. Yes — I built a temporary test (using the existing infer_with_go_typedefs harness) that mimics the discordgo scenario: a Go-bound module defining both pub const Unknown: int = 0 and a function signature using Unknown in a type position (fn(Unknown) -> Result<Slice<byte>, error>). Before the fix, this produced the exact resolve.value_in_type_position diagnostic described in the issue. I verified this by stashing my fix and re-running the test.

    • If an error was reported in the issue description, I have confirmed that my fix resolves the error. Yes — after applying the fix, the same reproduction test passes with zero errors. The root cause was in resolve_type_with_arity in crates/semantics/src/checker/registration/convert.rs: it picked a locally-resolved name (e.g. a Go constant Unknown) whenever its declared type's "arity" (0 for non-generic) happened to match the expected arity in a type position — even though a value/function/enum-variant name can never legitimately be used as a type. This caused it to short-circuit before ever trying the prelude fallback for the builtin Unknown type. The fix uses the existing classify_non_type_name helper to detect this situation and, when detected, prefers a same-named prelude/builtin type before falling back to reporting the original name as an error.

    • I have thought about edge cases and made sure my fix handles them as well.

      • If the user explicitly writes a package-qualified name (e.g. discordgo.Unknown), the !type_name.contains('.') guard is preserved, so no incorrect prelude fallback happens — the explicit qualified reference to the value still correctly errors.
      • If a Go package legitimately defines a real type named Unknown (not a constant/value), classify_non_type_name returns None for it, so it is not treated as non-type, and the user's real type correctly takes precedence over prelude (matching existing behavior for other shadowed builtin names like Unit).
      • If there is no prelude/builtin alternative available (a genuine user error, e.g. using a function or enum variant name as a type), the code falls through unchanged to the original diagnostic path, preserving existing error-reporting behavior — verified via the existing infer_not_a_type_* snapshot tests, all of which still pass.
    • I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. Yes — ran the full workspace test suite before and after the fix; the same 1576 tests fail in both cases (confirmed to be pre-existing environment failures caused by the go/gofmt binary not being installed in this sandbox, unrelated to this change and unrelated to formatting/semantics). More specifically targeted suites directly relevant to this change — ui::errors (608 tests) and spec::infer (1276 tests) — all pass with zero failures.

    Cleaned up all temporary test files/artifacts (tmp_repro_issue.rs, .snap.new files) so only the actual source fix remains in the diff.

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