mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Allow null conditional on generic param without warning
This commit is contained in:
parent
7244150dae
commit
935d5bd340
1 changed files with 7 additions and 2 deletions
|
@ -21208,8 +21208,13 @@ BfTypedValue BfExprEvaluator::SetupNullConditional(BfTypedValue thisValue, BfTok
|
||||||
// Also good
|
// Also good
|
||||||
}
|
}
|
||||||
else
|
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;
|
return thisValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue