mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 03:52:19 +02:00
Fixed const expr canonicalization and negative value issues
This commit is contained in:
parent
e7f079f611
commit
fa7638621d
7 changed files with 53 additions and 22 deletions
|
@ -7986,7 +7986,7 @@ bool BfModule::CheckGenericConstraints(const BfGenericParamSource& genericParamS
|
|||
{
|
||||
if (BfIRConstHolder::IsInt(primType->mTypeDef->mTypeCode))
|
||||
{
|
||||
if (!mCompiler->mSystem->DoesLiteralFit(primType->mTypeDef->mTypeCode, constExprValueType->mValue.mUInt64))
|
||||
if (!mCompiler->mSystem->DoesLiteralFit(primType->mTypeDef->mTypeCode, constExprValueType->mValue))
|
||||
{
|
||||
if ((!ignoreErrors) && (PreFail()))
|
||||
*errorOut = Fail(StrFormat("Const generic argument '%s', declared with const '%lld', does not fit into const constraint '%s' for '%s'", genericParamInst->GetName().c_str(),
|
||||
|
@ -17051,7 +17051,10 @@ void BfModule::EmitCtorBody(bool& skipBody)
|
|||
mCompiler->mResolvePassData->mSourceClassifier->SetElementType(fieldDef->mInitializer, BfSourceElementType_Normal);
|
||||
mCompiler->mResolvePassData->mSourceClassifier->VisitChild(fieldDef->mInitializer);
|
||||
|
||||
auto wantType = ResolveTypeRef(fieldDef->mTypeRef, BfPopulateType_Declaration, BfResolveTypeRefFlag_AllowInferredSizedArray);
|
||||
BfType* wantType = NULL;
|
||||
if ((!BfNodeIsA<BfVarTypeReference>(fieldDef->mTypeRef)) &&
|
||||
(!BfNodeIsA<BfLetTypeReference>(fieldDef->mTypeRef)))
|
||||
wantType = ResolveTypeRef(fieldDef->mTypeRef, BfPopulateType_Declaration, BfResolveTypeRefFlag_AllowInferredSizedArray);
|
||||
if ((wantType != NULL) &&
|
||||
((wantType->IsVar()) || (wantType->IsLet()) || (wantType->IsRef())))
|
||||
wantType = NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue