tuyoogame / huatuo

huatuo是一个特性完整、零成本、高性能、低内存的近乎完美的Unity全平台原生c#热更方案。 Huatuo is a fully featured, zero-cost, high-performance, low-memory solution for Unity's all-platform native c# hotfix
MIT License
2.31k stars 377 forks source link

定义泛型方法的泛型返回值运行异常 #14

Closed blueberryWT closed 2 years ago

blueberryWT commented 2 years ago

测试环境

测试代码

public class HotfixMain
{
    public static void Init()
    {
        Debug.Log("init");
        Foo<MyClass>();
    }

    public static void Foo<T>() where T : class, new()
    {
        Debug.Log("call foo");
        FooB<T>(); // error
    }

    public static T FooB<T>() where T : class, new()
    {
        Debug.Log("call foo b");
        return null;
    }
}

public class MyClass
{

}

预期结果

调用后打印"call foo b"并且能够正常接收正确的返回值

代码文件

test_case.zip

pirunxi commented 2 years ago

确认bug。已修复。