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

null default value for non-nullable parameter should warn #26626

Closed
jcouv opened this issue May 4, 2018 · 1 comment
Closed

null default value for non-nullable parameter should warn #26626

jcouv opened this issue May 4, 2018 · 1 comment
Assignees
Milestone

Comments

@jcouv
Copy link
Member

jcouv commented May 4, 2018

Example

public class C 
{
    public void M(string x = null) 
    {
    }
}

For comparison, a local declaration does warn:

public class C 
{
    public void M() 
    {
        string x = null; // warning CS8600: Converting null literal or possible null value to non-nullable type.
    }
}

Found in nullable dogfood.
Tagging @cston

Note: there are some IDE tests (in CSharpDeclareAsNullableCodeFixTests) for this bug, which should be unskipped.

@jcouv jcouv added this to the 16.0 milestone May 4, 2018
@cston cston self-assigned this May 4, 2018
@cston cston closed this as completed May 10, 2018
@jcouv jcouv added the Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented label May 11, 2018
@cston cston reopened this Aug 30, 2018
@jcouv jcouv removed the Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented label Aug 30, 2018
@jaredpar jaredpar added the Bug label Aug 30, 2018
@jcouv
Copy link
Member Author

jcouv commented Sep 17, 2018

Verified this was fixed.
sharplab

@jcouv jcouv closed this as completed Sep 17, 2018
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

3 participants