Skip to content

Commit 7d80daf

Browse files
committed
[ConstraintSolver] When ranking bindings prefer type vars with literal bindings
Change the potential binding ranking logic to prefer type variables which don't have other type variables related to them, but have literal bindings, over the ones that do have other type variables.
1 parent 6c43424 commit 7d80daf

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/Sema/ConstraintSystem.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2551,8 +2551,8 @@ class ConstraintSystem {
25512551
};
25522552

25532553
struct PotentialBindings {
2554-
typedef std::tuple<bool, bool, bool, bool, unsigned char,
2555-
bool, unsigned int> BindingScore;
2554+
typedef std::tuple<bool, bool, bool, bool, bool,
2555+
unsigned char, unsigned int> BindingScore;
25562556

25572557
/// The set of potential bindings.
25582558
SmallVector<PotentialBinding, 4> Bindings;
@@ -2591,8 +2591,8 @@ class ConstraintSystem {
25912591
b.FullyBound,
25922592
b.IsRHSOfBindParam,
25932593
b.SubtypeOfExistentialType,
2594-
static_cast<unsigned char>(b.LiteralBinding),
25952594
b.InvolvesTypeVariables,
2595+
static_cast<unsigned char>(b.LiteralBinding),
25962596
-(b.Bindings.size() - b.NumDefaultableBindings));
25972597
}
25982598

validation-test/Sema/type_checker_perf/slow/rdar21720888.swift.gyb renamed to validation-test/Sema/type_checker_perf/fast/rdar21720888.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %scale-test --invert-result --begin 2 --end 7 --step 1 --select incrementScopeCounter %s
1+
// RUN: %scale-test --begin 1 --end 10 --step 1 --select incrementScopeCounter %s
22
// REQUIRES: OS=macosx
33
// REQUIRES: asserts
44

0 commit comments

Comments
 (0)