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

Quick Info for "var" should show the flow state of the initializer #41245

Open
jasonmalinowski opened this issue Jan 27, 2020 · 3 comments
Open
Assignees
Milestone

Comments

@jasonmalinowski
Copy link
Member

With "var" being changed to always infer a nullable type for assignment purposes, it can now be surprising that the right hand side of an initializer and the 'var' no longer match in type. If you mouse over the variable name, you see both: the type and the statement that the flow state is or isn't null. If you mouse directly over var...you don't get that. We should update var accordingly with text similar to "The initial value is not null" and "The initial value may be null" similar to what we show when you mouse over the variable name.

(The suggested text is stolen from @sharwell's comment in #41008)

@peabnuts123
Copy link

What exactly is the magnitude of change needed here? Does C# the language need changing here? The way its compiled? Just the way it is analysed? I have found my way here after following various issues and IMO this is wildly confusing. I just thought this was a bug in vscode. Will this ever see the light of day?

@CyrusNajmabadi
Copy link
Member

@peabnuts123 it just needs someone willing to do the work. If you're interested, we'd welcome a contribution. Thanks!

@ryzngard
Copy link
Contributor

Yea, I'm happy to walk you through the thought I had for a fix. Early on there was some changes into how nullability worked with var, and design was still in flux. I think it's very stable now so this would be a good issue to take on

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
IDE Nullability Work
  
Backlog (Bugs)
Development

No branches or pull requests

6 participants