Swift: Crash with ill-typed expression alternating at least four strings

Originator:rix.rob
Number:rdar://19343997 Date Originated:24-Dec-2014 07:03 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 6.1.1 (6A2008a)
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Summary:
’Twas the night before Christmas
when all through the house
the compiler exploded
and crashed with a flounce


Steps to Reproduce:
1. Compile this:
func ignore<T>(parser: String -> (T, String)?) -> String -> ((), String)? {
	return { parser($0).map { _ in () } }
}
func | <T> (left: String -> (T, String)?, right: String -> ((), String)?) -> String -> (T?, String)? {
	return { _ in nil }
}

ignore(" " | "\r" | "\t" | "\n")


Expected Results:
I expected it to error out on the final line, which is ill-typed.


Actual Results:
Crash.


Regression:
The workaround in this case is to write correct code.
It doesn’t crash if you remove `ignore` on the final line (leaving only the parens & their contents).
It doesn’t crash with <4 strings. It does crash with >= 4 strings. There’s a Holy Hand Grenade joke to be made here but I can’t be arsed.


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!