@@ -6487,24 +6487,13 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
6487
6487
toType->getCanonicalType () });
6488
6488
if (knownRestriction != solution.ConstraintRestrictions .end ()) {
6489
6489
switch (knownRestriction->second ) {
6490
- case ConversionRestrictionKind::TupleToTuple: {
6491
- auto fromTuple = fromType->castTo <TupleType>();
6492
- auto toTuple = toType->castTo <TupleType>();
6493
- SmallVector<int , 4 > sources;
6494
- SmallVector<unsigned , 4 > variadicArgs;
6495
- bool failed = computeTupleShuffle (fromTuple, toTuple,
6496
- sources, variadicArgs);
6497
- assert (!failed && " Couldn't convert tuple to tuple?" );
6498
- (void )failed;
6499
- return coerceTupleToTuple (expr, fromTuple, toTuple, locator, sources,
6500
- variadicArgs, typeFromPattern);
6501
- }
6502
6490
6503
- case ConversionRestrictionKind::ScalarToTuple: {
6504
- auto toTuple = toType->castTo <TupleType>();
6505
- return coerceScalarToTuple (expr, toTuple,
6506
- toTuple->getElementForScalarInit (), locator);
6507
- }
6491
+ case ConversionRestrictionKind::TupleToTuple:
6492
+ case ConversionRestrictionKind::ScalarToTuple:
6493
+ case ConversionRestrictionKind::LValueToRValue:
6494
+ // Restrictions that don't need to be recorded.
6495
+ // Should match recordRestriction() in CSSimplify
6496
+ break ;
6508
6497
6509
6498
case ConversionRestrictionKind::DeepEquality: {
6510
6499
if (toType->hasUnresolvedType ())
@@ -6548,22 +6537,13 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
6548
6537
}
6549
6538
6550
6539
case ConversionRestrictionKind::Superclass:
6540
+ case ConversionRestrictionKind::ExistentialMetatypeToMetatype:
6551
6541
return coerceSuperclass (expr, toType, locator);
6552
6542
6553
- case ConversionRestrictionKind::LValueToRValue: {
6554
- if (toType->is <TupleType>() || fromType->is <TupleType>())
6555
- break ;
6556
-
6557
- return coerceToType (addImplicitLoadExpr (cs, expr), toType, locator);
6558
- }
6559
-
6560
6543
case ConversionRestrictionKind::Existential:
6561
6544
case ConversionRestrictionKind::MetatypeToExistentialMetatype:
6562
6545
return coerceExistential (expr, toType, locator);
6563
6546
6564
- case ConversionRestrictionKind::ExistentialMetatypeToMetatype:
6565
- return coerceSuperclass (expr, toType, locator);
6566
-
6567
6547
case ConversionRestrictionKind::ClassMetatypeToAnyObject: {
6568
6548
assert (tc.getLangOpts ().EnableObjCInterop
6569
6549
&& " metatypes can only be cast to objects w/ objc runtime!" );
0 commit comments