@@ -2901,18 +2901,12 @@ namespace {
29012901 struct CollectVarRefs : public ASTWalker {
29022902 ConstraintSystem &cs;
29032903 llvm::SmallPtrSet<TypeVariableType *, 4 > varRefs;
2904- bool hasErrorExprs = false ;
29052904
29062905 CollectVarRefs (ConstraintSystem &cs) : cs(cs) { }
29072906
29082907 bool shouldWalkCaptureInitializerExpressions () override { return true ; }
29092908
29102909 PreWalkResult<Expr *> walkToExprPre (Expr *expr) override {
2911- // If there are any error expressions in this closure
2912- // it wouldn't be possible to infer its type.
2913- if (isa<ErrorExpr>(expr))
2914- hasErrorExprs = true ;
2915-
29162910 // Retrieve type variables from references to var decls.
29172911 if (auto *declRef = dyn_cast<DeclRefExpr>(expr)) {
29182912 if (auto *varDecl = dyn_cast<VarDecl>(declRef->getDecl ())) {
@@ -2954,15 +2948,6 @@ namespace {
29542948
29552949 closure->walk (collectVarRefs);
29562950
2957- // If walker discovered error expressions, let's fail constraint
2958- // generation only if closure is going to participate
2959- // in the type-check. This allows us to delay validation of
2960- // multi-statement closures until body is opened.
2961- if (CS.participatesInInference (closure) &&
2962- collectVarRefs.hasErrorExprs ) {
2963- return Type ();
2964- }
2965-
29662951 auto inferredType = inferClosureType (closure);
29672952 if (!inferredType || inferredType->hasError ())
29682953 return Type ();
0 commit comments