mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 03:28:20 +02:00
Fixed incorrectly applied method generic constraints in constraint check
This commit is contained in:
parent
87405f3387
commit
fd24ab21af
2 changed files with 34 additions and 1 deletions
|
@ -8705,7 +8705,7 @@ bool BfModule::CheckGenericConstraints(const BfGenericParamSource& genericParamS
|
|||
{
|
||||
auto genericParamInst = mCurMethodInstance->mMethodInfoEx->mGenericParams[genericParamIdx];
|
||||
|
||||
if (genericParamInst->mExternType == checkArgType)
|
||||
if ((genericParamInst->mExternType == checkArgType) && (checkArgType->IsUnspecializedType()))
|
||||
{
|
||||
checkGenericParamFlags |= genericParamInst->mGenericParamFlags;
|
||||
}
|
||||
|
|
|
@ -97,6 +97,33 @@ namespace Tests
|
|||
}
|
||||
}
|
||||
|
||||
public static mixin Test<T>(T a) where T : struct {}
|
||||
public static mixin Test(Type value) {}
|
||||
public static mixin Test<T>(T a) where T : class, delete {}
|
||||
|
||||
public class TestClass<TValue>
|
||||
{
|
||||
public bool CallTest<T>(TValue val)
|
||||
where TValue : var
|
||||
{
|
||||
SelfOuter.Test!(val);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static mixin Test2<T>(T a) where T : struct {}
|
||||
public static mixin Test2<T>(T a) where T : class, delete {}
|
||||
|
||||
public class TestClass2<TValue>
|
||||
{
|
||||
public bool CallTest<T>(TValue val)
|
||||
where TValue : var
|
||||
{
|
||||
SelfOuter.Test2!(val);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public static void TestBasics()
|
||||
{
|
||||
|
@ -130,6 +157,12 @@ namespace Tests
|
|||
|
||||
DispClass dc = scope .();
|
||||
DisposeIt!(dc);
|
||||
|
||||
let test2 = scope TestClass<int>();
|
||||
test2.CallTest<int>(2);
|
||||
|
||||
let test3 = scope TestClass2<int>();
|
||||
test3.CallTest<int>(2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue