Skip to content

analyze src/main.w audit:all: one MIR type, two LLVM struct names (LspDocument's HashMap[str, Vec[str]], 5 violations) #1984

Closed

Description

@ehartford

Found while working #1647 (D65). with analyze src/main.w audit:all on main 9307016 (stage1 built at that commit) reports 5 codegen place-type violations, all in LspDocument (src/Lsp.w): a field of MIR type HashMap[str, Vec[str]] projects to one LLVM struct while the MIR type itself lowers to another, differently named one:

violation: place 29 in LspDocument.new: projection lowers to LLVM type %"HashMap__str__struct{ptr,i64,i64,i64}" = type { ptr } but its MIR type 945 (HashMap[str, Vec[str]]) lowers to %__with.HashMap.str.__with.Vec.str = type { ptr }; base _16: LspDocument (ty 946) proj[0]=kind0:24065 got-int-width=-1 want-int-width=-1
violation: place 93 in LspDocument.ensure_analyzed: projection lowers to LLVM type %"HashMap__str__struct{ptr,i64,i64,i64}" = type { ptr } but its MIR type 945 (HashMap[str, Vec[str]]) lowers to %__with.HashMap.str.__with.Vec.str = type { ptr }; base _1: LspDocument (ty 946) proj[0]=kind0:24065 got-int-width=-1 want-int-width=-1
violation: place 136 in LspDocument.ensure_analyzed: projection lowers to LLVM type %"HashMap__str__struct{ptr,i64,i64,i64}" = type { ptr } but its MIR type 945 (HashMap[str, Vec[str]]) lowers to %__with.HashMap.str.__with.Vec.str = type { ptr }; base _1: LspDocument (ty 946) proj[0]=kind0:24065 got-int-width=-1 want-int-width=-1
violation: place 264 in LspDocument.ensure_analyzed: projection lowers to LLVM type %"HashMap__str__struct{ptr,i64,i64,i64}" = type { ptr } but its MIR type 945 (HashMap[str, Vec[str]]) lowers to %__with.HashMap.str.__with.Vec.str = type { ptr }; base _1: LspDocument (ty 946) proj[0]=kind0:24065 got-int-width=-1 want-int-width=-1
violation: place 11 in LspDocument.trait_methods_for_type: projection lowers to LLVM type %"HashMap__str__struct{ptr,i64,i64,i64}" = type { ptr } but its MIR type 945 (HashMap[str, Vec[str]]) lowers to %__with.HashMap.str.__with.Vec.str = type { ptr }; base _1: &LspDocument (ty 11665) proj[0]=kind2:0 proj[1]=kind0:24065 got-int-width=-1 want-int-width=-1

One Sema type has two LLVM identities: HashMap__str__struct{ptr,i64,i64,i64} (named from the LLVM layout of Vec[str]) and __with.HashMap.str.__with.Vec.str (named from the Sema type). The struct body is { ptr } either way, so the program runs, but per D65 the generic instance's LLVM name must be derived once from the Sema type, never from an LLVM layout. #1647's acceptance (audit:all green over src/main.w) needs this fixed.

Repro: out/bootstrap/bin/with-stage1 analyze src/main.w audit:all on a 9307016 worktree; the 8 other violations of the 13 are #1983.

Activity

  1. ehartford commented on Oct 3, 2026

    @ehartford
    ContributorAuthor

    Fixed on main by 0f0d76b (#2012, battery green on 6644771). audit:all over src/main.w: 13 violations → 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions