Swift: Compiler crash when a value type uses normal function returns to conform to a protocol with a curried function

Originator:rix.rob
Number:rdar://18456545 Date Originated:25-Sep-2014 01:48 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode-6.1 (6A1030)
Classification:Serious Bug Reproducible:Always
 
Summary:
A protocol specifying a curried function can be conformed to by a class which uses a normal function return instead. If you try this with a struct or enum, it crashes the compiler.

Steps to Reproduce:
enum S<T> : P {
	func f<T>() -> T -> T {
		return { x in x }
	}
}
protocol P {
	func f<T>()(T) -> T
}

Expected Results:
I expected this would work.

Actual Results:
The compiler crashed.

Regression:
- Doesn’t crash if you use a class.
- Doesn’t crash without the protocol conformance.
- Doesn’t crash if the protocol specifies a normal function return.
- Doesn’t crash if the protocol specifies a normal function return and the value type does a curried return, BUT, you have to explicitly specify the argument labels in the function return in the protocol because the compiler treats it as a labelled tuple; this is pretty frustrating.

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!