Skip to content

Clarify that a switch expression may have no type#1734

Merged
jskeet merged 4 commits into
dotnet:draft-v8from
jskeet:issue-1651
Jul 22, 2026
Merged

Clarify that a switch expression may have no type#1734
jskeet merged 4 commits into
dotnet:draft-v8from
jskeet:issue-1651

Conversation

@jskeet

@jskeet jskeet commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Fixes #1651.

I don't think we need to talk about "if a switch expression is not subject to..." - we just say that the expression has no type, but can be converted to some types, and let the rest of the language rules handle it.

We may want to add examples, e.g.:

  • A switch expression with a type being used to initialize a var variable
  • A switch expression without a type being used to initialize an explicitly-typed variable
  • A switch expression without a type failing to be used to initialize a var variable

I don't know whether those examples are really needed though.

@Nigel-Ecma Nigel-Ecma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this approach fits into the existing approach to ”no type”.

I would probably myself drop lines 3882-3 as they just repeat what is said in the xref and instead add the xref to line 3885 – more succinct, but that is subjective!

@jskeet

jskeet commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

I would probably myself drop lines 3882-3 as they just repeat what is said in the xref and instead add the xref to line 3885 – more succinct, but that is subjective!

Makes sense - have done that in another commit (as well as reverting an accidental incomplete change for a different issue).

@jskeet jskeet added the meeting: discuss This issue should be discussed at the next TC49-TG2 meeting label Jul 22, 2026
Comment thread standard/expressions.md
Co-authored-by: Bill Wagner <wiwagn@microsoft.com>

@BillWagner BillWagner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM as well.

@jskeet
jskeet merged commit c7bcce0 into dotnet:draft-v8 Jul 22, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

meeting: discuss This issue should be discussed at the next TC49-TG2 meeting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Determine whether the specification describes target-typed switch expressions

3 participants