1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 03:52:19 +02:00

Added some warnings for nullable(T) usage

This commit is contained in:
Brian Fiete 2020-04-28 07:30:10 -07:00
parent da29d695dd
commit 4b2256d41e

View file

@ -7228,11 +7228,22 @@ BfType* BfModule::ResolveTypeRef(BfTypeReference* typeRef, BfPopulateType popula
typeVec.push_back(resolvedType);
resolvedType = ResolveTypeDef(mCompiler->mNullableTypeDef, typeVec, BfPopulateType_Declaration);
}
else if ((resolvedType != NULL) && (resolvedType->IsValueType()))
{
BfTypeVector typeVec;
typeVec.push_back(resolvedType);
resolvedType = ResolveTypeDef(mCompiler->mNullableTypeDef, typeVec, BfPopulateType_Declaration);
else if (resolvedType != NULL)
{
if (resolvedType->IsValueType())
{
if (InDefinitionSection())
Warn(0, StrFormat("Consider using '%s?' instead of nullable modifier", TypeToString(resolvedType).c_str()), retTypeTypeRef);
BfTypeVector typeVec;
typeVec.push_back(resolvedType);
resolvedType = ResolveTypeDef(mCompiler->mNullableTypeDef, typeVec, BfPopulateType_Declaration);
}
else
{
if (InDefinitionSection())
Warn(0, StrFormat("Unneeded nullable modifier, %s is already nullable", TypeToString(resolvedType).c_str()), retTypeTypeRef->mRetTypeToken);
}
}
if (resolvedType != NULL)
PopulateType(resolvedType, populateType);