mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 20:12:21 +02:00
Method selection fix with extern constraint subsets, prim default ctor
This commit is contained in:
parent
e887b2fb59
commit
4188f607c7
2 changed files with 11 additions and 2 deletions
|
@ -1102,7 +1102,7 @@ void BfMethodMatcher::CompareMethods(BfMethodInstance* prevMethodInstance, BfTyp
|
|||
|
||||
for (auto kv : externConstraints)
|
||||
{
|
||||
SET_BETTER_OR_WORSE(mModule->AreConstraintsSubset(kv.mValue.mParams[1], kv.mValue.mParams[0]), mModule->AreConstraintsSubset(kv.mValue.mParams[0], kv.mValue.mParams[1]));
|
||||
SET_BETTER_OR_WORSE(mModule->AreConstraintsSubset(kv.mValue.mParams[0], kv.mValue.mParams[1]), mModule->AreConstraintsSubset(kv.mValue.mParams[1], kv.mValue.mParams[0]));
|
||||
}
|
||||
|
||||
if ((isBetter) || (isWorse))
|
||||
|
@ -8127,6 +8127,8 @@ BfTypedValue BfExprEvaluator::MatchMethod(BfAstNode* targetSrc, BfMethodBoundExp
|
|||
{
|
||||
if (targetType->IsWrappableType())
|
||||
{
|
||||
if ((targetType->IsPrimitiveType()) && (methodName.IsEmpty()))
|
||||
return mModule->GetDefaultTypedValue(targetType);
|
||||
targetTypeInst = mModule->GetWrappedStructType(targetType);
|
||||
}
|
||||
else if (targetType->IsGenericParam())
|
||||
|
@ -8518,6 +8520,9 @@ BfTypedValue BfExprEvaluator::MatchMethod(BfAstNode* targetSrc, BfMethodBoundExp
|
|||
{
|
||||
FinishDeferredEvals(argValues);
|
||||
|
||||
if (argValues.mResolvedArgs.IsEmpty())
|
||||
return mModule->GetDefaultTypedValue(refType);
|
||||
|
||||
if (argValues.mResolvedArgs.size() != 1)
|
||||
{
|
||||
mModule->Fail("Cast requires one parameter", targetSrc);
|
||||
|
@ -16179,6 +16184,10 @@ void BfExprEvaluator::DoInvocation(BfAstNode* target, BfMethodBoundExpression* m
|
|||
// Silently allow
|
||||
gaveUnqualifiedDotError = true;
|
||||
}
|
||||
else if (expectingType->IsPrimitiveType())
|
||||
{
|
||||
// Allow
|
||||
}
|
||||
else
|
||||
{
|
||||
gaveUnqualifiedDotError = true;
|
||||
|
|
|
@ -7770,7 +7770,7 @@ bool BfModule::CheckGenericConstraints(const BfGenericParamSource& genericParamS
|
|||
{
|
||||
canAlloc = (checkGenericParamFlags & (BfGenericParamFlag_New | BfGenericParamFlag_Var)) != 0;
|
||||
}
|
||||
else
|
||||
else if (checkArgType->IsPrimitiveType())
|
||||
{
|
||||
// Any primitive types and stuff can be allocated
|
||||
canAlloc = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue