mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Fixed a const int casting issue
This commit is contained in:
parent
e6cd90ac49
commit
eab378c016
1 changed files with 3 additions and 9 deletions
|
@ -6648,14 +6648,6 @@ BfTypedValue BfModule::TryLookupGenericConstVaue(BfIdentifierNode* identifierNod
|
||||||
|
|
||||||
if ((genericParamDef->mGenericParamFlags & BfGenericParamFlag_Const) != 0)
|
if ((genericParamDef->mGenericParamFlags & BfGenericParamFlag_Const) != 0)
|
||||||
{
|
{
|
||||||
if ((genericTypeConstraint != NULL) && (expectingType != NULL))
|
|
||||||
{
|
|
||||||
if (!CanCast(BfTypedValue(mBfIRBuilder->GetFakeVal(), genericTypeConstraint), expectingType))
|
|
||||||
{
|
|
||||||
Fail(StrFormat("Generic constraint '%s' is not convertible to 'int'", TypeToString(genericTypeConstraint).c_str()), identifierNode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BfTypedValue result;
|
BfTypedValue result;
|
||||||
result.mType = genericParamResult;
|
result.mType = genericParamResult;
|
||||||
result.mKind = BfTypedValueKind_GenericConstValue;
|
result.mKind = BfTypedValueKind_GenericConstValue;
|
||||||
|
@ -8828,7 +8820,9 @@ BfIRValue BfModule::CastToValue(BfAstNode* srcNode, BfTypedValue typedVal, BfTyp
|
||||||
auto undefConst = (BfConstantUndef*)constant;
|
auto undefConst = (BfConstantUndef*)constant;
|
||||||
|
|
||||||
auto fakeVal = GetFakeTypedValue(GetPrimitiveType(undefConst->mTypeCode));
|
auto fakeVal = GetFakeTypedValue(GetPrimitiveType(undefConst->mTypeCode));
|
||||||
auto val = CastToValue(srcNode, fakeVal, toType, (BfCastFlags)(castFlags | BfCastFlags_Explicit));
|
// Why did we have this BfCastFlags_Explicit? It broke creating errors on things like "int16 val = TCount;"
|
||||||
|
//auto val = CastToValue(srcNode, fakeVal, toType, (BfCastFlags)(castFlags | BfCastFlags_Explicit));
|
||||||
|
auto val = CastToValue(srcNode, fakeVal, toType, castFlags);
|
||||||
if (val)
|
if (val)
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue