Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mini] Runtime check if boxing is needed for DIM constrained calls (m…
…ono/mono#15729) This is to handle the following example. The issue is that in Check() we have a constrained call where the called method is IAdder`1<!!U>::PlusPlus() which is a default interface method, and we need to determine at runtime whether to box the this argument. ``` using System; public interface IAdder<T> { int Add (int x); int PlusPlus () { return Add (1); } } interface IGen3<T> { } struct Adder<T> : IAdder<IGen3<T>> { int _field; public int Add (int x) { _field = x + _field; return _field; } } public class P { public static int Check<T, U>(T t) where T : IAdder<U> { return t.PlusPlus () + t.PlusPlus (); } public static void Main () { var x = new Adder<object> (); int y = Check<Adder<object>, IGen3<object>> (x); Console.WriteLine ("expect 2, got {0}", y); } } ``` Commit migrated from mono/mono@3f55bfb
- Loading branch information