Skip to content

Accessing to IWSAM static abstract member produces Bad IL format #16299

@edgarfgp

Description

@edgarfgp

Repro steps

Provide the steps required to reproduce the problem:

#nowarn "3535"
#nowarn "3536"

type IPrintable =
    static abstract member Log: string -> string

type SomeClass1() =
    member this.GetLog(s: string) = IPrintable.Log(s)
    
    static member Log(s: string) = s
    
    interface IPrintable with
        static member Log(s: string) = s
        
let someClass = SomeClass1()
let x = SomeClass1.Log("hello")
let y = someClass.GetLog("hello")
let z = IPrintable.Log("hello")

Expected behavior
Should not compile and have error reporting preventing this

Provide a description of the expected behavior.

Actual behavior
Compiles and produces:

System.BadImageFormatException: Bad IL format.
   at <StartupCode$FSI_0004>.$FSI_0004.main@()
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
Stopped due to error

Provide a description of the actual behaviour observed.

Known workarounds
N/A

Provide a description of any known workarounds.
N/A

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions