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-8125] Swift 4.2 exhaustivity checker regression #50657

Closed
sharplet opened this issue Jun 27, 2018 · 5 comments
Closed

[SR-8125] Swift 4.2 exhaustivity checker regression #50657

sharplet opened this issue Jun 27, 2018 · 5 comments

Comments

@sharplet
Copy link

@sharplet sharplet commented Jun 27, 2018

Previous ID SR-8125
Radar rdar://problem/41525746
Original Reporter @sharplet
Type Bug
Status Closed
Resolution Done
Environment

Xcode Version 10.0 beta 2 (10L177m)

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

md5: 151824427e3aec5ee74b46aec98a0730

is duplicated by:

  • SR-8197 REGRESSION: Switch exhaustiveness handles Never separately from other no-valued types

Issue Description:

The following code compiles in Swift 4.1, but fails with an exhaustivity error in Swift 4.2:

extension Signal where Value: ResultProtocol, Error == NoError {
    func dematerializeResults() -> Signal<Value.Value, Value.Error> {
        return .init { observer, lifetime in
            lifetime += self.observe { event in
                switch event {
                case let .value(value):
                    value.result.analysis(
                        ifSuccess: { value in
                            observer.send(value: value)
                        }, ifFailure: { error in
                            observer.send(error: error)
                        }
                    )
                case .completed:
                    observer.sendCompleted()
                case .interrupted:
                    observer.sendInterrupted()
                }
            }
        }
    }
}

The Event enum has a failure case which in this case has an associated value of type NoError, and thus is impossible to construct.

Reproduced on this branch in the ReactiveSwift repository: https://github.com/ReactiveCocoa/ReactiveSwift/tree/as-exhaustivity-bug

@belkadan
Copy link
Contributor

@belkadan belkadan commented Jun 27, 2018

I wonder if this is fallout from unknown case.

@swift-ci create

@belkadan
Copy link
Contributor

@belkadan belkadan commented Jul 2, 2018

@belkadan
Copy link
Contributor

@belkadan belkadan commented Jul 3, 2018

4.2: #17690

@AnnaZaks
Copy link
Mannequin

@AnnaZaks AnnaZaks mannequin commented Aug 4, 2018

@sharplet, Could you verify if the problem is fixed and if so move the JIRA to "Closed"?
Thanks!
Anna

@sharplet
Copy link
Author

@sharplet sharplet commented Aug 19, 2018

This compiled for me on the latest Xcode beta, thanks!

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

No branches or pull requests

2 participants