@@ -1413,26 +1413,10 @@ SolutionCompareResult ConstraintSystem::compareSolutions(
14131413 auto type1 = types.Type1 ;
14141414 auto type2 = types.Type2 ;
14151415
1416- // If either of the types still contains type variables, we can't
1417- // compare them.
1418- // FIXME: This is really unfortunate. More type variable sharing
1419- // (when it's sound) would help us do much better here.
1420- if (type1->hasTypeVariable () || type2->hasTypeVariable ()) {
1421- identical = false ;
1422- continue ;
1423- }
1424-
1425- // With introduction of holes it's currently possible to form solutions
1426- // with UnresolvedType bindings, we need to account for that in
1427- // ranking. If one solution has a hole for a given type variable
1428- // it's always worse than any non-hole type other solution might have.
1429- if (type1->is <UnresolvedType>() || type2->is <UnresolvedType>()) {
1430- if (type1->is <UnresolvedType>()) {
1431- ++score2;
1432- } else {
1433- ++score1;
1434- }
1435-
1416+ // If either of the types have holes or unresolved type variables, we can't
1417+ // compare them. `isSubtypeOf` cannot be used with solver-allocated types.
1418+ if (type1->hasTypeVariableOrPlaceholder () ||
1419+ type2->hasTypeVariableOrPlaceholder ()) {
14361420 identical = false ;
14371421 continue ;
14381422 }
@@ -1469,15 +1453,12 @@ SolutionCompareResult ConstraintSystem::compareSolutions(
14691453 // The systems are not considered equivalent.
14701454 identical = false ;
14711455
1472- // Archetypes are worse than concrete types (i.e. non-placeholder and
1473- // non-archetype)
1456+ // Archetypes are worse than concrete types
14741457 // FIXME: Total hack.
1475- if (type1->is <ArchetypeType>() && !type2->is <ArchetypeType>() &&
1476- !type2->is <PlaceholderType>()) {
1458+ if (type1->is <ArchetypeType>() && !type2->is <ArchetypeType>()) {
14771459 ++score2;
14781460 continue ;
1479- } else if (type2->is <ArchetypeType>() && !type1->is <ArchetypeType>() &&
1480- !type1->is <PlaceholderType>()) {
1461+ } else if (type2->is <ArchetypeType>() && !type1->is <ArchetypeType>()) {
14811462 ++score1;
14821463 continue ;
14831464 }
0 commit comments