@@ -5980,13 +5980,18 @@ Expr *ExprRewriter::convertLiteral(Expr *literal,
5980
5980
return cs.getType (E);
5981
5981
};
5982
5982
5983
+ auto setType = [&](Expr *E, Type Ty) {
5984
+ cs.setType (E, Ty);
5985
+ };
5986
+
5983
5987
// If coercing a literal to an unresolved type, we don't try to look up the
5984
5988
// witness members, just do it.
5985
5989
if (type->is <UnresolvedType>()) {
5986
5990
// Instead of updating the literal expr in place, allocate a new node. This
5987
5991
// avoids issues where Builtin types end up on expr nodes and pollute
5988
5992
// diagnostics.
5989
- literal = cast<LiteralExpr>(literal)->shallowClone (tc.Context , getType);
5993
+ literal = cast<LiteralExpr>(literal)->shallowClone (tc.Context , setType,
5994
+ getType);
5990
5995
5991
5996
// The literal expression has this type.
5992
5997
cs.setType (literal, type);
@@ -6021,7 +6026,8 @@ Expr *ExprRewriter::convertLiteral(Expr *literal,
6021
6026
// Instead of updating the literal expr in place, allocate a new node. This
6022
6027
// avoids issues where Builtin types end up on expr nodes and pollute
6023
6028
// diagnostics.
6024
- literal = cast<LiteralExpr>(literal)->shallowClone (tc.Context , getType);
6029
+ literal = cast<LiteralExpr>(literal)->shallowClone (tc.Context , setType,
6030
+ getType);
6025
6031
6026
6032
// The literal expression has this type.
6027
6033
cs.setType (literal, argType);
@@ -6124,13 +6130,18 @@ Expr *ExprRewriter::convertLiteralInPlace(Expr *literal,
6124
6130
return cs.getType (E);
6125
6131
};
6126
6132
6133
+ auto setType = [&](Expr *E, Type Ty) {
6134
+ cs.setType (E, Ty);
6135
+ };
6136
+
6127
6137
// If coercing a literal to an unresolved type, we don't try to look up the
6128
6138
// witness members, just do it.
6129
6139
if (type->is <UnresolvedType>()) {
6130
6140
// Instead of updating the literal expr in place, allocate a new node. This
6131
6141
// avoids issues where Builtin types end up on expr nodes and pollute
6132
6142
// diagnostics.
6133
- literal = cast<LiteralExpr>(literal)->shallowClone (tc.Context , getType);
6143
+ literal = cast<LiteralExpr>(literal)->shallowClone (tc.Context , setType,
6144
+ getType);
6134
6145
6135
6146
// The literal expression has this type.
6136
6147
cs.setType (literal, type);
0 commit comments