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-5544] partially matched enum case with associated values shouldn't compile #48116

Open
weissi opened this issue Jul 24, 2017 · 3 comments
Open
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@weissi
Copy link
Member

weissi commented Jul 24, 2017

Previous ID SR-5544
Radar rdar://problem/33510102
Original Reporter @weissi
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 43a770196ba681962689953d1d4678fe

relates to:

Issue Description:

In the code below we partially match the .foo enum case as case .foo(bar: let x):, clearly the second associated value is missing but it still compiles.

public enum A {
    case foo(bar: String, buz: Int)
}

func f(_ a: A) {
    switch a {
        case .foo(bar: let x):
            print(x)
    }
}

f(.foo(bar: "hello world", buz: 42))

It just totally ignores the "bar:" bit and makes x be the tuple ("hello world", 42).

@belkadan
Copy link
Contributor

CodaFi (JIRA User), @jckarter, where are we with this? How does it figure in to SE-0155?

@weissi
Copy link
Member Author

weissi commented Jul 25, 2017

@swift-ci create

@CodaFi
Copy link
Member

CodaFi commented Jul 26, 2017

This is a regrettable "feature" I've had to work around. 0155 will reject this.

@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
Projects
None yet
Development

No branches or pull requests

3 participants