Skip to content

Commit 703f2c3

Browse files
authored
Merge pull request #32490 from xedin/rdar-64368545-5.3
[5.3][ConstraintSystem] Don't propagate holes through supertype inference
2 parents 43b7e9e + 91ddf5f commit 703f2c3

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
@@ -238,3 +238,10 @@ func autoclosure1<T>(_: [T], _: X) { }
238238
func test_autoclosure1(ia: [Int]) {
239239
autoclosure1(ia, X()) // okay: resolves to the second function
240240
}
241+
242+
// rdar://problem/64368545 - failed to produce diagnostic (hole propagated to func result without recording a fix)
243+
func test_no_hole_propagation() {
244+
func test(withArguments arguments: [String]) -> String {
245+
return arguments.reduce(0, +) // expected-error {{cannot convert value of type 'Int' to expected argument type 'String'}}
246+
}
247+
}

0 commit comments

Comments
 (0)