Lokad/ILPack

Partially defined generic methods are not working

OlegRa opened this issue · 0 comments

The current version of ILPack works fine with fully resolved generics methods and not-instantiated calls. But the partially-resolved scenario doesn't work at all. See the next synthetic example:

public class Test<T1>
{
    public T2 Method<T2>(T1 input, Func<T1,T2> callback) => callback(input);
    public static T2 Callback<T2>(T1 input) => default;
}

new Test<short>().Method(0, Test.Callback<byte>); // ILPack will fail trying to get method handle here

In fact, we receive a correct MethodImpl instance with partially-resolved types but are unable to create a MethodHandle for it. It shouldn't be a problem to add this handle dynamically during the method body writing process.