@@ -1877,10 +1877,15 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
1877
1877
return getTypeMatchFailure (locator);
1878
1878
1879
1879
case TypeKind::Tuple: {
1880
- assert (!type2->is <LValueType>() && " Unexpected lvalue type!" );
1881
- // Try the tuple-to-tuple conversion.
1882
- if (!type1->is <LValueType>())
1883
- conversionsOrFixes.push_back (ConversionRestrictionKind::TupleToTuple);
1880
+ auto result = matchTupleTypes (cast<TupleType>(desugar1),
1881
+ cast<TupleType>(desugar2),
1882
+ kind, subflags, locator);
1883
+ if (result != SolutionKind::Error)
1884
+ return result;
1885
+
1886
+ // FIXME: All cases in this switch should go down to the fix logic
1887
+ // to give repairFailures() a chance to run, but this breaks stuff
1888
+ // right now.
1884
1889
break ;
1885
1890
}
1886
1891
@@ -4943,11 +4948,6 @@ ConstraintSystem::simplifyRestrictedConstraintImpl(
4943
4948
switch (restriction) {
4944
4949
// for $< in { <, <c, <oc }:
4945
4950
// T_i $< U_i ===> (T_i...) $< (U_i...)
4946
- case ConversionRestrictionKind::TupleToTuple:
4947
- return matchTupleTypes (type1->castTo <TupleType>(),
4948
- type2->castTo <TupleType>(),
4949
- matchKind, subflags, locator);
4950
-
4951
4951
case ConversionRestrictionKind::DeepEquality:
4952
4952
return matchDeepEqualityTypes (type1, type2, locator);
4953
4953
@@ -5269,17 +5269,6 @@ ConstraintSystem::simplifyRestrictedConstraintImpl(
5269
5269
llvm_unreachable (" bad conversion restriction" );
5270
5270
}
5271
5271
5272
- // Restrictions where CSApply can figure out the correct action from the shape of
5273
- // the types, rather than needing a record of the choice made.
5274
- static bool recordRestriction (ConversionRestrictionKind restriction) {
5275
- switch (restriction) {
5276
- case ConversionRestrictionKind::TupleToTuple:
5277
- return false ;
5278
- default :
5279
- return true ;
5280
- }
5281
- }
5282
-
5283
5272
ConstraintSystem::SolutionKind
5284
5273
ConstraintSystem::simplifyRestrictedConstraint (
5285
5274
ConversionRestrictionKind restriction,
@@ -5290,8 +5279,7 @@ ConstraintSystem::simplifyRestrictedConstraint(
5290
5279
switch (simplifyRestrictedConstraintImpl (restriction, type1, type2,
5291
5280
matchKind, flags, locator)) {
5292
5281
case SolutionKind::Solved:
5293
- if (recordRestriction (restriction))
5294
- ConstraintRestrictions.push_back (std::make_tuple (type1, type2, restriction));
5282
+ ConstraintRestrictions.push_back (std::make_tuple (type1, type2, restriction));
5295
5283
return SolutionKind::Solved;
5296
5284
5297
5285
case SolutionKind::Unsolved:
0 commit comments