Allow implicit conversion constraint to bridge String to NSString even

when it is the favored constraint of a disjunction.

This allows 'ns ?? "str" as String as String' to typecheck where ns is
an NSString. This does not regress the relevant test for 17962491.

<rdar://problem/20029786> Swift compiler sometimes suggests changing "as!" to "as?!"

Swift SVN r25910
This commit is contained in:
Chris Willmore
2015-03-10 03:45:53 +00:00
parent a4599cfc5d
commit 4b939eef89
2 changed files with 9 additions and 3 deletions

View File

@@ -1749,9 +1749,7 @@ ConstraintSystem::matchTypes(Type type1, Type type2, TypeMatchKind kind,
TC.Context.Id_CVarArgType;
}
if (isBridgeableTargetType && TC.getBridgedToObjC(DC, true, type1) &&
(kind == TypeMatchKind::ExplicitConversion ||
!HandlingFavoredConstraint)) {
if (isBridgeableTargetType && TC.getBridgedToObjC(DC, true, type1)) {
conversionsOrFixes.push_back(ConversionRestrictionKind::BridgeToObjC);
}
}