@@ -1413,26 +1413,10 @@ SolutionCompareResult ConstraintSystem::compareSolutions(
1413
1413
auto type1 = types.Type1 ;
1414
1414
auto type2 = types.Type2 ;
1415
1415
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 ()) {
1436
1420
identical = false ;
1437
1421
continue ;
1438
1422
}
@@ -1469,15 +1453,12 @@ SolutionCompareResult ConstraintSystem::compareSolutions(
1469
1453
// The systems are not considered equivalent.
1470
1454
identical = false ;
1471
1455
1472
- // Archetypes are worse than concrete types (i.e. non-placeholder and
1473
- // non-archetype)
1456
+ // Archetypes are worse than concrete types
1474
1457
// FIXME: Total hack.
1475
- if (type1->is <ArchetypeType>() && !type2->is <ArchetypeType>() &&
1476
- !type2->is <PlaceholderType>()) {
1458
+ if (type1->is <ArchetypeType>() && !type2->is <ArchetypeType>()) {
1477
1459
++score2;
1478
1460
continue ;
1479
- } else if (type2->is <ArchetypeType>() && !type1->is <ArchetypeType>() &&
1480
- !type1->is <PlaceholderType>()) {
1461
+ } else if (type2->is <ArchetypeType>() && !type1->is <ArchetypeType>()) {
1481
1462
++score1;
1482
1463
continue ;
1483
1464
}
0 commit comments