mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Only permit checked downcasts of an existential to a subtype,
not to an arbitrary type that's convertible to the existential. Arbitrary conversions aren't necessarily reversible. The specific test case in rdar://16041990 involves a downcast to String instead of NSString; that's supportable in principle, but it's at the very least a significant feature, and clearly there are non-reversible conversions out there. Swift SVN r14028
This commit is contained in:
@@ -1288,7 +1288,7 @@ ConstraintSystem::simplifyCheckedCastConstraint(
|
||||
return SolutionKind::Solved;
|
||||
|
||||
case CheckedCastKind::ExistentialToConcrete:
|
||||
addConstraint(ConstraintKind::Conversion, toType, fromType);
|
||||
addConstraint(ConstraintKind::Subtype, toType, fromType);
|
||||
return SolutionKind::Solved;
|
||||
|
||||
case CheckedCastKind::Coercion:
|
||||
|
||||
Reference in New Issue
Block a user