Don't offer incorrect fixit for NSString? -> String? conversion.

Update the locator when matching optional types in parallel fashion.
This causes the simplifyLocator() call to fail to simplify the locator
completely, and avoids the bogus diagnostic.

<rdar://problem/19836341> Incorrect fixit for NSString? to String? conversions

Swift SVN r25596
This commit is contained in:
Chris Willmore
2015-02-27 05:30:11 +00:00
parent e7140012bf
commit 9910c75c67
2 changed files with 13 additions and 2 deletions

View File

@@ -3684,7 +3684,9 @@ ConstraintSystem::simplifyRestrictedConstraint(ConversionRestrictionKind restric
assert(generic2->getDecl()->classifyAsOptionalType());
return matchTypes(generic1->getGenericArgs()[0],
generic2->getGenericArgs()[0],
matchKind, subFlags, locator);
matchKind, subFlags,
locator.withPathElement(
LocatorPathElt::getGenericArgument(0)));
}
// T <c U ===> T! <c U
@@ -3705,7 +3707,9 @@ ConstraintSystem::simplifyRestrictedConstraint(ConversionRestrictionKind restric
Type valueType1 = boundGenericType1->getGenericArgs()[0];
increaseScore(SK_ForceUnchecked);
return matchTypes(valueType1, type2,
matchKind, subFlags, locator);
matchKind, subFlags,
locator.withPathElement(
LocatorPathElt::getGenericArgument(0)));
}
case ConversionRestrictionKind::ClassMetatypeToAnyObject: