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

Draft Spec for Switch Expression as a Statement Expression in C# 9.0 #2860

Open
gafter opened this issue Oct 3, 2019 · 2 comments
Open

Draft Spec for Switch Expression as a Statement Expression in C# 9.0 #2860

gafter opened this issue Oct 3, 2019 · 2 comments
Assignees

Comments

@gafter
Copy link
Member

gafter commented Oct 3, 2019

We add the switch expression to the set of syntactic forms permitted in an expression_statement:

expression_statement
    : statement_expression ';'
    ;

statement_expression
    : switch_expression
    // in addition to all the other forms specified elsewhere
    ;

When a switch expression is used as a statement_expression,

  • the expression of each arm of the switch expression is required to be a statement_expression or a throw_expression; and
  • the switch expression is not required to have a type.
@gafter gafter self-assigned this Oct 3, 2019
@gafter
Copy link
Member Author

gafter commented Oct 3, 2019

This is a draft spec for #2632

@mrlife
Copy link

mrlife commented Dec 15, 2022

Is this still planned and does it provide support for this?

https://dotnetfiddle.net/E2mrrC

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

2 participants