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

[SR-12381] Enum pattern matching in return statements #54817

Closed
swift-ci opened this issue Mar 19, 2020 · 4 comments
Closed

[SR-12381] Enum pattern matching in return statements #54817

swift-ci opened this issue Mar 19, 2020 · 4 comments
Labels
compiler The Swift compiler in itself duplicate Resolution: Duplicates another issue expressions Feature: expressions feature A feature request or implementation pattern matching Feature: pattern matching swift evolution proposal needed Flag → feature: A feature that warrants a Swift evolution proposal

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Mar 19, 2020

Previous ID SR-12381
Radar rdar://problem/60832839
Original Reporter andrewjmeier (JIRA User)
Type New Feature
Status Resolved
Resolution Duplicate
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels New Feature
Assignee None
Priority Medium

md5: 69cc01716679da7d91cfaa3a3aa5b829

duplicates:

  • SR-4644 Create an expression for checking enum cases

Issue Description:

It would be nice to be able to use pattern matching within return statements so that this code could be simplified.

if case .car = vehicle {
  return true
} else {
  return false
}

vs

return case .car = vehicle
@CodaFi
Copy link
Member

CodaFi commented Mar 24, 2020

Have you pitched this idea to swift evolution?

@beccadax
Copy link
Contributor

@swift-ci create

@swift-ci
Copy link
Collaborator Author

Comment by Andrew Meier (JIRA)

I haven’t

@rjmccall
Copy link
Member

rjmccall commented Apr 1, 2020

The request here is for a language feature for testing whether an enum is in a particular case. That's #47221.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added duplicate Resolution: Duplicates another issue feature A feature request or implementation parser Area → compiler: The legacy C++ parser type checker Area → compiler: Semantic analysis swift evolution proposal needed Flag → feature: A feature that warrants a Swift evolution proposal pattern matching Feature: pattern matching expressions Feature: expressions and removed new feature parser Area → compiler: The legacy C++ parser type checker Area → compiler: Semantic analysis labels Feb 25, 2023
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler The Swift compiler in itself duplicate Resolution: Duplicates another issue expressions Feature: expressions feature A feature request or implementation pattern matching Feature: pattern matching swift evolution proposal needed Flag → feature: A feature that warrants a Swift evolution proposal
Projects
None yet
Development

No branches or pull requests

5 participants