-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
Area-IDEConcept-Continuous ImprovementFeature - Nullable Reference TypesNullable Reference TypesNullable Reference TypesIDE-IntelliSenseCompletion, Signature Help, Quick InfoCompletion, Signature Help, Quick Infohelp wantedThe issue is "up for grabs" - add a comment if you are interested in working on itThe issue is "up for grabs" - add a comment if you are interested in working on it
Milestone
Description
Version Used: VS 16.6 preview 1
Steps to Reproduce:
In VS copy the following:
#nullable enable
public class C
{
string M()
{
var str = "hello";
return str;
}
}Hover over str in return str.
You get the following popup:
Hover over str in var str = "hello";
You get the following popup:
Note it doesn't mention the null flow state, only the null-type of the variable.
I found this extremely confusing since str is very clearly not null. I wasted a few minutes trying to find out if the method I was calling returned null, before I realized it was because var is always inferred as nullable.
I think this would be less confusing if the null flow state was also shown in declaration so it would say:
(local variable) string? str
str is not null here"
jnm2, xparadoxical and svick
Metadata
Metadata
Assignees
Labels
Area-IDEConcept-Continuous ImprovementFeature - Nullable Reference TypesNullable Reference TypesNullable Reference TypesIDE-IntelliSenseCompletion, Signature Help, Quick InfoCompletion, Signature Help, Quick Infohelp wantedThe issue is "up for grabs" - add a comment if you are interested in working on itThe issue is "up for grabs" - add a comment if you are interested in working on it
Type
Projects
Status
Complete
Status
Completed

