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

Dropping nullability of struct field of unconstrained type #32338

Closed
cston opened this issue Jan 10, 2019 · 0 comments
Closed

Dropping nullability of struct field of unconstrained type #32338

cston opened this issue Jan 10, 2019 · 0 comments
Assignees

Comments

@cston
Copy link
Member

cston commented Jan 10, 2019

No warning should be reported for t.F.ToString():

#pragma warning disable 649

struct S<T>
{
    internal T F;
}

class Program
{
    static void M<T>(S<T> s)
    {
        if (s.F == null) return;
        var t = s;
        t.F.ToString(); // warning: maybe null
    }
}
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

1 participant