mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Sema] Add conditional requirements as CS constraints.
This tries to feed through the constraint system all the constraints implied by a concrete type satisfying a conformance requirement.
This commit is contained in:
@@ -2604,6 +2604,16 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyConformsToConstraint(
|
||||
ConformanceCheckFlags::InExpression)) {
|
||||
CheckedConformances.push_back({getConstraintLocator(locator),
|
||||
*conformance});
|
||||
|
||||
// This conformance may be conditional, in which case we need to consider
|
||||
// those requirements as constraints too.
|
||||
//
|
||||
// FIXME: this doesn't seem to be right; the requirements are sometimes
|
||||
// phrased in terms of the type's generic parameters, not type variables
|
||||
// in this context.
|
||||
for (auto req : conformance->getConditionalRequirements()) {
|
||||
addConstraint(req, locator);
|
||||
}
|
||||
return SolutionKind::Solved;
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user