1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Allow null conditional on generic param without warning

This commit is contained in:
Brian Fiete 2022-07-10 16:58:34 -04:00
parent 7244150dae
commit 935d5bd340

View file

@ -21208,8 +21208,13 @@ BfTypedValue BfExprEvaluator::SetupNullConditional(BfTypedValue thisValue, BfTok
// Also good
}
else
{
mModule->Warn(0, StrFormat("Null conditional reference is unnecessary since value type '%s' can never be null", mModule->TypeToString(thisValue.mType).c_str()), dotToken);
{
bool canBeNull = false;
if (thisValue.mType->IsGenericParam())
canBeNull = true;
if (!canBeNull)
mModule->Warn(0, StrFormat("Null conditional reference is unnecessary since value type '%s' can never be null", mModule->TypeToString(thisValue.mType).c_str()), dotToken);
return thisValue;
}