Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Zastai
Copy link
Contributor

@Zastai Zastai commented Aug 17, 2024

This adds a new AllowsByRefLike flag to GenericParameterAttributes which, unlike the others, is an anti-constraint (i.e. it removes restrictions rather than adding them) added in C# 13. Because of this, AllowsByRefLike was chosen as the corresponding bool property on GenericParameter (instead of
HasAllowByRefLineConstraint; the constant also does not include Constraint in its name).

At the same time, it adds the NoSpecialConstraint flag and a corresponding HasNoSpecialConstraint property.

Reference: corresponding constants in the CLR code: https://github.com/dotnet/runtime/blob/9daa4b41eb9f157e79eaf05e2f7451c9c8f6dbdc/src/coreclr/inc/corhdr.h#L850

This adds a new `AllowsByRefLike` flag to `GenericParameterAttributes`
which, unlike the others, is an anti-constraint (i.e. it removes
restrictions rather than adding them) added in C# 13.
Because of this, `AllowsByRefLike` was chosen as the corresponding bool
property on `GenericParameter` (instead of
`HasAllowByRefLineConstraint`; the constant also does not include
`Constraint` in its name).

At the same time, it adds the `NoSpecialConstraint` flag and a
corresponding `HasNoSpecialConstraint` property.
@Zastai
Copy link
Contributor Author

Zastai commented Aug 17, 2024

Hmm, looks like it's already there; could have sworn I updated my fork.

@Zastai
Copy link
Contributor Author

Zastai commented Aug 17, 2024

Right, still keeping this PR because:

  • it updates SpecialConstraintMask to include the new flag
  • I kept the enum constant name in like with the CLR/COR header (no Constraint at the end, because it's not a constraint)
  • the property name lacked the Has (needed because the Allow referred only to the ByRefLike, not the Constraint
    • I'm still keeping AllowsByRefLike for now, because it reads better than HasAllowByRefLike
      • but I'm open to changing it to the latter for consistency with the other property names
  • it also adds the NoSpecialConstraint flag and property, to better match the whole of the CLR/COR version of the attributes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant