Skip to content

Add support for unconstrained type parameter annotations #1326

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: draft-v9
Choose a base branch
from

Conversation

RexJaeschke
Copy link
Contributor

I think the following text might be affected by this PR (however, I have not included any changes to it in this initial Draft PR.)

15.2.5 Type parameter constraints

The class type, reference type constraint, and secondary constraints can include the nullable type annotation. The presence or absence of this annotation on the type parameter indicates the nullability expectations for the type argument:

  • If the constraint does not include the nullable type annotation, the type argument is expected to be a non-nullable reference type. A compiler may issue a warning if the type argument is a nullable reference type.
  • If the constraint includes the nullable type annotation, the constraint is satisfied by both a non-nullable reference type and a nullable reference type.

@RexJaeschke RexJaeschke added this to the C# 9.0 milestone May 9, 2025
@RexJaeschke RexJaeschke added the type: feature This issue describes a new feature label May 9, 2025
@RexJaeschke RexJaeschke marked this pull request as draft May 9, 2025 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature This issue describes a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant