1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Properly use method generic arguments from methodrefs

This commit is contained in:
Brian Fiete 2025-02-01 12:19:49 -08:00
parent 5b0ccb6dbe
commit f466a2ea57
2 changed files with 23 additions and 0 deletions

View file

@ -10500,6 +10500,12 @@ BfTypedValue BfExprEvaluator::MatchMethod(BfAstNode* targetSrc, BfMethodBoundExp
methodGenericArguments = methodInstance->mMethodInfoEx->mMethodGenericArguments;
methodMatcher.mBestMethodInstance = mModule->GetMethodInstance(methodInstance->GetOwner(), methodInstance->mMethodDef, methodGenericArguments);
}
if (methodInstance->mMethodInfoEx != NULL)
{
methodMatcher.mBestMethodGenericArguments = methodInstance->mMethodInfoEx->mMethodGenericArguments;
}
methodMatcher.mBestMethodTypeInstance = methodInstance->GetOwner();
if (methodInstance->HasThis())
{

View file

@ -483,6 +483,21 @@ namespace Tests
}
}
public static void Test<F>(F func)
where F: delegate void(delegate void(String, params Span<Object>))
{
String str = scope .();
delegate void(String, params Span<Object>) setError = scope (errStr, args) => { str.AppendF(errStr, params args); };
delegate void() call = scope () => func(setError);
call();
}
public static void Test<T>() where T : var
{
Test((e) => e("hi!"));
}
[Test]
public static void ClassTestA()
{
@ -499,6 +514,8 @@ namespace Tests
val.Test();
val = .();
val.TestDlg();
Test<int>();
}
[Test]