Skip to content

Commit 506cccc

Browse files
authored
Merge pull request #60837 from xedin/rdar-99282932
[ConstraintSystem] Teach partial application check about implicit con…
2 parents f7a11c7 + 842aa60 commit 506cccc

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

lib/Sema/ConstraintSystem.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2751,6 +2751,13 @@ static std::pair<bool, unsigned>
27512751
isInvalidPartialApplication(ConstraintSystem &cs,
27522752
const AbstractFunctionDecl *member,
27532753
ConstraintLocator *locator) {
2754+
// If this is a compiler synthesized implicit conversion, let's skip
2755+
// the check because the base of `UDE` is not the base of the injected
2756+
// initializer.
2757+
if (locator->isLastElement<LocatorPathElt::ConstructorMember>() &&
2758+
locator->findFirst<LocatorPathElt::ImplicitConversion>())
2759+
return {false, 0};
2760+
27542761
auto *UDE = getAsExpr<UnresolvedDotExpr>(locator->getAnchor());
27552762
if (UDE == nullptr)
27562763
return {false,0};

test/Constraints/implicit_double_cgfloat_conversion.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,3 +315,18 @@ do {
315315
}
316316
}
317317
}
318+
319+
// rdar://99282938
320+
func test_implicit_conversion_clash_with_partial_application_check() {
321+
class C {
322+
var duration: CGFloat { 0.3 }
323+
324+
var use: Double {
325+
duration // Ok
326+
}
327+
328+
func transitionDuration() -> TimeInterval {
329+
duration // Ok
330+
}
331+
}
332+
}

0 commit comments

Comments
 (0)