mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Reapply: Collapse the three optional-to-optional restriction kinds.
This reapply's Doug's changed79ba781c6, which had previously been applied on top of1efafbcd9b, the latter of which resulted in a source compatibility break.
This commit is contained in:
@@ -2009,13 +2009,13 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
|
||||
decl1 == TC.Context.getImplicitlyUnwrappedOptionalDecl()) {
|
||||
assert(boundGenericType1->getGenericArgs().size() == 1);
|
||||
conversionsOrFixes.push_back(
|
||||
ConversionRestrictionKind::ImplicitlyUnwrappedOptionalToOptional);
|
||||
ConversionRestrictionKind::OptionalToOptional);
|
||||
} else if (optionalKind2 == OTK_ImplicitlyUnwrappedOptional &&
|
||||
kind >= ConstraintKind::Conversion &&
|
||||
decl1 == TC.Context.getOptionalDecl()) {
|
||||
assert(boundGenericType1->getGenericArgs().size() == 1);
|
||||
conversionsOrFixes.push_back(
|
||||
ConversionRestrictionKind::OptionalToImplicitlyUnwrappedOptional);
|
||||
ConversionRestrictionKind::OptionalToOptional);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3818,8 +3818,6 @@ ConstraintSystem::simplifyRestrictedConstraintImpl(
|
||||
// T $< U ===> T! $< U?
|
||||
// also:
|
||||
// T <c U ===> T? <c U!
|
||||
case ConversionRestrictionKind::OptionalToImplicitlyUnwrappedOptional:
|
||||
case ConversionRestrictionKind::ImplicitlyUnwrappedOptionalToOptional:
|
||||
case ConversionRestrictionKind::OptionalToOptional: {
|
||||
addContextualScore();
|
||||
assert(matchKind >= ConstraintKind::Subtype);
|
||||
|
||||
Reference in New Issue
Block a user