Skip to content

Commit 82073f9

Browse files
authored
Merge pull request #7739 from DougGregor/sr-4056
2 parents 788c61b + 99a1396 commit 82073f9

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ int RequirementSource::compare(const RequirementSource *other) const {
343343

344344
void RequirementSource::dump() const {
345345
dump(llvm::errs(), nullptr, 0);
346+
llvm::errs() << "\n";
346347
}
347348

348349
/// Dump the constraint source.
@@ -351,7 +352,6 @@ void RequirementSource::dump(llvm::raw_ostream &out, SourceManager *srcMgr,
351352
// FIXME: Implement for real, so we actually dump the structure.
352353
out.indent(indent);
353354
print(out, srcMgr);
354-
out.flush();
355355
}
356356

357357
void RequirementSource::print() const {

lib/Sema/CSSolver.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2151,8 +2151,7 @@ bool ConstraintSystem::solveRec(SmallVectorImpl<Solution> &solutions,
21512151
}
21522152
} else {
21532153
// Get the orphaned constraint.
2154-
assert(InactiveConstraints.size() == 1 && "supposed to be an orphan!");
2155-
orphaned = &InactiveConstraints.front();
2154+
orphaned = allOrphanedConstraints[component - firstOrphanedConstraint];
21562155
}
21572156
CG.setOrphanedConstraint(orphaned);
21582157

test/Constraints/optional.swift

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

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

0 commit comments

Comments
 (0)