1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 19:48:20 +02:00

Fixed a const int casting issue

This commit is contained in:
Brian Fiete 2020-04-30 10:25:06 -07:00
parent e6cd90ac49
commit eab378c016

View file

@ -6648,14 +6648,6 @@ BfTypedValue BfModule::TryLookupGenericConstVaue(BfIdentifierNode* identifierNod
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;
result.mType = genericParamResult;
result.mKind = BfTypedValueKind_GenericConstValue;
@ -8828,7 +8820,9 @@ BfIRValue BfModule::CastToValue(BfAstNode* srcNode, BfTypedValue typedVal, BfTyp
auto undefConst = (BfConstantUndef*)constant;
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)
return val;
}