mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
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:
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user