[Swift 1.2] Incorrect "switch must be exhaustive" error with enum tuple

Originator:hello
Number:rdar://22312768 Date Originated:08/17/2015
Status:Open Resolved:
Product:Developer Tools Product Version:Swift 1.2
Classification: Reproducible:Always
 
Summary:
Swift cannot determine that a tuple with 2 enums is exhaustive. (Possible duplicate: rdar://21892845)

Steps to Reproduce:
Compile this code:

enum A {
	case A(Int)
	case B(Bool)
	case C
	case D
}

enum B {
	case A
	case B
}

func s(a: A, b: B) {
	switch (a, b) {
		case let (.A(i), .A):
			break
		case let (.A(i), .B):
			break

		case let (.B(boolean), b):
			break

		case (.C, _), (.D, _):
			break
	}
}

Using `swiftc switch.swift`

Expected Results:
Code compiles because the `switch` is exhaustive.

Actual Results:
error: switch must be exhaustive, consider adding a default clause

Regression:
This doesn’t seem to be solved in Swift 2.

Notes:
Switching over 2 enums produces the same problem. Example: https://gist.github.com/NachoSoto/830d1c077be60143680e

Comments

Still present as of Xcode 7.0b6.

By atomicbird at Sept. 9, 2015, 2:36 a.m. (reply...)

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!