mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Fix regression in implicit conversions of implicitly unwrapped optional AnyObject types to their contextual types. (rdar://problem/16922332)
Swift SVN r18203
This commit is contained in:
@@ -2651,6 +2651,18 @@ ConstraintSystem::simplifyBridgedToObjectiveCConstraint(const Constraint
|
||||
if (!baseTy)
|
||||
return SolutionKind::Unsolved;
|
||||
|
||||
if (baseTy->getClassOrBoundGenericClass()) {
|
||||
increaseScore(SK_UserConversion);
|
||||
return SolutionKind::Solved;
|
||||
}
|
||||
|
||||
if (auto archetype = baseTy->getAs<ArchetypeType>()) {
|
||||
if (archetype->requiresClass()) {
|
||||
increaseScore(SK_UserConversion);
|
||||
return SolutionKind::Solved;
|
||||
}
|
||||
}
|
||||
|
||||
if (auto bridgedType = TC.getBridgedToObjC(DC, baseTy).first) {
|
||||
return simplifyRestrictedConstraint(ConversionRestrictionKind::User,
|
||||
bridgedType,
|
||||
@@ -2660,14 +2672,6 @@ ConstraintSystem::simplifyBridgedToObjectiveCConstraint(const Constraint
|
||||
constraint.getLocator());
|
||||
}
|
||||
|
||||
if (baseTy->getClassOrBoundGenericClass())
|
||||
return SolutionKind::Solved;
|
||||
|
||||
if (auto archetype = baseTy->getAs<ArchetypeType>()) {
|
||||
if (archetype->requiresClass())
|
||||
return SolutionKind::Solved;
|
||||
}
|
||||
|
||||
// Record this failure.
|
||||
recordFailure(constraint.getLocator(),
|
||||
Failure::IsNotBridgedToObjectiveC,
|
||||
|
||||
Reference in New Issue
Block a user