@@ -1579,6 +1579,17 @@ ConstraintSystem::matchTypes(Type type1, Type type2, TypeMatchKind kind,
1579
1579
conversionsOrFixes.push_back (ConversionRestrictionKind::Superclass);
1580
1580
}
1581
1581
1582
+ // T -> AnyHashable.
1583
+ if (isAnyHashableType (desugar2)) {
1584
+ // Don't allow this in operator contexts or we'll end up allowing
1585
+ // 'T() == U()' for unrelated T and U that just happen to be Hashable.
1586
+ // We can remove this special case when we implement operator hiding.
1587
+ if (kind != TypeMatchKind::OperatorArgumentConversion) {
1588
+ conversionsOrFixes.push_back (
1589
+ ConversionRestrictionKind::HashableToAnyHashable);
1590
+ }
1591
+ }
1592
+
1582
1593
// Metatype to object conversion.
1583
1594
//
1584
1595
// Class and protocol metatypes are interoperable with certain Objective-C
@@ -1649,15 +1660,6 @@ ConstraintSystem::matchTypes(Type type1, Type type2, TypeMatchKind kind,
1649
1660
} else if (isSetType (desugar1) && isSetType (desugar2)) {
1650
1661
conversionsOrFixes.push_back (
1651
1662
ConversionRestrictionKind::SetUpcast);
1652
- // T -> AnyHashable.
1653
- } else if (isAnyHashableType (desugar2)) {
1654
- // Don't allow this in operator contexts or we'll end up allowing
1655
- // 'T() == U()' for unrelated T and U that just happen to be Hashable.
1656
- // We can remove this special case when we implement operator hiding.
1657
- if (kind != TypeMatchKind::OperatorArgumentConversion) {
1658
- conversionsOrFixes.push_back (
1659
- ConversionRestrictionKind::HashableToAnyHashable);
1660
- }
1661
1663
}
1662
1664
}
1663
1665
}
0 commit comments