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

Switch on enum type nested in generic type produces LangVersion error #34905

Closed
RikkiGibson opened this issue Apr 10, 2019 · 0 comments
Closed
Assignees
Labels
4 - In Review A fix for the issue is submitted for review. Area-Compilers Bug Regression Tenet-Compatibility Violation of forwards/backwards compatibility in a design-time piece.
Milestone

Comments

@RikkiGibson
Copy link
Contributor

RikkiGibson commented Apr 10, 2019

I think this is related to #34678.

Version Used:
master as of April 9 (commit 43f2329)

Steps to Reproduce:

  1. Create a project using non-preview LangVersion
  2. Write the following code
public class C<T>
{
    public enum E
    {
        V1, V2
    }

    public void M()
    {
        switch(default(E))
        {
            case E.V1: // error CS8511
            break;
        }
    }
}

Expected Behavior:
Builds successfully (as it does in dev15.9)

Actual Behavior:

CS8511	An expression of type 'C<T>.E' cannot be handled by a pattern of type 'C<T>.E'. Please use language version 'preview' or greater to match an open type with a constant pattern.
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 - In Review A fix for the issue is submitted for review. Area-Compilers Bug Regression Tenet-Compatibility Violation of forwards/backwards compatibility in a design-time piece.
Projects
None yet
Development

No branches or pull requests

2 participants