Swift 2b3: Crash with generic enum extension, same-type constraint, and variable shadowing case

Originator:rix.rob
Number:rdar://21783819 Date Originated:11-Jul-2015 09:02 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode-beta (7A152u)
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Summary:
See below.

Steps to Reproduce:
1. This code:
struct S {}
enum E<F> {
	case C
}
extension E where F == S {
	var C: S { return S(.C) }
}

Expected Results:
should not crash swiftc

Actual Results:
but totally does, without even logging an assertion failure.

Regression:
If the name of the variable differs, it doesn’t crash.
If the type isn’t generic, it doesn’t crash.
If S doesn’t exist, it doesn’t crash.
If the variable is defined in the enum body and not the extension, it doesn’t crash.

Notes:
If the variable is static, you get an assertion failure in a different stack trace:
Assertion failed: (nominal), function validatePatternBindingDecl, file /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-700.0.45/src/swift/lib/Sema/TypeCheckDecl.cpp, line 1470.
Filed separately.

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!