Skip to content

Commit e2691ed

Browse files
committed
---
yaml --- r: 335847 b: refs/heads/rxwei-patch-1 c: ab81406 h: refs/heads/master i: 335845: a9ef4d3 335843: 5169d3b 335839: 2fb75af
1 parent ca33ed3 commit e2691ed

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-08-18-a: b10b1fce14385faa6d44f6b933e95
10151015
refs/heads/rdar-43033749-fix-batch-mode-no-diags-swift-5.0-branch: a14e64eaad30de89f0f5f0b2a782eed7ecdcb255
10161016
refs/heads/revert-19006-error-bridging-integer-type: 8a9065a3696535305ea53fe9b71f91cbe6702019
10171017
refs/heads/revert-19050-revert-19006-error-bridging-integer-type: ecf752d54b05dd0a20f510f0bfa54a3fec3bcaca
1018-
refs/heads/rxwei-patch-1: 18e8feac8f08c97811837e1282ffbec0fffe6579
1018+
refs/heads/rxwei-patch-1: ab81406711222ff8c88717ef456a5e5acc575b98
10191019
refs/heads/shahmishal-patch-1: e58ec0f7488258d42bef51bc3e6d7b3dc74d7b2a
10201020
refs/heads/typelist-existential: 4046359efd541fb5c72d69a92eefc0a784df8f5e
10211021
refs/tags/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-08-20-a: 4319ba09e4fb8650ee86061075c74a016b6baab9

branches/rxwei-patch-1/lib/Sema/CSApply.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5259,13 +5259,7 @@ Expr *ExprRewriter::coerceExistential(Expr *expr, Type toType,
52595259
// Load tuples with lvalue elements.
52605260
if (auto tupleType = fromType->getAs<TupleType>()) {
52615261
if (tupleType->hasLValueType()) {
5262-
auto toTuple = tupleType->getRValueType()->castTo<TupleType>();
5263-
SmallVector<unsigned, 4> sources;
5264-
bool failed = computeTupleShuffle(tupleType, toTuple, sources);
5265-
assert(!failed && "Couldn't convert tuple to tuple?");
5266-
(void)failed;
5267-
5268-
coerceTupleToTuple(expr, tupleType, toTuple, locator, sources);
5262+
expr = cs.coerceToRValue(expr);
52695263
}
52705264
}
52715265

@@ -6492,6 +6486,10 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
64926486
auto toTuple = toType->getAs<TupleType>();
64936487
if (!toTuple)
64946488
break;
6489+
6490+
if (fromTuple->hasLValueType() && !toTuple->hasLValueType())
6491+
return coerceToType(cs.coerceToRValue(expr), toType, locator);
6492+
64956493
SmallVector<unsigned, 4> sources;
64966494
if (!computeTupleShuffle(fromTuple, toTuple, sources)) {
64976495
return coerceTupleToTuple(expr, fromTuple, toTuple,

branches/rxwei-patch-1/lib/Sema/TypeCheckConstraints.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3134,15 +3134,11 @@ Expr *TypeChecker::coerceToRValue(Expr *expr,
31343134
return FVE;
31353135
}
31363136

3137-
// Load lvalues.
3138-
if (exprTy->is<LValueType>())
3139-
return addImplicitLoadExpr(expr, getType, setType);
3140-
31413137
// Walk into parenthesized expressions to update the subexpression.
31423138
if (auto paren = dyn_cast<IdentityExpr>(expr)) {
31433139
auto sub = coerceToRValue(paren->getSubExpr(), getType, setType);
31443140
paren->setSubExpr(sub);
3145-
setType(paren, getType(sub));
3141+
setType(paren, ParenType::get(Context, getType(sub)));
31463142
return paren;
31473143
}
31483144

@@ -3186,6 +3182,10 @@ Expr *TypeChecker::coerceToRValue(Expr *expr,
31863182
return tuple;
31873183
}
31883184

3185+
// Load lvalues.
3186+
if (exprTy->is<LValueType>())
3187+
return addImplicitLoadExpr(expr, getType, setType);
3188+
31893189
// Nothing to do.
31903190
return expr;
31913191
}

0 commit comments

Comments
 (0)