@@ -307,7 +307,9 @@ getTypeOfExpressionWithoutApplying(Expr *&expr, DeclContext *dc,
307307
308308 ConstraintSystemOptions options;
309309 options |= ConstraintSystemFlags::SuppressDiagnostics;
310- options |= ConstraintSystemFlags::LeaveClosureBodyUnchecked;
310+ if (!Context.CompletionCallback ) {
311+ options |= ConstraintSystemFlags::LeaveClosureBodyUnchecked;
312+ }
311313
312314 // Construct a constraint system from this expression.
313315 ConstraintSystem cs (dc, options);
@@ -400,7 +402,6 @@ getTypeOfCompletionOperatorImpl(DeclContext *DC, Expr *expr,
400402
401403 ConstraintSystemOptions options;
402404 options |= ConstraintSystemFlags::SuppressDiagnostics;
403- options |= ConstraintSystemFlags::LeaveClosureBodyUnchecked;
404405
405406 // Construct a constraint system from this expression.
406407 ConstraintSystem CS (DC, options);
@@ -612,8 +613,9 @@ bool TypeChecker::typeCheckForCodeCompletion(
612613 options |= ConstraintSystemFlags::AllowFixes;
613614 options |= ConstraintSystemFlags::SuppressDiagnostics;
614615 options |= ConstraintSystemFlags::ForCodeCompletion;
615- options |= ConstraintSystemFlags::LeaveClosureBodyUnchecked;
616-
616+ if (!Context.CompletionCallback ) {
617+ options |= ConstraintSystemFlags::LeaveClosureBodyUnchecked;
618+ }
617619
618620 ConstraintSystem cs (DC, options);
619621
0 commit comments