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

out var treated as non-nullable #25347

Closed
cston opened this issue Mar 8, 2018 · 3 comments
Closed

out var treated as non-nullable #25347

cston opened this issue Mar 8, 2018 · 3 comments
Assignees
Labels
Area-Compilers Feature - Nullable Reference Types Nullable Reference Types Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented
Milestone

Comments

@cston
Copy link
Member

cston commented Mar 8, 2018

out var is treated as non-nullable, regardless of parameter declaration.

class C
{
    static void TryGet(out string? s)
    {
        s = null;
    }
    static void Main()
    {
        TryGet(out var s); // string with null assignment warning
        int n = s.Length;  // no warning
    }
}
@cston
Copy link
Member Author

cston commented Mar 8, 2018

cc @NickCraver

@jcouv jcouv added this to the 16.0 milestone Mar 29, 2018
@jcouv jcouv self-assigned this May 11, 2018
@jcouv
Copy link
Member

jcouv commented May 11, 2018

I'll take this one as part of the TryGetValue scenario with [NotNullWhenTrue] attribute.

@jcouv jcouv modified the milestones: 16.0, 15.8 May 11, 2018
@jcouv jcouv added the 4 - In Review A fix for the issue is submitted for review. label May 16, 2018
@jcouv jcouv modified the milestones: 15.8, 16.0 May 16, 2018
@jcouv
Copy link
Member

jcouv commented Jul 26, 2018

Confirmed this was fixed. Closing

@jcouv jcouv closed this as completed Jul 26, 2018
@jcouv jcouv added Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented and removed 4 - In Review A fix for the issue is submitted for review. labels Jul 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Feature - Nullable Reference Types Nullable Reference Types Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented
Projects
None yet
Development

No branches or pull requests

2 participants