@@ -275,6 +275,21 @@ std::pair<bool, Expr *> SemaAnnotator::walkToExprPre(Expr *E) {
275275 return { false , E };
276276 }
277277
278+ auto doStopTraversal = [&]() -> std::pair<bool , Expr *> {
279+ Cancelled = true ;
280+ return { false , nullptr };
281+ };
282+
283+ // Skip the synthesized curry thunks and just walk over the unwrapped
284+ // expression
285+ if (auto *ACE = dyn_cast<AutoClosureExpr>(E)) {
286+ if (auto *SubExpr = ACE->getUnwrappedCurryThunkExpr ()) {
287+ if (!SubExpr->walk (*this ))
288+ return doStopTraversal ();
289+ return { false , E };
290+ }
291+ }
292+
278293 if (!SEWalker.walkToExprPre (E)) {
279294 return { false , E };
280295 }
@@ -291,30 +306,9 @@ std::pair<bool, Expr *> SemaAnnotator::walkToExprPre(Expr *E) {
291306 return { false , E };
292307 };
293308
294- auto doStopTraversal = [&]() -> std::pair<bool , Expr *> {
295- Cancelled = true ;
296- return { false , nullptr };
297- };
298-
299309 if (auto *CtorRefE = dyn_cast<ConstructorRefCallExpr>(E))
300310 CtorRefs.push_back (CtorRefE);
301311
302- if (auto *ACE = dyn_cast<AutoClosureExpr>(E)) {
303- if (auto *SubExpr = ACE->getUnwrappedCurryThunkExpr ()) {
304- if (auto *DRE = dyn_cast<DeclRefExpr>(SubExpr)) {
305- if (!passReference (DRE->getDecl (), DRE->getType (),
306- DRE->getNameLoc (),
307- ReferenceMetaData (getReferenceKind (Parent.getAsExpr (), DRE),
308- OpAccess)))
309- return doStopTraversal ();
310-
311- return doSkipChildren ();
312- }
313- }
314-
315- return { true , E };
316- }
317-
318312 if (auto *DRE = dyn_cast<DeclRefExpr>(E)) {
319313 auto *FD = dyn_cast<FuncDecl>(DRE->getDecl ());
320314 // Handle implicit callAsFunction reference. An explicit reference will be
0 commit comments