mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Sema: NSValue-to-value-type casts are failable and should be checked.
In Swift 4 mode, no longer consider e.g. 'nsNumber as Int' or 'nsValue as NSRange' to be valid coercions. This would break compatibility with Swift 3, so in Swift 3 mode, accept the coercion, but *also* accept a checked cast without a warning, and raise a migration warning about the unchecked coercion.
This commit is contained in:
@@ -4114,8 +4114,10 @@ StringRef swift::getCheckedCastKindName(CheckedCastKind kind) {
|
||||
return "dictionary_downcast";
|
||||
case CheckedCastKind::SetDowncast:
|
||||
return "set_downcast";
|
||||
case CheckedCastKind::BridgingCast:
|
||||
return "bridging_cast";
|
||||
case CheckedCastKind::BridgingCoercion:
|
||||
return "bridging_coercion";
|
||||
case CheckedCastKind::Swift3BridgingDowncast:
|
||||
return "bridging_downcast";
|
||||
}
|
||||
llvm_unreachable("bad checked cast name");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user