Skip to content

Commit 3626187

Browse files
authored
Merge pull request #82459 from xedin/rdar-154010220-6.2
[6.2][CSSimplify] Prevent `missing call` fix from recording fixes while ma…
2 parents e78d734 + 39a7138 commit 3626187

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5366,6 +5366,11 @@ bool ConstraintSystem::repairFailures(
53665366
matchKind = ConstraintKind::Conversion;
53675367
}
53685368

5369+
// FIXME: There is currently no easy way to avoid attempting
5370+
// fixes, matchTypes do not propagate `TMF_ApplyingFix` flag.
5371+
llvm::SaveAndRestore<ConstraintSystemOptions> options(
5372+
Options, Options - ConstraintSystemFlags::AllowFixes);
5373+
53695374
auto result = matchTypes(resultType, dstType, matchKind,
53705375
TypeMatchFlags::TMF_ApplyingFix, locator);
53715376

test/Constraints/assignment.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,16 @@ class С_56396 {
8888
self.callback = callback // expected-error {{cannot assign value of type '(Self) -> Void' to type '(С_56396) -> Void'}}
8989
}
9090
}
91+
92+
// https://github.com/swiftlang/swift/issues/82397
93+
func testFunctionAssignsWithOptionals(fn: @escaping () -> () -> Void) {
94+
let _: (() -> () -> Void)? = fn
95+
let _: (() -> () -> Void)?? = fn
96+
97+
class Super {}
98+
class Sub: Super {}
99+
100+
let b: () -> () -> Sub = { { return Sub() } }
101+
let _: (() -> () -> Super)? = b
102+
let _: (() -> () -> Super)?? = b
103+
}

0 commit comments

Comments
 (0)