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

Support proposed "type pattern" in switch #10941

Closed
gafter opened this issue Apr 28, 2016 · 4 comments
Closed

Support proposed "type pattern" in switch #10941

gafter opened this issue Apr 28, 2016 · 4 comments
Assignees
Labels
Area-Compilers Feature Request Language-C# New Language Feature - Pattern Matching Pattern Matching Resolution-Won't Fix A real bug, but Triage feels that the issue is not impactful enough to spend time on.

Comments

@gafter
Copy link
Member

gafter commented Apr 28, 2016

LDM proposed to support case int and case int[], case System.Int32 etc. The latter must be parsed as a constant expression (for compatibility) but bound as a type.

@alrz
Copy link
Contributor

alrz commented Apr 28, 2016

Is this only applicable to switch statement? What about o is T(X: U) or o is T { X: U }? Any plans to support OR patterns in 3.0 at least? One nice thing that this would allow is o is T or U which I'd greatly appreciate!

@gafter
Copy link
Member Author

gafter commented Apr 28, 2016

@alrz This issue is about C# 7.

@alrz
Copy link
Contributor

alrz commented Apr 28, 2016

Oh right, forgot about scissors for a moment. would love to see this anyways.

@gafter
Copy link
Member Author

gafter commented Jun 26, 2016

The current position is that a type pattern requires an identifier. This removes some nasty ambiguities. We can look at relaxing it later.

@gafter gafter closed this as completed Jun 26, 2016
@gafter gafter added the Resolution-Won't Fix A real bug, but Triage feels that the issue is not impactful enough to spend time on. label Jun 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Feature Request Language-C# New Language Feature - Pattern Matching Pattern Matching Resolution-Won't Fix A real bug, but Triage feels that the issue is not impactful enough to spend time on.
Projects
None yet
Development

No branches or pull requests

3 participants