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

Add code fix to replace default literal when used in C# 7.0 or lower #30909

Closed
Neme12 opened this issue Nov 1, 2018 · 1 comment
Closed

Add code fix to replace default literal when used in C# 7.0 or lower #30909

Neme12 opened this issue Nov 1, 2018 · 1 comment

Comments

@Neme12
Copy link
Contributor

Neme12 commented Nov 1, 2018

To fix the following error and corresponding errors for other language versions:

class C
{
    void M()
    {
        int i = default; // error CS8107: Feature 'default literal' is not available in C# 7.0. Please use language version 7.1 or greater.
    }
}

It should replace the default literal with another literal, a default expression or a special member access, abiding by the same design as #30360 (comment)

The easiest implementation of this would be to add the new supported error messages to the existing code fix, implemented in #30430. That can only be done after this compiler bug is fixed: #30384.

For future reference, this was partially implemented (just for generating default expressions) in #30359.

@CyrusNajmabadi
Copy link
Member

Closing out. It's not a goal to have features that are basically there only for converting to old-style constructs.

@CyrusNajmabadi CyrusNajmabadi closed this as not planned Won't fix, can't repro, duplicate, stale Oct 31, 2022
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