mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 03:52:19 +02:00
Fixed inferred-type primitive ctor invocation
This commit is contained in:
parent
52c5e47575
commit
3ec68ee1e0
1 changed files with 23 additions and 1 deletions
|
@ -8151,7 +8151,29 @@ BfTypedValue BfExprEvaluator::MatchMethod(BfAstNode* targetSrc, BfMethodBoundExp
|
||||||
if (targetType->IsWrappableType())
|
if (targetType->IsWrappableType())
|
||||||
{
|
{
|
||||||
if ((targetType->IsPrimitiveType()) && (methodName.IsEmpty()))
|
if ((targetType->IsPrimitiveType()) && (methodName.IsEmpty()))
|
||||||
|
{
|
||||||
|
if (argValues.mArguments->IsEmpty())
|
||||||
|
{
|
||||||
return mModule->GetDefaultTypedValue(targetType);
|
return mModule->GetDefaultTypedValue(targetType);
|
||||||
|
}
|
||||||
|
else if (argValues.mArguments->mSize == 1)
|
||||||
|
{
|
||||||
|
FinishDeferredEvals(argValues);
|
||||||
|
|
||||||
|
// This is just a primitive cast
|
||||||
|
auto& resolvedArg = argValues.mResolvedArgs[0];
|
||||||
|
BfTypedValue castedValue;
|
||||||
|
BfTypedValue castTarget = resolvedArg.mTypedValue;
|
||||||
|
if (resolvedArg.mTypedValue)
|
||||||
|
{
|
||||||
|
castTarget = mModule->LoadValue(castTarget);
|
||||||
|
castedValue = mModule->Cast(targetSrc, castTarget, targetType, BfCastFlags_Explicit);
|
||||||
|
}
|
||||||
|
if (!castedValue)
|
||||||
|
castedValue = mModule->GetDefaultTypedValue(targetType);
|
||||||
|
return castedValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
targetTypeInst = mModule->GetWrappedStructType(targetType);
|
targetTypeInst = mModule->GetWrappedStructType(targetType);
|
||||||
}
|
}
|
||||||
else if (targetType->IsGenericParam())
|
else if (targetType->IsGenericParam())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue