fix <rdar://problem/21244068> QoI: IUO prevents specific diagnostic + fixit about non-implicitly converted bridge types

Swift SVN r29910
This commit is contained in:
Chris Lattner
2015-07-03 22:31:29 +00:00
parent 3a750fb3c9
commit ca8cb3d19d
2 changed files with 12 additions and 1 deletions

View File

@@ -2040,9 +2040,14 @@ commit_to_conversions:
conversionsOrFixes.push_back(Fix::getForcedDowncast(*this, type2));
}
// Look through IUO's.
auto type1WithoutIUO = objectType1;
if (auto elt = type1WithoutIUO->getImplicitlyUnwrappedOptionalObjectType())
type1WithoutIUO = elt;
// If we could perform a bridging cast, try it.
if (isArrayDictionarySetOrString(TC.Context, type2) &&
TC.getDynamicBridgedThroughObjCClass(DC, true, objectType1, type2)) {
TC.getDynamicBridgedThroughObjCClass(DC, true, type1WithoutIUO, type2)){
conversionsOrFixes.push_back(Fix::getForcedDowncast(*this, type2));
}