potentialOverrideType.ConvertToCanonForm(CanonicalFormKind.Specific) != potentialOverrideType)
continue;
- // Similarly, if the type is canonical but this method instantiation isn't, don't mix them.
- if (!methodIsShared &&
- potentialOverrideType.IsCanonicalSubtype(CanonicalFormKind.Any))
- continue;
-
// If this is an interface gvm, look for types that implement the interface
// and other instantantiations that have the same canonical form.
// This ensure the various slot numbers remain equivalent across all types where there is an equivalence
TestGvmDelegates.Run();
TestGvmDependencies.Run();
TestGvmLookups.Run();
+ TestSharedAndUnsharedGvmAnalysisRegression.Run();
TestInterfaceVTableTracking.Run();
TestClassVTableTracking.Run();
TestReflectionInvoke.Run();
}
}
+ class TestSharedAndUnsharedGvmAnalysisRegression
+ {
+ interface IAtom { }
+ interface IPhantom { }
+ class Atom : IAtom, IPhantom { }
+
+ class Lol<TLeft> where TLeft : IAtom, IPhantom
+ {
+ public static void Run() => ((IPartitionedStreamRecipient<int>)new RightChildResultsRecipient<TLeft, int>()).ReceivePackage<int>();
+ }
+
+ interface IPartitionedStreamRecipient<T>
+ {
+ void ReceivePackage<U>();
+ }
+
+ sealed class RightChildResultsRecipient<TLeftInput, TRightInput> : IPartitionedStreamRecipient<TRightInput>
+ {
+ public void ReceivePackage<U>() => Console.WriteLine("Accepted");
+ }
+
+ static Type s_atom = typeof(Atom);
+
+ public static void Run()
+ {
+ // Make sure the compiler never saw anything more concrete than Lol<__Canon>.
+ typeof(Lol<>).MakeGenericType(s_atom).GetMethod("Run").Invoke(null, Array.Empty<object>());
+ }
+ }
+
class TestFieldAccess
{
class ClassType { }