remove the Failure::IsNotOptional failure mode, as CSDiags does a better job

of providing contextual diagnostics (e.g. producing the warning in 
Constraints/dynamic_lookup.swift).  This drops a specific diagnostic about
force casting the result of as! which was added in the Swift 1.2 timeframe
to explain the change in cast semantics.  Now that as! has been around for
a long time, it is more confusing than helpful.



Swift SVN r31887
This commit is contained in:
Chris Lattner
2015-09-11 04:40:13 +00:00
parent ebe67f30ea
commit f8c6e46e03
8 changed files with 15 additions and 59 deletions

View File

@@ -2570,16 +2570,12 @@ ConstraintSystem::simplifyOptionalObjectConstraint(const Constraint &constraint)
// If the base type is not optional, the constraint fails.
Type objectTy = optTy->getAnyOptionalObjectType();
if (!objectTy) {
recordFailure(constraint.getLocator(), Failure::IsNotOptional,
optTy);
if (!objectTy)
return SolutionKind::Error;
}
// The object type is an lvalue if the optional was.
if (optLValueTy->is<LValueType>()) {
if (optLValueTy->is<LValueType>())
objectTy = LValueType::get(objectTy);
}
// Equate it to the other type in the constraint.
addConstraint(ConstraintKind::Bind, objectTy, constraint.getSecondType(),