[mini] Runtime check if boxing is needed for DIM constrained calls (mono/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 https://github.com/mono/mono/commit/
3f55bfb5cc305c1c416edf84fff5440843784deb