Skip to content

Commit f5c68db

Browse files
[Sema] Handle FunctionArgument anchored in coerce expr in getCalleeLocator
1 parent c82282a commit f5c68db

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lib/Sema/ConstraintSystem.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,12 @@ ConstraintLocator *ConstraintSystem::getCalleeLocator(
622622
if (isExpr<ObjectLiteralExpr>(anchor))
623623
return getConstraintLocator(anchor, ConstraintLocator::ConstructorMember);
624624

625+
if (locator->isLastElement<LocatorPathElt::FunctionArgument>()) {
626+
if (auto *CE = getAsExpr<CoerceExpr>(anchor)) {
627+
return getConstraintLocator(CE->getSubExpr());
628+
}
629+
}
630+
625631
return getConstraintLocator(anchor);
626632
}
627633

test/Constraints/overload.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,3 +285,9 @@ func rdar97396399() {
285285
}
286286
}
287287
}
288+
289+
// https://github.com/apple/swift/issues/63834
290+
func f63834(int: Int, string: String) {} // expected-note{{found candidate with type '(Int, String) -> ()'}}
291+
func f63834(int: Int, string: Bool) {} // expected-note{{found candidate with type '(Int, Bool) -> ()'}}
292+
293+
let a = f63834(int:string:) as (Int, Int) -> Void // expected-error{{no exact matches in reference to global function 'f63834'}}

0 commit comments

Comments
 (0)