Skip to content

Commit 28f5c57

Browse files
committed
[Sema] Make sure to type ParenExpr as ParenType
1 parent 880a143 commit 28f5c57

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/Sema/CSApply.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6178,8 +6178,15 @@ static bool applyTypeToClosureExpr(ConstraintSystem &cs,
61786178
Expr *expr, Type toType) {
61796179
// Look through identity expressions, like parens.
61806180
if (auto IE = dyn_cast<IdentityExpr>(expr)) {
6181-
if (!applyTypeToClosureExpr(cs, IE->getSubExpr(), toType)) return false;
6182-
cs.setType(IE, toType);
6181+
if (!applyTypeToClosureExpr(cs, IE->getSubExpr(), toType))
6182+
return false;
6183+
6184+
auto subExprTy = cs.getType(IE->getSubExpr());
6185+
if (isa<ParenExpr>(IE)) {
6186+
cs.setType(IE, ParenType::get(cs.getASTContext(), subExprTy));
6187+
} else {
6188+
cs.setType(IE, subExprTy);
6189+
}
61836190
return true;
61846191
}
61856192

0 commit comments

Comments
 (0)