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-11446] Switch matches enum case with incorrect number (and spelling) of argument labels. #53847

Open
swift-ci opened this issue Sep 10, 2019 · 3 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-11446
Radar None
Original Reporter Lance (JIRA User)
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI
Assignee @CodaFi
Priority Medium

md5: 268975683901af37469c719a6fca7ccb

Issue Description:

Consider the following code:

enum Foo {    
    case bar(Int) 
}
let f = Foo.bar(42)
switch f { 
case .bar(hello:world:): // what's going on here?    
    break 
}

I would expect this to be a compiler error since the `bar` case only has one associated value, but in our pattern, we name two.

It's also a bit strange that no underscores or variable names are required.

@belkadan
Copy link
Contributor

Uh, yikes. Hopefully fixed by AndrewLitteken (JIRA User)'s work. cc also CodaFi (JIRA User)

@swift-ci
Copy link
Collaborator Author

Comment by Andrew Litteken (JIRA)

It looks like this case is covered by my pull request

@swift-ci
Copy link
Collaborator Author

Comment by Lance Parker (JIRA)

Cool!

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
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. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation
Projects
None yet
Development

No branches or pull requests

2 participants