Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
edgarfgp opened this issue Nov 17, 2023 · 1 comment · Fixed by #17021
Closed

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

edgarfgp opened this issue Nov 17, 2023 · 1 comment · Fixed by #17021

Comments

@edgarfgp
Copy link
Contributor

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

@github-actions github-actions bot added this to the Backlog milestone Nov 17, 2023
@vzarytovskii
Copy link
Member

Same as #14012 we should disallow calling abstract members without implementation (I.e. only allow virtual methods).

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

Successfully merging a pull request may close this issue.

2 participants