Skip to content

Commit 0b29d9d

Browse files
committed
[ConstraintSystem] Decouple designated types feature from Swift version
`selectApplyDisjunction` only makes sense in conjunction with designated types feature because it's going to prioritize disjunctions with arguments which are known to conform to literal protocols. Prioritization like that is harmful without designated types feature because it doesn't always lead to better constraint system splits, and could prioritize bigger disjunctions which harms chances to short-circuit solving. Resolves: rdar://problem/47492691
1 parent 87b66e7 commit 0b29d9d

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

lib/Sema/CSSolver.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1897,10 +1897,10 @@ Constraint *ConstraintSystem::selectDisjunction() {
18971897
// disjunctions that we may not be able to short-circuit, allowing
18981898
// us to eliminate behavior that is exponential in the number of
18991899
// operators in the expression.
1900-
if (getASTContext().isSwiftVersionAtLeast(5) ||
1901-
TC.getLangOpts().SolverEnableOperatorDesignatedTypes)
1900+
if (TC.getLangOpts().SolverEnableOperatorDesignatedTypes) {
19021901
if (auto *disjunction = selectApplyDisjunction())
19031902
return disjunction;
1903+
}
19041904

19051905
if (auto *disjunction = selectBestBindingDisjunction(*this, disjunctions))
19061906
return disjunction;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// RUN: %target-typecheck-verify-swift
2+
// REQUIRES: objc_interop
3+
4+
import CoreGraphics
5+
import simd
6+
7+
func test(foo: CGFloat, bar: CGFloat) {
8+
_ = CGRect(x: 0.0 + 1.0, y: 0.0 + foo, width: 3.0 - 1 - 1 - 1.0, height: bar)
9+
}

0 commit comments

Comments
 (0)