mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
<rdar://problem/19031957> Change failable casts from "as" to "as!"
Previously the "as" keyword could either represent coercion or or forced downcasting. This change separates the two notions. "as" now only means type conversion, while the new "as!" operator is used to perform forced downcasting. If a program uses "as" where "as!" is called for, we emit a diagnostic and fixit. Internally, this change removes the UnresolvedCheckedCastExpr class, in favor of directly instantiating CoerceExpr when parsing the "as" operator, and ForcedCheckedCastExpr when parsing the "as!" operator. Swift SVN r24253
This commit is contained in:
@@ -1044,7 +1044,7 @@ extension String {
|
||||
/// Returns an array of NSString objects containing, in
|
||||
/// order, each path component of the `String`.
|
||||
public var pathComponents: [String] {
|
||||
return _ns.pathComponents as [String]
|
||||
return _ns.pathComponents as! [String]
|
||||
}
|
||||
|
||||
// @property NSString* pathExtension;
|
||||
@@ -1086,7 +1086,7 @@ extension String {
|
||||
/// values found in the `String`.
|
||||
public
|
||||
func propertyListFromStringsFileFormat() -> [String : String] {
|
||||
return _ns.propertyListFromStringsFileFormat() as [String : String]
|
||||
return _ns.propertyListFromStringsFileFormat() as! [String : String]
|
||||
}
|
||||
|
||||
// - (NSRange)rangeOfCharacterFromSet:(NSCharacterSet *)aSet
|
||||
@@ -1413,7 +1413,7 @@ extension String {
|
||||
/// Returns an array of strings made by separately appending
|
||||
/// to the `String` each string in in a given array.
|
||||
public func stringsByAppendingPaths(paths: [String]) -> [String] {
|
||||
return _ns.stringsByAppendingPaths(paths) as [String]
|
||||
return _ns.stringsByAppendingPaths(paths) as! [String]
|
||||
}
|
||||
|
||||
// - (NSString *)substringFromIndex:(NSUInteger)anIndex
|
||||
|
||||
Reference in New Issue
Block a user