mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-17 07:44:09 +02:00
Fixed extern method generic arg case
This commit is contained in:
parent
8c79e26d40
commit
6c714bacdc
3 changed files with 26 additions and 6 deletions
|
@ -99,9 +99,15 @@ namespace IDETest
|
||||||
TestGen(a); //FAIL Unable to determine generic argument 'TItem'
|
TestGen(a); //FAIL Unable to determine generic argument 'TItem'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void Method7<T>() where T : var where comptype(typeof(T)) : class
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static void TestGenBug()
|
public static void TestGenBug()
|
||||||
{
|
{
|
||||||
TestPreGen<List<int>>();
|
TestPreGen<List<int>>();
|
||||||
|
Method7<int>(); //FAIL The type 'int' must be a reference type in order to use it as parameter 'comptype(typeof(T))' for 'IDETest.Generics.Method7<int>()'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2287,14 +2287,17 @@ bool BfMethodMatcher::CheckMethod(BfTypeInstance* targetTypeInstance, BfTypeInst
|
||||||
auto genericParamType = (BfGenericParamType*)externType;
|
auto genericParamType = (BfGenericParamType*)externType;
|
||||||
if (genericParamType->mGenericParamKind == BfGenericParamKind_Method)
|
if (genericParamType->mGenericParamKind == BfGenericParamKind_Method)
|
||||||
{
|
{
|
||||||
auto genericArg = (*genericArgumentsSubstitute)[genericParamType->mGenericParamIdx];
|
if (genericArgumentsSubstitute != NULL)
|
||||||
if (genericArg == NULL)
|
|
||||||
{
|
{
|
||||||
if (allowEmptyGenericSet.Contains(genericParamType->mGenericParamIdx))
|
auto genericArg = (*genericArgumentsSubstitute)[genericParamType->mGenericParamIdx];
|
||||||
continue;
|
if (genericArg == NULL)
|
||||||
goto NoMatch;
|
{
|
||||||
|
if (allowEmptyGenericSet.Contains(genericParamType->mGenericParamIdx))
|
||||||
|
continue;
|
||||||
|
goto NoMatch;
|
||||||
|
}
|
||||||
|
externType = genericArg;
|
||||||
}
|
}
|
||||||
externType = genericArg;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -331,6 +331,16 @@ namespace Tests
|
||||||
return (TOut)val;
|
return (TOut)val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void MethodH<T, T2>(T val) where T2 : List<T>
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MethodI<T, T2>(T val) where comptype(typeof(T2)) : List<T>
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public static void TestBasics()
|
public static void TestBasics()
|
||||||
{
|
{
|
||||||
|
@ -404,6 +414,7 @@ namespace Tests
|
||||||
|
|
||||||
Test.Assert(Conv<int...>(12.34f) == 12);
|
Test.Assert(Conv<int...>(12.34f) == 12);
|
||||||
Test.Assert(Conv<int,?>(12.34f) == 12);
|
Test.Assert(Conv<int,?>(12.34f) == 12);
|
||||||
|
//MethodH(scope List<int>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue