Skip to content
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

Enforce [NotNull] in method body only upon exit #42386

Closed
jcouv opened this issue Mar 13, 2020 · 1 comment · Fixed by #42827
Closed

Enforce [NotNull] in method body only upon exit #42386

jcouv opened this issue Mar 13, 2020 · 1 comment · Fixed by #42827
Assignees
Labels
4 - In Review A fix for the issue is submitted for review. Area-Compilers Feature - Nullable Reference Types Nullable Reference Types
Milestone

Comments

@jcouv
Copy link
Member

jcouv commented Mar 13, 2020

Currently, a parameter marked with [NotNull] cannot be assigned a maybe-null value (that's a W-warning), ie. we warn on assignment.
On the other hand, we only check parameters marked with [NotNullWhen(...)] when the method exits.

We could use the same method for [NotNull] (ie. only check upon exit).

Relates to #42348 (comment)

@jaredpar Let me know if you still think we should do this.

@jcouv jcouv added this to the 16.6 milestone Mar 26, 2020
@jcouv jcouv self-assigned this Mar 26, 2020
@jcouv
Copy link
Member Author

jcouv commented Mar 26, 2020

FYI @jaredpar @cston I'll go ahead and fix this. Received more feedback saying this is annoying...

@jcouv jcouv added the 4 - In Review A fix for the issue is submitted for review. label Mar 31, 2020
@jcouv jcouv modified the milestones: 16.6, 16.6.P3 Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 - In Review A fix for the issue is submitted for review. Area-Compilers Feature - Nullable Reference Types Nullable Reference Types
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant