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-12764] Pattern matching forces arbitrary label #55209

Closed
swift-ci opened this issue May 9, 2020 · 0 comments
Closed

[SR-12764] Pattern matching forces arbitrary label #55209

swift-ci opened this issue May 9, 2020 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented May 9, 2020

Previous ID SR-12764
Radar None
Original Reporter Lantua (JIRA User)
Type Bug
Status Resolved
Resolution Duplicate
Additional Detail from JIRA
Votes 0
Component/s
Labels Bug
Assignee None
Priority Medium

md5: a48f9b2e2556d2176b6f21b8b57eac60

blocks:

  • SR-12229 Assertion failure when trying to pattern match enum cases with same base name

Issue Description:

Given this enum:

enum Foo {
  case base(int: Int)
  case base(string: String)
}

Pattern matching with label only works with the last enum (with the same base name).

let a = Foo.base(int: 4)

if case let .base(string: value) = a { } // Ok

if case let .base(int: value) = a { } // Error: Tuple pattern element label 'int' must be 'string'
@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Projects
None yet
Development

No branches or pull requests

1 participant