1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Allow primitive constraints, fix false error on extension attributes

This commit is contained in:
Brian Fiete 2024-03-23 12:27:17 -04:00
parent fb86a8d5e3
commit f46f49f1db

View file

@ -8269,11 +8269,6 @@ void BfModule::ResolveGenericParamConstraints(BfGenericParamInstance* genericPar
}
else if (constraintType->IsPrimitiveType())
{
if (isUnspecialized)
{
Fail("Primitive constraints are not allowed unless preceded with 'const'", constraintTypeRef);
continue;
}
checkEquality = true;
}
@ -8293,11 +8288,6 @@ void BfModule::ResolveGenericParamConstraints(BfGenericParamInstance* genericPar
}
else if ((!constraintType->IsTypeInstance()) && (!constraintType->IsSizedArray()))
{
if (isUnspecialized)
{
Fail(StrFormat("Type '%s' is not allowed as a generic constraint", TypeToString(constraintType).c_str()), constraintTypeRef);
continue;
}
checkEquality = true;
}
@ -12631,6 +12621,8 @@ BfCustomAttributes* BfModule::GetCustomAttributes(BfTypeDef* typeDef)
attrTarget = BfAttributeTargets_Interface;
else if (typeDef->mTypeCode == BfTypeCode_Struct)
attrTarget = BfAttributeTargets_Struct;
else if (typeDef->mTypeCode == BfTypeCode_Extension)
attrTarget = (BfAttributeTargets)(BfAttributeTargets_Struct | BfAttributeTargets_Class | BfAttributeTargets_Interface | BfAttributeTargets_Enum);
else
attrTarget = BfAttributeTargets_Class;
return GetCustomAttributes(typeDef->mTypeDeclaration->mAttributes, attrTarget);