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

Closed
gafter opened this issue Oct 3, 2019 · 3 comments
Closed

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

gafter opened this issue Oct 3, 2019 · 3 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

@333fred
Copy link
Member

333fred commented Dec 7, 2024

Closing this out, it is tracked by #2632. If we decide to move forward with the proposal, we can check the spec in at that point.

@333fred 333fred closed this as not planned Won't fix, can't repro, duplicate, stale Dec 7, 2024
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