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 not permit default literals in relational patterns #45292

Closed
alrz opened this issue Jun 18, 2020 · 1 comment · Fixed by #45375
Closed

Should not permit default literals in relational patterns #45292

alrz opened this issue Jun 18, 2020 · 1 comment · Fixed by #45375
Assignees
Milestone

Comments

@alrz
Copy link
Member

alrz commented Jun 18, 2020

Version Used: master

Steps to Reproduce:

    public void M(byte i) {
        _ = i is > default; // compiles
        _ = i is default; // error
    } 

Expected Behavior:

A default literal 'default' is not valid as a pattern. Use another literal (e.g. '0' or 'null') as appropriate. To match everything, use a discard pattern '_'

Actual Behavior: No error

@jaredpar
Copy link
Member

@gafter can u take a look at this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants