Skip to content

Commit 592733b

Browse files
committed
[Sema] Don't set FunctionRefKind::Compound for an implicit ~=
It's not clear to me why it was ever set this way, but it prevents IUOs from working with the match operator. Unset it, and let pre-checking correctly assign it a `FunctionRefKind::SingleApply`.
1 parent 37b0a60 commit 592733b

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

lib/Sema/TypeCheckPattern.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -781,10 +781,6 @@ ExprPatternMatchRequest::evaluate(Evaluator &evaluator,
781781
DeclNameLoc(EP->getLoc()));
782782
matchOp->setImplicit();
783783

784-
// FIXME: This matches what the previous code had, but it doesn't seems like
785-
// it should be set to this.
786-
matchOp->setFunctionRefKind(FunctionRefKind::Compound);
787-
788784
// Note we use getEndLoc here to have the BinaryExpr source range be the same
789785
// as the expr pattern source range.
790786
auto *matchVarRef =

test/Constraints/patterns.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,3 +557,10 @@ extension [EWithIdent<Int>] {
557557
}
558558
}
559559
}
560+
561+
struct TestIUOMatchOp {
562+
static func ~= (lhs: TestIUOMatchOp, rhs: TestIUOMatchOp) -> Bool! { nil }
563+
func foo() {
564+
if case self = self {}
565+
}
566+
}

0 commit comments

Comments
 (0)