1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00
This commit is contained in:
Brian Fiete 2020-12-05 13:27:51 -08:00
parent b264d7e4cb
commit af53623536

View file

@ -1818,10 +1818,10 @@ BfLocalVariable* BfModule::HandleVariableDeclaration(BfVariableDeclaration* varD
{
exprEvaluator->mResult = BfTypedValue(mBfIRBuilder->CreateIsNotNull(initValue.mValue), boolType);
}
else if (!resolvedType->IsGenericParam())
else
{
// Always true
if (!IsInSpecializedSection())
if ((!IsInSpecializedSection()) && (!resolvedType->IsGenericParam()))
Warn(BfWarning_CS0472_ValueTypeNullCompare, StrFormat("Variable declaration is always 'true' since a value of type '%s' can never be null",
TypeToString(initValue.mType).c_str()), varDecl);
exprEvaluator->mResult = BfTypedValue(mBfIRBuilder->CreateConst(BfTypeCode_Boolean, 1), boolType);