mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[CS] Handle conditional requirements in existential conversions of literals.
This likely affects other things too, but literals are where it appears most. Previously, the mid-solving literal types like Array<$T0> were just checked for whether they conformed to the protocol, without acknowledging that this might introduce requirements on $T0, instead the conditional requirements were checked against $T0, and so failed (there's no reason that $T0 should satisfy the requirements at all, it's a recently-constructed transient type variable). Instead, capture the requirements and add them as constraints to the type variable. Fixes https://bugs.swift.org/browse/SR-7192 and rdar://problem/38461036 and improves https://bugs.swift.org/browse/SR-6941.
This commit is contained in:
@@ -2580,7 +2580,8 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyConformsToConstraint(
|
||||
case ConstraintKind::SelfObjectOfProtocol:
|
||||
if (auto conformance =
|
||||
TC.containsProtocol(type, protocol, DC,
|
||||
ConformanceCheckFlags::InExpression)) {
|
||||
(ConformanceCheckFlags::InExpression|
|
||||
ConformanceCheckFlags::SkipConditionalRequirements))) {
|
||||
return recordConformance(*conformance);
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user