mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 19:48:20 +02:00
Don't allow conversions for type constraint matches
This commit is contained in:
parent
085a3fe091
commit
f44295e8ea
1 changed files with 3 additions and 3 deletions
|
@ -8693,7 +8693,7 @@ bool BfModule::CheckGenericConstraints(const BfGenericParamSource& genericParamS
|
||||||
else if ((checkArgType->IsFunction()) && (convCheckConstraint->IsInstanceOf(mCompiler->mFunctionTypeDef)))
|
else if ((checkArgType->IsFunction()) && (convCheckConstraint->IsInstanceOf(mCompiler->mFunctionTypeDef)))
|
||||||
constraintMatched = true;
|
constraintMatched = true;
|
||||||
}
|
}
|
||||||
else if (CanCast(GetFakeTypedValue(checkArgType), convCheckConstraint))
|
else if ((checkArgType == convCheckConstraint) || (TypeIsSubTypeOf(checkArgType->ToTypeInstance(), convCheckConstraint->ToTypeInstance())))
|
||||||
{
|
{
|
||||||
constraintMatched = true;
|
constraintMatched = true;
|
||||||
}
|
}
|
||||||
|
@ -8719,8 +8719,8 @@ bool BfModule::CheckGenericConstraints(const BfGenericParamSource& genericParamS
|
||||||
|
|
||||||
if (!constraintMatched)
|
if (!constraintMatched)
|
||||||
{
|
{
|
||||||
BfType* wrappedStructType = GetWrappedStructType(origCheckArgType, false);
|
BfTypeInstance* wrappedStructType = GetWrappedStructType(origCheckArgType, false);
|
||||||
if (CanCast(GetFakeTypedValue(wrappedStructType), convCheckConstraint))
|
if ((wrappedStructType == convCheckConstraint) || (TypeIsSubTypeOf(wrappedStructType, convCheckConstraint->ToTypeInstance())))
|
||||||
constraintMatched = true;
|
constraintMatched = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue