Pattern matching tuple in Xcode 10.2 results in EXC_BAD_INSTRUCTION

Originator:dikovitsky.s
Number:rdar://49903264 Date Originated:15-Apr-2019
Status:Open Resolved:
Product:iOS+SDK Product Version:
Classification: Reproducible:
 
Summary:
The problem arises, when we have a case in enum with 2 or more associated values and one of them is URL or URLRequest (could not reproduce with other types). Also, we must have at least two same cases in switch which will be executed (changing `where false` to `where true` will not result in crash), and we have to refer to associated values as a tuple (`let .connectivity(value)`), not separate values (`let .connectivity(url, void)`).
Steps to reproduce:
1. Create new Xcode project for iOS.
2. Add the following func and run it (for example in AppDelegate)
    func failingFunc() {
        enum TestError {
            case connectivity(url: URL, void: Void)
        }
        let url = URL(string: "https://google.com")!
        let testError = TestError.connectivity(url: url, void: ())

        switch testError {
        case let .connectivity(value) where false:
            break
        case .connectivity:
            break
        }
    }
Expected Results:
Code runs correctly without crashes.
Actual Results:
Code crashes with EXC_BAD_INSTRUCTION.
Enabled zombies print the following: 
-[CFURL release]: message sent to deallocated instance 0x60000169e4c0
Seems like a memory issue with tuples.
Version/Build:
-
Configuration:
Xcode 10.2, Swift 4.2 or 5.0, macOS Mojave 10.14.4
Thing to note: Xcode 10.1 works fine

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!