You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Accessing to IWSAM static abstract member produces Bad IL format #16299
Provide the steps required to reproduce the problem:
#nowarn"3535"#nowarn"3536"typeIPrintable=static abstractmemberLog:string->stringtypeSomeClass1()=memberthis.GetLog(s:string)= IPrintable.Log(s)static memberLog(s:string)= s
interface IPrintable withstatic memberLog(s:string)= s
letsomeClass= SomeClass1()letx= SomeClass1.Log("hello")lety= someClass.GetLog("hello")letz= 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
Activity
vzarytovskii commentedon Nov 17, 2023
Same as #14012 we should disallow calling abstract members without implementation (I.e. only allow virtual methods).