Output: struct/class must be the first generic type constraint (CS0449)

This commit is contained in:
Katy Coe
2019-11-30 07:21:09 +01:00
parent 00135d2a15
commit a38b75c9c1

View File

@@ -865,10 +865,12 @@ namespace Il2CppInspector.Reflection {
var constraintList = typeConstraints.Where(c => c.FullName != "System.ValueType").Select(c => c.GetScopedCSharpName(scope)).ToList();
// struct or class must be the first constraint specified
if ((GenericParameterAttributes & GenericParameterAttributes.NotNullableValueTypeConstraint) == GenericParameterAttributes.NotNullableValueTypeConstraint)
constraintList.Add("struct");
constraintList.Insert(0, "struct");
if ((GenericParameterAttributes & GenericParameterAttributes.ReferenceTypeConstraint) == GenericParameterAttributes.ReferenceTypeConstraint)
constraintList.Add("class");
constraintList.Insert(0, "class");
if ((GenericParameterAttributes & GenericParameterAttributes.DefaultConstructorConstraint) == GenericParameterAttributes.DefaultConstructorConstraint
&& !constraintList.Contains("struct"))
// new() must be the last constraint specified