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

Add flag to control nullable feature #26692

Closed
jcouv opened this issue May 7, 2018 · 3 comments
Closed

Add flag to control nullable feature #26692

jcouv opened this issue May 7, 2018 · 3 comments

Comments

@jcouv
Copy link
Member

jcouv commented May 7, 2018

For the prototype, we're using LangVersion as the flag for both language version and nullable annotations.
At a minimum, we need an ability (separate from LangVersion) to disable nullable warnings.

From discussions with Chuck, we would have to decide whether this flag affects the symbols that we produce:

  • pretty clearly, we would want to emit string (no nullable annotations)
  • you type string? in source (with nullable warnings disabled), does QuickInfo show you string? back?
  • maybe the IDE should grey out any ?, since it is unnecessary. We can have a code fixer to remove the ? or to turn on nullable warnings.

Some related questions, when the feature is turned off:

  • What if you use [NonNullTypes] but the nullable feature is turned off? Warning?
  • What about using ? or !?

Tagging @cston @AlekseyTs

Relates to #26199

@jcouv jcouv added this to the 16.0 milestone May 7, 2018
@jcouv jcouv changed the title Add flag to control nullable annotations Add flag to control nullable feature May 7, 2018
@AlekseyTs
Copy link
Contributor

I don't think LanguageVersion should affect "shape" of symbols. Otherwise, sharing of symbols is going to be affected in a negative way, as well as this is likely to complicate the Reference manager and make it dependent on ParserOptions, which never happened before.

@jcouv
Copy link
Member Author

jcouv commented Jul 11, 2018

From LDM discussion today:

  • we'll use a separate flag (not warning waves) to control the feature
  • the flag implicitly changes top-level NonNullTypes context to be true
  • the flag enables the flow analysis warnings
  • if you use any nullability-related feature (!, ? or [NonNullTypes]) and the flag isn't set, then we produce a new warning ("please enable the feature")

@cston cston closed this as completed Jul 23, 2018
@cston
Copy link
Member

cston commented Jul 23, 2018

Updated LDM decision to use [NonNullTypes] to enable warnings.

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

3 participants