Skip to content

Calling an instance method as Type.method() passes Sema and fails in the LLVM verifier #1201

Closed

Description

@ehartford

Repro:

type P { n: i32 }
impl P:
    fn new() -> P: P { n: 0 }      // inside an impl this is an instance method (implicit &self)
fn main:
    let p = P.new()
    print(f"{p.n}")

Actual (seen building the compiler with this shape in src/CImport.w):

error: Incorrect number of arguments passed to called function!
  %232 = call %CiMacroProbes @"__wcu$2428$CiMacroProbes.new"(), !dbg !4394
error: LLVM function verification failed after MIR cleanup for ci_translate_macros

Expected: a source diagnostic at the call — P.new() names an instance method and supplies no receiver; suggest the constructor spelling fn P.new() -> P — never an invalid LLVM function. The MIR validators also passed this call with a missing receiver argument, so --validate-all has a gap here too.

Activity

  1. ehartford commented on Sep 19, 2026

    @ehartford
    ContributorAuthor

    Correction to the report: the tools were not silent. with analyze <file> audit:all reports this exact call ("violation: body 746 call 0: argument/signature mismatch args=0 params=1"). Only Sema accepted it. Fix is on branch fix-1201-static-call-of-instance-method: the static-receiver path checks the resolved signature's receiver mode.

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