Skip to content

Commit 92652e0

Browse files
authored
Merge pull request #32449 from xedin/rdar-64368545
[ConstraintSystem] Don't propagate holes through supertype inference
2 parents eae52e1 + 2283208 commit 92652e0

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

lib/Sema/CSBindings.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ void ConstraintSystem::inferTransitiveSupertypeBindings(
6969

7070
auto type = binding.BindingType;
7171

72+
if (type->isHole())
73+
continue;
74+
7275
if (!existingTypes.insert(type->getCanonicalType()).second)
7376
continue;
7477

test/Constraints/overload.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,3 +239,10 @@ func autoclosure1<T>(_: [T], _: X) { }
239239
func test_autoclosure1(ia: [Int]) {
240240
autoclosure1(ia, X()) // okay: resolves to the second function
241241
}
242+
243+
// rdar://problem/64368545 - failed to produce diagnostic (hole propagated to func result without recording a fix)
244+
func test_no_hole_propagation() {
245+
func test(withArguments arguments: [String]) -> String {
246+
return arguments.reduce(0, +) // expected-error {{cannot convert value of type 'Int' to expected argument type 'String'}}
247+
}
248+
}

0 commit comments

Comments
 (0)