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

Confirm whether misused nullability attributes should produce diagnostics #26783

Closed
jcouv opened this issue May 11, 2018 · 4 comments
Closed

Comments

@jcouv
Copy link
Member

jcouv commented May 11, 2018

For instance, [EnsureNotNull] on a value type parameter, or [NotNullWhenFalse] on a parameter whose containing method doesn't return a boolean.

We need to review this, as it poses a compatibility concern.
My personal view is that if we use brand new attributes in the System.Runtime.CompilerServices namespace, then such warnings/errors are fair game (users are not supposed to define types in System).

Tagging @gafter

@gafter
Copy link
Member

gafter commented May 11, 2018

@jcouv What is to prevent users from compiling code that misuses those attributes that we provide and compiling with an old, or C++ compiler?

@jcouv
Copy link
Member Author

jcouv commented May 11, 2018

@gafter Nothing. And if they do, the flow analysis for nullability will ignore such misused attributes.
Still, I believe we should help users use those new attributes properly.

@jcouv jcouv changed the title Confirm whether misused nullability attributes should produce warnings Confirm whether misused nullability attributes should produce diagnostics May 11, 2018
@gafter
Copy link
Member

gafter commented May 11, 2018

But then the same code will not compile with new compilers - a breaking change.

@jcouv
Copy link
Member Author

jcouv commented Nov 2, 2018

Closing due to Neal's point about breaking change.

@jcouv jcouv closed this as completed Nov 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants