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
The virtual method resolution algorithm in use within linker is quite wrong and very difficult to map to the spec. One doesn't even go into the IL-level corner cases to get the algorithm to do wrong things.
For example, this is going to generate invalid outputs after linking:
interfaceIFoo{voidFrob(intx);}classBase<T>{// Linker thinks this method implements IFoo.Frob in DerivedprotectedvirtualvoidFrob(intx)=>Console.WriteLine("Unrelated");publicvirtualvoidFrob(Tx)=>Console.WriteLine("Actual");}classDerived:Base<int>,IFoo{}
This is going to keep more methods than necessary:
interfaceIFoo{voidFrob();}classBase:IFoo{// Linker thinks both methods implement the interfacepublicvirtualvoidFrob()=>Console.WriteLine("NameAndSig");voidIFoo.Frob()=>Console.WriteLine("MethodImpl");}
This will also keep more methods than necessary:
classBase{protectedvirtualvoidFrob()=>Console.WriteLine("Nobody calls me");}classDerived:Base{// Linker thinks this overrides Base.Frob, but they’re unrelatedpublicnewvirtualvoidFrob()=>Console.WriteLine("I am used");}
This needs to be reimplemented according to the spec.
The text was updated successfully, but these errors were encountered:
The virtual method resolution algorithm in use within linker is quite wrong and very difficult to map to the spec. One doesn't even go into the IL-level corner cases to get the algorithm to do wrong things.
For example, this is going to generate invalid outputs after linking:
This is going to keep more methods than necessary:
This will also keep more methods than necessary:
This needs to be reimplemented according to the spec.
The text was updated successfully, but these errors were encountered: