C#13: Add the "allow byref-like" anti-constraint #957
Loading…
Reference in a new issue
No description provided.
Delete branch "Zastai/add-allows-ref-struct-constraint"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This adds a new
AllowsByRefLikeflag toGenericParameterAttributeswhich, unlike the others, is an anti-constraint (i.e. it removes restrictions rather than adding them) added in C# 13. Because of this,AllowsByRefLikewas chosen as the corresponding bool property onGenericParameter(instead ofHasAllowByRefLineConstraint; the constant also does not includeConstraintin its name).At the same time, it adds the
NoSpecialConstraintflag and a correspondingHasNoSpecialConstraintproperty.Reference: corresponding constants in the CLR code:
github.com/dotnet/runtime@9daa4b41eb/src/coreclr/inc/corhdr.h (L850)Hmm, looks like it's already there; could have sworn I updated my fork.
Right, still keeping this PR because:
SpecialConstraintMaskto include the new flagConstraintat the end, because it's not a constraint)Has(needed because theAllowreferred only to theByRefLike, not theConstraintAllowsByRefLikefor now, because it reads better thanHasAllowByRefLikeNoSpecialConstraintflag and property, to better match the whole of the CLR/COR version of the attributesView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.