Skip to content

Commit 6d0c718

Browse files
[Sema] Mark variables as hole while diagnosing a optional payload
1 parent 4e1a1b8 commit 6d0c718

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5703,6 +5703,9 @@ bool ConstraintSystem::repairFailures(
57035703
}
57045704

57055705
case ConstraintLocator::OptionalPayload: {
5706+
recordAnyTypeVarAsPotentialHole(lhs);
5707+
recordAnyTypeVarAsPotentialHole(rhs);
5708+
57065709
if (repairViaOptionalUnwrap(*this, lhs, rhs, matchKind, conversionsOrFixes,
57075710
locator))
57085711
return true;

test/Constraints/overload.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,3 +257,10 @@ func rdar79672230() {
257257
var t: MyType = MyType()
258258
test(&t) // expected-error {{no exact matches in call to local function 'test'}}
259259
}
260+
261+
// https://github.com/apple/swift/issues/60029
262+
for (key, values) in oldName { // expected-error{{cannot find 'oldName' in scope; did you mean 'newName'?}}
263+
for (idx, value) in values.enumerated() {
264+
print(key, idx, value)
265+
}
266+
}

0 commit comments

Comments
 (0)