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
This is a flash from the past (#1235). When I fixed that issue, I remarked "It still makes me uneasy, but I can't come up with a scenario where it wouldn't work.".
I found a scenario where it doesn't work:
using System;using System.Runtime.CompilerServices;Baseb=new Derived();
Console.WriteLine(b.GetFoo());interfaceIFoo{}classFoo:IFoo{}classBase{publicvirtual IFoo GetFoo()=>thrownew NotImplementedException();}classDerived:Base{publicoverride Foo GetFoo()=>null;}
Passing this program through illink produces
Unhandled exception. System.TypeLoadException: Return type in method 'Derived.GetFoo()' on type 'Derived' from assembly 'cons, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not compatible with base type method 'Base.GetFoo()'.
at <Program>$.<Main>$(String[] args)
The text was updated successfully, but these errors were encountered:
I think a simple fix for this would be something along the lines of: "When marking a new member because it's an explicit override of another method but the return type doesn't match, do Annotations.MarkRelevantToVariantCasting on the overriden method's return type."
This is a flash from the past (#1235). When I fixed that issue, I remarked "It still makes me uneasy, but I can't come up with a scenario where it wouldn't work.".
I found a scenario where it doesn't work:
Passing this program through illink produces
The text was updated successfully, but these errors were encountered: