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

! should suppress conversion warnings #30376

Closed
cston opened this issue Oct 8, 2018 · 2 comments
Closed

! should suppress conversion warnings #30376

cston opened this issue Oct 8, 2018 · 2 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 Oct 8, 2018

using System.Runtime.CompilerServices;
[module: NonNullTypes]
class A { }
class B<T> { }
class C
{
    static void F(B<A?> x, B<A> y, B<A>? z)
    {
        var a = new[] { x, y! }; // warning
        var w = z ?? x!; // warning
    }
}
(9,28): warning CS8619: Nullability of reference types in value of type 'B<A>'
    doesn't match target type 'B<A?>'.
(10,22): warning CS8619: Nullability of reference types in value of type 'B<A?>'
    doesn't match target type 'B<A>'.
@jcouv
Copy link
Member

jcouv commented Oct 8, 2018

Relates to #29642 (! operator should suppress warning for nested nullability mismatch)

@jcouv
Copy link
Member

jcouv commented Jan 7, 2019

Removing the language-design label, as I think the language question is answered: yes, the ! should suppress those conversion warnings.

@jaredpar jaredpar added this to the 16.1.P1 milestone Jan 27, 2019
@jcouv jcouv added 4 - In Review A fix for the issue is submitted for review. and removed 3 - Working Area-Language Design labels Jan 30, 2019
@sharwell sharwell 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 Feb 1, 2019
@sharwell sharwell modified the milestones: 16.1.P1, 16.0.P4 Feb 1, 2019
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

4 participants