Skip to content

Commit ceb6d7e

Browse files
committed
[IDE] Skip complex closures while checking pattern bindings
This preserves previous behavior where multi-statement closures where always type-checked without context.
1 parent 8303319 commit ceb6d7e

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

include/swift/Sema/IDETypeChecking.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ namespace swift {
4747
struct PrintOptions;
4848

4949
/// Typecheck binding initializer at \p bindingIndex.
50-
void typeCheckPatternBinding(PatternBindingDecl *PBD, unsigned bindingIndex);
50+
void typeCheckPatternBinding(PatternBindingDecl *PBD, unsigned bindingIndex,
51+
bool leaveClosureBodiesUnchecked);
5152

5253
/// Check if T1 is convertible to T2.
5354
///

lib/IDE/ExprContextAnalysis.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ void swift::ide::typeCheckContextAt(DeclContext *DC, SourceLoc Loc) {
9898
[](VarDecl *VD) { (void)VD->getInterfaceType(); });
9999
if (PBD->getInit(i)) {
100100
if (!PBD->isInitializerChecked(i))
101-
typeCheckPatternBinding(PBD, i);
101+
typeCheckPatternBinding(PBD, i,
102+
/*LeaveClosureBodyUnchecked=*/true);
102103
}
103104
}
104105
} else if (auto *defaultArg = dyn_cast<DefaultArgumentInitializer>(DC)) {

0 commit comments

Comments
 (0)