Skip to content

Commit 821a5a6

Browse files
committed
Merge pull request #163 from jtbandes/master
Fix crash when considering invalid binary operator function for resolution. <rdar://23719809&23720006>
2 parents 6027248 + 56e13fc commit 821a5a6

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

lib/Sema/CSGen.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,10 @@ namespace {
752752
}
753753

754754
Type paramTy = fnTy->getInput();
755-
auto paramTupleTy = paramTy->castTo<TupleType>();
755+
auto paramTupleTy = paramTy->getAs<TupleType>();
756+
if (!paramTupleTy || paramTupleTy->getNumElements() != 2)
757+
return false;
758+
756759
auto firstParamTy = paramTupleTy->getElement(0).getType();
757760
auto secondParamTy = paramTupleTy->getElement(1).getType();
758761

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// RUN: not %target-swift-frontend %s -parse
2+
3+
// rdar://problem/23719809&23720006
4+
5+
func ~=() {}
6+
func ~=(_: Int) {}
7+
func ~=(_: () -> ()) {}
8+
9+
switch 0 {
10+
case 0:
11+
break
12+
}

0 commit comments

Comments
 (0)