Skip to content

Commit 7e1648c

Browse files
authored
Merge pull request #7741 from DougGregor/sr-4056-3.1
[3.1] [Constraint solver] Dont assume orphans are along in the inactive list.
2 parents 5bdc52b + 54238c0 commit 7e1648c

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

lib/Sema/CSSolver.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2137,8 +2137,7 @@ bool ConstraintSystem::solveRec(SmallVectorImpl<Solution> &solutions,
21372137
}
21382138
} else {
21392139
// Get the orphaned constraint.
2140-
assert(InactiveConstraints.size() == 1 && "supposed to be an orphan!");
2141-
orphaned = &InactiveConstraints.front();
2140+
orphaned = allOrphanedConstraints[component - firstOrphanedConstraint];
21422141
}
21432142
CG.setOrphanedConstraint(orphaned);
21442143

test/Constraints/optional.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,21 @@ func rdar29977523(lhs: AnyObject?!, rhs: AnyObject?) {
176176

177177
calleeRdar29977523(lhs, rhs)
178178
}
179+
180+
// SR-4056
181+
protocol P1 { }
182+
183+
class C1: P1 { }
184+
185+
protocol P2 {
186+
var prop: C1? { get }
187+
}
188+
189+
class C2 {
190+
var p1: P1?
191+
var p2: P2?
192+
193+
var computed: P1? {
194+
return p1 ?? p2?.prop
195+
}
196+
}

0 commit comments

Comments
 (0)