diff --git a/lib/Sema/CSGen.cpp b/lib/Sema/CSGen.cpp index e4c1e480d5134..4b31e87487d74 100644 --- a/lib/Sema/CSGen.cpp +++ b/lib/Sema/CSGen.cpp @@ -752,7 +752,10 @@ namespace { } Type paramTy = fnTy->getInput(); - auto paramTupleTy = paramTy->castTo(); + auto paramTupleTy = paramTy->getAs(); + if (!paramTupleTy || paramTupleTy->getNumElements() != 2) + return false; + auto firstParamTy = paramTupleTy->getElement(0).getType(); auto secondParamTy = paramTupleTy->getElement(1).getType(); diff --git a/validation-test/compiler_crashers_2_fixed/0036-rdar23719809.swift b/validation-test/compiler_crashers_2_fixed/0036-rdar23719809.swift new file mode 100644 index 0000000000000..84684763144b2 --- /dev/null +++ b/validation-test/compiler_crashers_2_fixed/0036-rdar23719809.swift @@ -0,0 +1,12 @@ +// RUN: not %target-swift-frontend %s -parse + +// rdar://problem/23719809&23720006 + +func ~=() {} +func ~=(_: Int) {} +func ~=(_: () -> ()) {} + +switch 0 { +case 0: + break +}