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:
Joe Groff
2017-01-09 17:02:05 -08:00
parent 5c0afe93bc
commit c03371afc1
15 changed files with 545 additions and 139 deletions

View File

@@ -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");
}