Skip to content

[SR-9920] Compiler error when an empty "return" precedes an "@unknown default" case. #52326

@swift-ci

Description

@swift-ci
Previous ID SR-9920
Radar rdar://problem/48634159
Original Reporter pappy (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

Version 10.2 beta 2 (10P91b)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee @belkadan
Priority Medium

md5: b2a20da52a07f32a58733f33075263f5

is duplicated by:

  • SR-11014 Using a void return immediately before an @unknown default results in a compilation error

Issue Description:

Imagine enum is a non-exhaustive enum.

switch enum {

{{ case .blah: return}}

@unknown default: break

{{}}}

Results in an "expected expression in 'return' statement"

Adding a semicolon makes the error go away, but ew.

Metadata

Metadata

Assignees

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itself

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions