Skip to content

Commit d3b9d47

Browse files
committed
[Foundation] Apply tail style "where" clause to Foundation SDK overlay
1 parent 6401324 commit d3b9d47

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

stdlib/public/SDK/Foundation/Foundation.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,10 @@ internal func resolveError(_ error: NSError?) throws {
12391239
}
12401240

12411241
extension NSCoder {
1242-
public func decodeObjectOfClass<DecodedObjectType: NSCoding where DecodedObjectType: NSObject>(_ cls: DecodedObjectType.Type, forKey key: String) -> DecodedObjectType? {
1242+
public func decodeObjectOfClass<DecodedObjectType>(
1243+
_ cls: DecodedObjectType.Type, forKey key: String
1244+
) -> DecodedObjectType?
1245+
where DecodedObjectType : NSCoding, DecodedObjectType : NSObject {
12431246
let result = NS_Swift_NSCoder_decodeObjectOfClassForKey(self as AnyObject, cls as AnyObject, key as AnyObject, nil)
12441247
return result as! DecodedObjectType?
12451248
}
@@ -1273,7 +1276,10 @@ extension NSCoder {
12731276
}
12741277

12751278
@available(OSX 10.11, iOS 9.0, *)
1276-
public func decodeTopLevelObjectOfClass<DecodedObjectType: NSCoding where DecodedObjectType: NSObject>(_ cls: DecodedObjectType.Type, forKey key: String) throws -> DecodedObjectType? {
1279+
public func decodeTopLevelObjectOfClass<DecodedObjectType>(
1280+
_ cls: DecodedObjectType.Type, forKey key: String
1281+
) throws -> DecodedObjectType?
1282+
where DecodedObjectType : NSCoding, DecodedObjectType : NSObject {
12771283
var error: NSError?
12781284
let result = NS_Swift_NSCoder_decodeObjectOfClassForKey(self as AnyObject, cls as AnyObject, key as AnyObject, &error)
12791285
try resolveError(error)

stdlib/public/SDK/Foundation/NSError.swift

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,8 @@ public protocol __BridgedNSError : RawRepresentable, ErrorProtocol {
5959
}
6060

6161
// Allow two bridged NSError types to be compared.
62-
public func ==<T: __BridgedNSError where T.RawValue: SignedInteger>(
63-
lhs: T,
64-
rhs: T
65-
) -> Bool {
62+
public func ==<T: __BridgedNSError>(lhs: T, rhs: T ) -> Bool
63+
where T.RawValue: SignedInteger {
6664
return lhs.rawValue.toIntMax() == rhs.rawValue.toIntMax()
6765
}
6866

@@ -86,10 +84,8 @@ public extension __BridgedNSError where RawValue: SignedInteger {
8684
}
8785

8886
// Allow two bridged NSError types to be compared.
89-
public func ==<T: __BridgedNSError where T.RawValue: UnsignedInteger>(
90-
lhs: T,
91-
rhs: T
92-
) -> Bool {
87+
public func ==<T: __BridgedNSError>(lhs: T, rhs: T) -> Bool
88+
where T.RawValue: UnsignedInteger {
9389
return lhs.rawValue.toUIntMax() == rhs.rawValue.toUIntMax()
9490
}
9591

stdlib/public/SDK/Foundation/NSStringAPI.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -753,11 +753,9 @@ extension String {
753753

754754
/// Produces an initialized `NSString` object equivalent to the given
755755
/// `bytes` interpreted in the given `encoding`.
756-
public init? <
757-
S: Sequence where S.Iterator.Element == UInt8
758-
>(
759-
bytes: S, encoding: NSStringEncoding
760-
) {
756+
public init? <S: Sequence>(bytes: S, encoding: NSStringEncoding)
757+
where S.Iterator.Element == UInt8 {
758+
761759
let byteArray = Array(bytes)
762760
if let ns = NSString(
763761
bytes: byteArray, length: byteArray.count, encoding: encoding) {

0 commit comments

Comments
 (0)