Compile the repro below with/without optimizations.
Without optimizations, this prints:
That's good.
With optimizations, this prints:
That's not so good.
usingSystem;usingSystem.Collections.Generic;usingSystem.Runtime.CompilerServices;{MyStruct<object,object>s1=default;MyStruct<object,object>s2=default;Console.WriteLine(Equals(s1,s2));}{MyStruct<object,string>s1=default;MyStruct<object,string>s2=default;Console.WriteLine(Equals(s1,s2));}[MethodImpl(MethodImplOptions.NoInlining)]staticboolEquals<T>(Tx,Ty){returnEqualityComparer<T>.Default.Equals(x,y);}structMyStruct<T,U>:IEquatable<MyStruct<U,U>>{publicboolEquals(MyStruct<U,U>other){Console.WriteLine("Here");returnfalse;}}
Compile the repro below with/without optimizations.
Without optimizations, this prints:
That's good.
With optimizations, this prints:
That's not so good.