Swift: Exhaustiveness check fails exhaustive switch with wildcards

Originator:rix.rob
Number:rdar://22743728 Date Originated:17-Sep-2015 03:09 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode-beta (7B60)
Classification:Other Bug Reproducible:Always
 
Summary:
Switching over a pair of items with >1 wildcard incorrectly fails the exhaustiveness checker.


Steps to Reproduce:
1. This code:
enum E {
	case A
	case B
}

func f(l: E, r: E) {
	switch (l, r) {
	case (.A, .A):
		return
	case (.A, _):
		return
	case (_, .A):
		return
	case (.B, .B):
		return
	}
}


Expected Results:
should compile


Actual Results:
but errors out:
rob@Resonance ~/Desktop> swiftc boom.swift
boom.swift:16:2: error: switch must be exhaustive, consider adding a default clause
        }
        ^


Regression:
Replacing either the second or the third `_` with `.B` passes the exhaustiveness check.


Notes:
N/A

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!