mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Allow primitive constraints, fix false error on extension attributes
This commit is contained in:
parent
fb86a8d5e3
commit
f46f49f1db
1 changed files with 2 additions and 10 deletions
|
@ -8269,11 +8269,6 @@ void BfModule::ResolveGenericParamConstraints(BfGenericParamInstance* genericPar
|
||||||
}
|
}
|
||||||
else if (constraintType->IsPrimitiveType())
|
else if (constraintType->IsPrimitiveType())
|
||||||
{
|
{
|
||||||
if (isUnspecialized)
|
|
||||||
{
|
|
||||||
Fail("Primitive constraints are not allowed unless preceded with 'const'", constraintTypeRef);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
checkEquality = true;
|
checkEquality = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8293,11 +8288,6 @@ void BfModule::ResolveGenericParamConstraints(BfGenericParamInstance* genericPar
|
||||||
}
|
}
|
||||||
else if ((!constraintType->IsTypeInstance()) && (!constraintType->IsSizedArray()))
|
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;
|
checkEquality = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12631,6 +12621,8 @@ BfCustomAttributes* BfModule::GetCustomAttributes(BfTypeDef* typeDef)
|
||||||
attrTarget = BfAttributeTargets_Interface;
|
attrTarget = BfAttributeTargets_Interface;
|
||||||
else if (typeDef->mTypeCode == BfTypeCode_Struct)
|
else if (typeDef->mTypeCode == BfTypeCode_Struct)
|
||||||
attrTarget = BfAttributeTargets_Struct;
|
attrTarget = BfAttributeTargets_Struct;
|
||||||
|
else if (typeDef->mTypeCode == BfTypeCode_Extension)
|
||||||
|
attrTarget = (BfAttributeTargets)(BfAttributeTargets_Struct | BfAttributeTargets_Class | BfAttributeTargets_Interface | BfAttributeTargets_Enum);
|
||||||
else
|
else
|
||||||
attrTarget = BfAttributeTargets_Class;
|
attrTarget = BfAttributeTargets_Class;
|
||||||
return GetCustomAttributes(typeDef->mTypeDeclaration->mAttributes, attrTarget);
|
return GetCustomAttributes(typeDef->mTypeDeclaration->mAttributes, attrTarget);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue