Skip to content

Commit e49beda

Browse files
authoredSep 24, 2018
Merge pull request #1696 from mikeash/rename-conflicting-classes-and-methods
Rename various ObjC-visible classes
2 parents 771f525 + 9d5e279 commit e49beda

26 files changed

+161
-161
lines changed
 

‎Foundation/Array.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ extension Array : _ObjectiveCBridgeable {
1212
public typealias _ObjectType = NSArray
1313
public func _bridgeToObjectiveC() -> _ObjectType {
1414
return NSArray(array: map { (element: Element) -> AnyObject in
15-
return _SwiftValue.store(element)
15+
return __SwiftValue.store(element)
1616
})
1717
}
1818

‎Foundation/Bridging.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ internal protocol _NSBridgeable {
7070

7171
#if !canImport(ObjectiveC)
7272
// The _NSSwiftValue protocol is in the stdlib, and only available on platforms without ObjC.
73-
extension _SwiftValue: _NSSwiftValue {}
73+
extension __SwiftValue: _NSSwiftValue {}
7474
#endif
7575

7676
/// - Note: This is an internal boxing value for containing abstract structures
77-
internal final class _SwiftValue : NSObject, NSCopying {
77+
internal final class __SwiftValue : NSObject, NSCopying {
7878
public private(set) var value: Any
7979

8080
static func fetch(_ object: AnyObject?) -> Any? {
@@ -115,7 +115,7 @@ internal final class _SwiftValue : NSObject, NSCopying {
115115
return type
116116
}
117117

118-
let name = "_SwiftValue"
118+
let name = "__SwiftValue"
119119
let maybeType = name.withCString { cString in
120120
return objc_getClass(cString)
121121
}
@@ -135,7 +135,7 @@ internal final class _SwiftValue : NSObject, NSCopying {
135135
// You can pass the result of a `as AnyObject` expression to this method. This can have one of three results on Darwin:
136136
// - It's a SwiftFoundation type. Bridging will take care of it below.
137137
// - It's nil. The compiler is hardcoded to return [NSNull null] for nils.
138-
// - It's some other Swift type. The compiler will box it in a native _SwiftValue.
138+
// - It's some other Swift type. The compiler will box it in a native __SwiftValue.
139139
// Case 1 is handled below.
140140
// Case 2 is handled here:
141141
if type(of: object as Any) == objCNSNullClass {
@@ -145,20 +145,20 @@ internal final class _SwiftValue : NSObject, NSCopying {
145145
if type(of: object as Any) == swiftStdlibSwiftValueClass {
146146
return object
147147
// Since this returns Any, the object is casted almost immediately — e.g.:
148-
// _SwiftValue.fetch(x) as SomeStruct
148+
// __SwiftValue.fetch(x) as SomeStruct
149149
// which will immediately unbox the native box. For callers, it will be exactly
150150
// as if we returned the unboxed value directly.
151151
}
152152

153153
// On Linux, case 2 is handled by the stdlib bridging machinery, and case 3 can't happen —
154-
// the compiler will produce SwiftFoundation._SwiftValue boxes rather than ObjC ones.
154+
// the compiler will produce SwiftFoundation.__SwiftValue boxes rather than ObjC ones.
155155
#endif
156156

157157
if object === kCFBooleanTrue {
158158
return true
159159
} else if object === kCFBooleanFalse {
160160
return false
161-
} else if let container = object as? _SwiftValue {
161+
} else if let container = object as? __SwiftValue {
162162
return container.value
163163
} else if let val = object as? _StructBridgeable {
164164
return val._bridgeToAny()
@@ -188,10 +188,10 @@ internal final class _SwiftValue : NSObject, NSCopying {
188188
return NSNull()
189189
} else {
190190
#if canImport(ObjectiveC)
191-
// On Darwin, this can be a native (ObjC) _SwiftValue.
191+
// On Darwin, this can be a native (ObjC) __SwiftValue.
192192
let boxed = (value as AnyObject)
193193
if !(boxed is NSObject) {
194-
return _SwiftValue(value) // Do not emit native boxes — wrap them in Swift Foundation boxes instead.
194+
return __SwiftValue(value) // Do not emit native boxes — wrap them in Swift Foundation boxes instead.
195195
} else {
196196
return boxed as! NSObject
197197
}
@@ -214,7 +214,7 @@ internal final class _SwiftValue : NSObject, NSCopying {
214214

215215
override func isEqual(_ value: Any?) -> Bool {
216216
switch value {
217-
case let other as _SwiftValue:
217+
case let other as __SwiftValue:
218218
guard let left = other.value as? AnyHashable,
219219
let right = self.value as? AnyHashable else { return self === other }
220220

@@ -228,7 +228,7 @@ internal final class _SwiftValue : NSObject, NSCopying {
228228
}
229229

230230
public func copy(with zone: NSZone?) -> Any {
231-
return _SwiftValue(value)
231+
return __SwiftValue(value)
232232
}
233233

234234
public static let null: AnyObject = NSNull()

‎Foundation/Bundle.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,12 @@ open class Bundle: NSObject {
276276

277277
open var infoDictionary: [String : Any]? {
278278
let cfDict: CFDictionary? = CFBundleGetInfoDictionary(_bundle)
279-
return _SwiftValue.fetch(cfDict) as? [String : Any]
279+
return __SwiftValue.fetch(cfDict) as? [String : Any]
280280
}
281281

282282
open var localizedInfoDictionary: [String : Any]? {
283283
let cfDict: CFDictionary? = CFBundleGetLocalInfoDictionary(_bundle)
284-
return _SwiftValue.fetch(cfDict) as? [String : Any]
284+
return __SwiftValue.fetch(cfDict) as? [String : Any]
285285
}
286286

287287
open func object(forInfoDictionaryKey key: String) -> Any? {
@@ -299,7 +299,7 @@ open class Bundle: NSObject {
299299
}
300300
open var localizations: [String] {
301301
let cfLocalizations: CFArray? = CFBundleCopyBundleLocalizations(_bundle)
302-
let nsLocalizations = _SwiftValue.fetch(cfLocalizations) as? [Any]
302+
let nsLocalizations = __SwiftValue.fetch(cfLocalizations) as? [Any]
303303
return nsLocalizations?.map { $0 as! String } ?? []
304304
}
305305

@@ -310,7 +310,7 @@ open class Bundle: NSObject {
310310

311311
open class func preferredLocalizations(from localizationsArray: [String]) -> [String] {
312312
let cfLocalizations: CFArray? = CFBundleCopyPreferredLocalizationsFromArray(localizationsArray._cfObject)
313-
let nsLocalizations = _SwiftValue.fetch(cfLocalizations) as? [Any]
313+
let nsLocalizations = __SwiftValue.fetch(cfLocalizations) as? [Any]
314314
return nsLocalizations?.map { $0 as! String } ?? []
315315
}
316316

‎Foundation/Data.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -908,20 +908,20 @@ public final class _DataStorage {
908908

909909
switch _backing {
910910
case .swift:
911-
return _NSSwiftData(backing: self, range: range)
911+
return __NSSwiftData(backing: self, range: range)
912912
case .immutable(let d):
913913
guard range.lowerBound == 0 && range.upperBound == _length else {
914-
return _NSSwiftData(backing: self, range: range)
914+
return __NSSwiftData(backing: self, range: range)
915915
}
916916
return d
917917
case .mutable(let d):
918918
guard range.lowerBound == 0 && range.upperBound == _length else {
919-
return _NSSwiftData(backing: self, range: range)
919+
return __NSSwiftData(backing: self, range: range)
920920
}
921921
return d
922922
case .customReference(let d):
923923
guard range.lowerBound == 0 && range.upperBound == d.length else {
924-
return _NSSwiftData(backing: self, range: range)
924+
return __NSSwiftData(backing: self, range: range)
925925
}
926926
return d
927927
case .customMutableReference(let d):
@@ -944,7 +944,7 @@ public final class _DataStorage {
944944
}
945945
}
946946

947-
internal class _NSSwiftData : NSData {
947+
internal class __NSSwiftData : NSData {
948948
var _backing: _DataStorage!
949949
var _range: Range<Data.Index>!
950950

‎Foundation/Dictionary.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ extension Dictionary : _ObjectiveCBridgeable {
1919
var idx = 0
2020

2121
self.forEach { (keyItem, valueItem) in
22-
let key = _SwiftValue.store(keyItem)
23-
let value = _SwiftValue.store(valueItem)
22+
let key = __SwiftValue.store(keyItem)
23+
let value = __SwiftValue.store(valueItem)
2424
keyBuffer.advanced(by: idx).initialize(to: key)
2525
valueBuffer.advanced(by: idx).initialize(to: value)
2626
idx += 1
@@ -65,8 +65,8 @@ extension Dictionary : _ObjectiveCBridgeable {
6565
CFDictionaryGetKeysAndValues(cf, keys, values)
6666

6767
for idx in 0..<cnt {
68-
let key = _SwiftValue.fetch(nonOptional: unsafeBitCast(keys.advanced(by: idx).pointee!, to: AnyObject.self))
69-
let value = _SwiftValue.fetch(nonOptional: unsafeBitCast(values.advanced(by: idx).pointee!, to: AnyObject.self))
68+
let key = __SwiftValue.fetch(nonOptional: unsafeBitCast(keys.advanced(by: idx).pointee!, to: AnyObject.self))
69+
let value = __SwiftValue.fetch(nonOptional: unsafeBitCast(values.advanced(by: idx).pointee!, to: AnyObject.self))
7070
guard let k = key as? Key, let v = value as? Value else {
7171
failedConversion = true
7272
break

‎Foundation/HTTPCookieStorage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ open class HTTPCookieStorage: NSObject {
216216
persistDictionary[key] = cookie.persistableDictionary()
217217
}
218218

219-
let nsdict = _SwiftValue.store(persistDictionary) as! NSDictionary
219+
let nsdict = __SwiftValue.store(persistDictionary) as! NSDictionary
220220
_ = nsdict.write(toFile: cookieFilePath, atomically: true)
221221
}
222222

‎Foundation/JSONEncoder.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2010,7 +2010,7 @@ extension _JSONDecoder {
20102010

20112011
#if DEPLOYMENT_RUNTIME_SWIFT
20122012
// Bridging differences require us to split implementations here
2013-
guard let number = _SwiftValue.store(value) as? NSNumber else {
2013+
guard let number = __SwiftValue.store(value) as? NSNumber else {
20142014
throw DecodingError._typeMismatch(at: self.codingPath, expectation: type, reality: value)
20152015
}
20162016

@@ -2043,7 +2043,7 @@ extension _JSONDecoder {
20432043
fileprivate func unbox(_ value: Any, as type: Int.Type) throws -> Int? {
20442044
guard !(value is NSNull) else { return nil }
20452045

2046-
guard let number = _SwiftValue.store(value) as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse else {
2046+
guard let number = __SwiftValue.store(value) as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse else {
20472047
throw DecodingError._typeMismatch(at: self.codingPath, expectation: type, reality: value)
20482048
}
20492049

@@ -2058,7 +2058,7 @@ extension _JSONDecoder {
20582058
fileprivate func unbox(_ value: Any, as type: Int8.Type) throws -> Int8? {
20592059
guard !(value is NSNull) else { return nil }
20602060

2061-
guard let number = _SwiftValue.store(value) as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse else {
2061+
guard let number = __SwiftValue.store(value) as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse else {
20622062
throw DecodingError._typeMismatch(at: self.codingPath, expectation: type, reality: value)
20632063
}
20642064

@@ -2073,7 +2073,7 @@ extension _JSONDecoder {
20732073
fileprivate func unbox(_ value: Any, as type: Int16.Type) throws -> Int16? {
20742074
guard !(value is NSNull) else { return nil }
20752075

2076-
guard let number = _SwiftValue.store(value) as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse else {
2076+
guard let number = __SwiftValue.store(value) as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse else {
20772077
throw DecodingError._typeMismatch(at: self.codingPath, expectation: type, reality: value)
20782078
}
20792079

@@ -2088,7 +2088,7 @@ extension _JSONDecoder {
20882088
fileprivate func unbox(_ value: Any, as type: Int32.Type) throws -> Int32? {
20892089
guard !(value is NSNull) else { return nil }
20902090

2091-
guard let number = _SwiftValue.store(value) as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse else {
2091+
guard let number = __SwiftValue.store(value) as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse else {
20922092
throw DecodingError._typeMismatch(at: self.codingPath, expectation: type, reality: value)
20932093
}
20942094

@@ -2103,7 +2103,7 @@ extension _JSONDecoder {
21032103
fileprivate func unbox(_ value: Any, as type: Int64.Type) throws -> Int64? {
21042104
guard !(value is NSNull) else { return nil }
21052105

2106-
guard let number = _SwiftValue.store(value) as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse else {
2106+
guard let number = __SwiftValue.store(value) as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse else {
21072107
throw DecodingError._typeMismatch(at: self.codingPath, expectation: type, reality: value)
21082108
}
21092109

@@ -2118,7 +2118,7 @@ extension _JSONDecoder {
21182118
fileprivate func unbox(_ value: Any, as type: UInt.Type) throws -> UInt? {
21192119
guard !(value is NSNull) else { return nil }
21202120

2121-
guard let number = _SwiftValue.store(value) as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse else {
2121+
guard let number = __SwiftValue.store(value) as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse else {
21222122
throw DecodingError._typeMismatch(at: self.codingPath, expectation: type, reality: value)
21232123
}
21242124

@@ -2133,7 +2133,7 @@ extension _JSONDecoder {
21332133
fileprivate func unbox(_ value: Any, as type: UInt8.Type) throws -> UInt8? {
21342134
guard !(value is NSNull) else { return nil }
21352135

2136-
guard let number = _SwiftValue.store(value) as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse else {
2136+
guard let number = __SwiftValue.store(value) as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse else {
21372137
throw DecodingError._typeMismatch(at: self.codingPath, expectation: type, reality: value)
21382138
}
21392139

@@ -2148,7 +2148,7 @@ extension _JSONDecoder {
21482148
fileprivate func unbox(_ value: Any, as type: UInt16.Type) throws -> UInt16? {
21492149
guard !(value is NSNull) else { return nil }
21502150

2151-
guard let number = _SwiftValue.store(value) as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse else {
2151+
guard let number = __SwiftValue.store(value) as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse else {
21522152
throw DecodingError._typeMismatch(at: self.codingPath, expectation: type, reality: value)
21532153
}
21542154

@@ -2163,7 +2163,7 @@ extension _JSONDecoder {
21632163
fileprivate func unbox(_ value: Any, as type: UInt32.Type) throws -> UInt32? {
21642164
guard !(value is NSNull) else { return nil }
21652165

2166-
guard let number = _SwiftValue.store(value) as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse else {
2166+
guard let number = __SwiftValue.store(value) as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse else {
21672167
throw DecodingError._typeMismatch(at: self.codingPath, expectation: type, reality: value)
21682168
}
21692169

@@ -2178,7 +2178,7 @@ extension _JSONDecoder {
21782178
fileprivate func unbox(_ value: Any, as type: UInt64.Type) throws -> UInt64? {
21792179
guard !(value is NSNull) else { return nil }
21802180

2181-
guard let number = _SwiftValue.store(value) as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse else {
2181+
guard let number = __SwiftValue.store(value) as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse else {
21822182
throw DecodingError._typeMismatch(at: self.codingPath, expectation: type, reality: value)
21832183
}
21842184

@@ -2193,7 +2193,7 @@ extension _JSONDecoder {
21932193
fileprivate func unbox(_ value: Any, as type: Float.Type) throws -> Float? {
21942194
guard !(value is NSNull) else { return nil }
21952195

2196-
if let number = _SwiftValue.store(value) as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse {
2196+
if let number = __SwiftValue.store(value) as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse {
21972197
// We are willing to return a Float by losing precision:
21982198
// * If the original value was integral,
21992199
// * and the integral value was > Float.greatestFiniteMagnitude, we will fail
@@ -2238,7 +2238,7 @@ extension _JSONDecoder {
22382238
fileprivate func unbox(_ value: Any, as type: Double.Type) throws -> Double? {
22392239
guard !(value is NSNull) else { return nil }
22402240

2241-
if let number = _SwiftValue.store(value) as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse {
2241+
if let number = __SwiftValue.store(value) as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse {
22422242
// We are always willing to return the number as a Double:
22432243
// * If the original value was integral, it is guaranteed to fit in a Double; we are willing to lose precision past 2^53 if you encoded a UInt64 but requested a Double
22442244
// * If it was a Float or Double, you will get back the precise value

‎Foundation/JSONSerialization.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ open class JSONSerialization : NSObject {
104104

105105
// object is NSNumber and is not NaN or infinity
106106
// For better performance, this (most expensive) test should be last.
107-
if let number = _SwiftValue.store(obj) as? NSNumber {
107+
if let number = __SwiftValue.store(obj) as? NSNumber {
108108
if CFNumberIsFloatType(number._cfObject) {
109109
let dv = number.doubleValue
110110
let invalid = dv.isInfinite || dv.isNaN
@@ -369,8 +369,8 @@ private struct JSONWriter {
369369
writer(num.description)
370370
case is NSNull:
371371
try serializeNull()
372-
case _ where _SwiftValue.store(obj) is NSNumber:
373-
try serializeNumber(_SwiftValue.store(obj) as! NSNumber)
372+
case _ where __SwiftValue.store(obj) is NSNumber:
373+
try serializeNumber(__SwiftValue.store(obj) as! NSNumber)
374374
default:
375375
throw NSError(domain: NSCocoaErrorDomain, code: CocoaError.propertyListReadCorrupt.rawValue, userInfo: ["NSDebugDescription" : "Invalid object cannot be serialized"])
376376
}

‎Foundation/NSArray.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ open class NSArray : NSObject, NSCopying, NSMutableCopying, NSSecureCoding, NSCo
2424
guard type(of: self) === NSArray.self || type(of: self) === NSMutableArray.self else {
2525
NSRequiresConcreteImplementation()
2626
}
27-
return _SwiftValue.fetch(nonOptional: _storage[index])
27+
return __SwiftValue.fetch(nonOptional: _storage[index])
2828
}
2929

3030
public override init() {
@@ -136,8 +136,8 @@ open class NSArray : NSObject, NSCopying, NSMutableCopying, NSSecureCoding, NSCo
136136

137137
let optionalArray : [AnyObject] =
138138
copyItems ?
139-
array.map { return _SwiftValue.store($0).copy() as! NSObject } :
140-
array.map { return _SwiftValue.store($0) }
139+
array.map { return __SwiftValue.store($0).copy() as! NSObject } :
140+
array.map { return __SwiftValue.store($0) }
141141

142142
// This would have been nice, but "initializer delegation cannot be nested in another expression"
143143
// optionalArray.withUnsafeBufferPointer { ptr in
@@ -168,7 +168,7 @@ open class NSArray : NSObject, NSCopying, NSMutableCopying, NSSecureCoding, NSCo
168168

169169
internal var allObjects: [Any] {
170170
if type(of: self) === NSArray.self || type(of: self) === NSMutableArray.self {
171-
return _storage.map { _SwiftValue.fetch(nonOptional: $0) }
171+
return _storage.map { __SwiftValue.fetch(nonOptional: $0) }
172172
} else {
173173
return (0..<count).map { idx in
174174
return self[idx]
@@ -245,12 +245,12 @@ open class NSArray : NSObject, NSCopying, NSMutableCopying, NSSecureCoding, NSCo
245245
}
246246

247247
open func firstObjectCommon(with otherArray: [Any]) -> Any? {
248-
let set = otherArray.map { _SwiftValue.store($0) }
248+
let set = otherArray.map { __SwiftValue.store($0) }
249249

250250
for idx in 0..<count {
251-
let item = _SwiftValue.store(self[idx])
251+
let item = __SwiftValue.store(self[idx])
252252
if set.contains(item) {
253-
return _SwiftValue.fetch(nonOptional: item)
253+
return __SwiftValue.fetch(nonOptional: item)
254254
}
255255
}
256256
return nil
@@ -260,7 +260,7 @@ open class NSArray : NSObject, NSCopying, NSMutableCopying, NSSecureCoding, NSCo
260260
objects.reserveCapacity(objects.count + range.length)
261261

262262
if type(of: self) === NSArray.self || type(of: self) === NSMutableArray.self {
263-
objects += _storage[Range(range)!].map { _SwiftValue.fetch(nonOptional: $0) }
263+
objects += _storage[Range(range)!].map { __SwiftValue.fetch(nonOptional: $0) }
264264
return
265265
}
266266

@@ -337,7 +337,7 @@ open class NSArray : NSObject, NSCopying, NSMutableCopying, NSSecureCoding, NSCo
337337
} else {
338338
let val1 = object(at: idx)
339339
let val2 = otherArray[idx]
340-
if !_SwiftValue.store(val1).isEqual(_SwiftValue.store(val2)) {
340+
if !__SwiftValue.store(val1).isEqual(__SwiftValue.store(val2)) {
341341
return false
342342
}
343343
}
@@ -731,7 +731,7 @@ open class NSMutableArray : NSArray {
731731
guard type(of: self) === NSMutableArray.self else {
732732
NSRequiresConcreteImplementation()
733733
}
734-
_storage.insert(_SwiftValue.store(anObject), at: index)
734+
_storage.insert(__SwiftValue.store(anObject), at: index)
735735
}
736736

737737
open func insert(_ objects: [Any], at indexes: IndexSet) {
@@ -767,7 +767,7 @@ open class NSMutableArray : NSArray {
767767
}
768768
let min = index
769769
let max = index + 1
770-
_storage.replaceSubrange(min..<max, with: [_SwiftValue.store(anObject) as AnyObject])
770+
_storage.replaceSubrange(min..<max, with: [__SwiftValue.store(anObject) as AnyObject])
771771
}
772772

773773
public override init() {
@@ -804,7 +804,7 @@ open class NSMutableArray : NSArray {
804804

805805
open func addObjects(from otherArray: [Any]) {
806806
if type(of: self) === NSMutableArray.self {
807-
_storage += otherArray.map { _SwiftValue.store($0) as AnyObject }
807+
_storage += otherArray.map { __SwiftValue.store($0) as AnyObject }
808808
} else {
809809
for obj in otherArray {
810810
add(obj)
@@ -888,10 +888,10 @@ open class NSMutableArray : NSArray {
888888
if type(of: self) === NSMutableArray.self {
889889
_storage.reserveCapacity(count - range.length + otherArray.count)
890890
for idx in 0..<range.length {
891-
_storage[idx + range.location] = _SwiftValue.store(otherArray[idx])
891+
_storage[idx + range.location] = __SwiftValue.store(otherArray[idx])
892892
}
893893
for idx in range.length..<otherArray.count {
894-
_storage.insert(_SwiftValue.store(otherArray[idx]), at: idx + range.location)
894+
_storage.insert(__SwiftValue.store(otherArray[idx]), at: idx + range.location)
895895
}
896896
} else {
897897
NSUnimplemented()
@@ -900,7 +900,7 @@ open class NSMutableArray : NSArray {
900900

901901
open func setArray(_ otherArray: [Any]) {
902902
if type(of: self) === NSMutableArray.self {
903-
_storage = otherArray.map { _SwiftValue.store($0) }
903+
_storage = otherArray.map { __SwiftValue.store($0) }
904904
} else {
905905
replaceObjects(in: NSRange(location: 0, length: count), withObjectsFrom: otherArray)
906906
}

‎Foundation/NSAttributedString.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ open class NSMutableAttributedString : NSAttributedString {
342342
}
343343

344344
open func addAttribute(_ name: NSAttributedStringKey, value: Any, range: NSRange) {
345-
CFAttributedStringSetAttribute(_cfMutableObject, CFRange(range), name.rawValue._cfObject, _SwiftValue.store(value))
345+
CFAttributedStringSetAttribute(_cfMutableObject, CFRange(range), name.rawValue._cfObject, __SwiftValue.store(value))
346346
}
347347

348348
open func addAttributes(_ attrs: [NSAttributedStringKey : Any], range: NSRange) {

‎Foundation/NSCFArray.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ internal final class _NSCFArray : NSMutableArray {
3434

3535
override func object(at index: Int) -> Any {
3636
let value = CFArrayGetValueAtIndex(_cfObject, index)
37-
return _SwiftValue.fetch(nonOptional: unsafeBitCast(value, to: AnyObject.self))
37+
return __SwiftValue.fetch(nonOptional: unsafeBitCast(value, to: AnyObject.self))
3838
}
3939

4040
override func insert(_ value: Any, at index: Int) {
41-
let anObject = _SwiftValue.store(value)
41+
let anObject = __SwiftValue.store(value)
4242
CFArrayInsertValueAtIndex(_cfMutableObject, index, unsafeBitCast(anObject, to: UnsafeRawPointer.self))
4343
}
4444

@@ -60,7 +60,7 @@ internal func _CFSwiftArrayGetValueAtIndex(_ array: AnyObject, _ index: CFIndex)
6060
if type(of: array) === NSArray.self || type(of: array) === NSMutableArray.self {
6161
return Unmanaged.passUnretained(arr._storage[index])
6262
} else {
63-
let value = _SwiftValue.store(arr.object(at: index))
63+
let value = __SwiftValue.store(arr.object(at: index))
6464
let container: NSMutableDictionary
6565
if arr._storage.isEmpty {
6666
container = NSMutableDictionary()
@@ -82,7 +82,7 @@ internal func _CFSwiftArrayGetValues(_ array: AnyObject, _ range: CFRange, _ val
8282
} else {
8383
for idx in 0..<range.length {
8484
let index = idx + range.location
85-
let value = _SwiftValue.store(arr.object(at: index))
85+
let value = __SwiftValue.store(arr.object(at: index))
8686
let container: NSMutableDictionary
8787
if arr._storage.isEmpty {
8888
container = NSMutableDictionary()

‎Foundation/NSCFDictionary.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ internal final class _NSCFDictionary : NSMutableDictionary {
3737
}
3838

3939
override func object(forKey aKey: Any) -> Any? {
40-
let value = CFDictionaryGetValue(_cfObject, unsafeBitCast(_SwiftValue.store(aKey), to: UnsafeRawPointer.self))
40+
let value = CFDictionaryGetValue(_cfObject, unsafeBitCast(__SwiftValue.store(aKey), to: UnsafeRawPointer.self))
4141
if value != nil {
42-
return _SwiftValue.fetch(nonOptional: unsafeBitCast(value, to: AnyObject.self))
42+
return __SwiftValue.fetch(nonOptional: unsafeBitCast(value, to: AnyObject.self))
4343
} else {
4444
return nil
4545
}
@@ -81,11 +81,11 @@ internal final class _NSCFDictionary : NSMutableDictionary {
8181
}
8282

8383
override func removeObject(forKey aKey: Any) {
84-
CFDictionaryRemoveValue(_cfMutableObject, unsafeBitCast(_SwiftValue.store(aKey), to: UnsafeRawPointer.self))
84+
CFDictionaryRemoveValue(_cfMutableObject, unsafeBitCast(__SwiftValue.store(aKey), to: UnsafeRawPointer.self))
8585
}
8686

8787
override func setObject(_ anObject: Any, forKey aKey: AnyHashable) {
88-
CFDictionarySetValue(_cfMutableObject, unsafeBitCast(_SwiftValue.store(aKey), to: UnsafeRawPointer.self), unsafeBitCast(_SwiftValue.store(anObject), to: UnsafeRawPointer.self))
88+
CFDictionarySetValue(_cfMutableObject, unsafeBitCast(__SwiftValue.store(aKey), to: UnsafeRawPointer.self), unsafeBitCast(__SwiftValue.store(anObject), to: UnsafeRawPointer.self))
8989
}
9090

9191
override var classForCoder: AnyClass {
@@ -117,9 +117,9 @@ internal func _CFSwiftDictionaryGetValue(_ dictionary: AnyObject, key: AnyObject
117117
return Unmanaged<AnyObject>.passUnretained(obj)
118118
}
119119
} else {
120-
let k = _SwiftValue.fetch(nonOptional: key)
120+
let k = __SwiftValue.fetch(nonOptional: key)
121121
let value = dict.object(forKey: k)
122-
let v = _SwiftValue.store(value)
122+
let v = __SwiftValue.store(value)
123123
dict._storage[key as! NSObject] = v
124124
if let obj = v {
125125
return Unmanaged<AnyObject>.passUnretained(obj)
@@ -178,8 +178,8 @@ internal func _CFSwiftDictionaryGetValuesAndKeys(_ dictionary: AnyObject, valueb
178178
}
179179
} else {
180180
dict.enumerateKeysAndObjects(options: []) { k, v, _ in
181-
let key = _SwiftValue.store(k)
182-
let value = _SwiftValue.store(v)
181+
let key = __SwiftValue.store(k)
182+
let value = __SwiftValue.store(v)
183183
valuebuf?[idx] = Unmanaged<AnyObject>.passUnretained(value)
184184
keybuf?[idx] = Unmanaged<AnyObject>.passUnretained(key)
185185
dict._storage[key] = value
@@ -190,7 +190,7 @@ internal func _CFSwiftDictionaryGetValuesAndKeys(_ dictionary: AnyObject, valueb
190190

191191
internal func _CFSwiftDictionaryApplyFunction(_ dictionary: AnyObject, applier: @convention(c) (AnyObject, AnyObject, UnsafeMutableRawPointer) -> Void, context: UnsafeMutableRawPointer) {
192192
(dictionary as! NSDictionary).enumerateKeysAndObjects(options: []) { key, value, _ in
193-
applier(_SwiftValue.store(key), _SwiftValue.store(value), context)
193+
applier(__SwiftValue.store(key), __SwiftValue.store(value), context)
194194
}
195195
}
196196

‎Foundation/NSCFSet.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ internal final class _NSCFSet : NSMutableSet {
3838

3939
override func member(_ object: Any) -> Any? {
4040

41-
guard let value = CFSetGetValue(_cfObject, unsafeBitCast(_SwiftValue.store(object), to: UnsafeRawPointer.self)) else {
41+
guard let value = CFSetGetValue(_cfObject, unsafeBitCast(__SwiftValue.store(object), to: UnsafeRawPointer.self)) else {
4242
return nil
4343
}
44-
return _SwiftValue.fetch(nonOptional: unsafeBitCast(value, to: AnyObject.self))
44+
return __SwiftValue.fetch(nonOptional: unsafeBitCast(value, to: AnyObject.self))
4545

4646
}
4747

@@ -66,11 +66,11 @@ internal final class _NSCFSet : NSMutableSet {
6666
}
6767

6868
override func add(_ object: Any) {
69-
CFSetAddValue(_cfMutableObject, unsafeBitCast(_SwiftValue.store(object), to: UnsafeRawPointer.self))
69+
CFSetAddValue(_cfMutableObject, unsafeBitCast(__SwiftValue.store(object), to: UnsafeRawPointer.self))
7070
}
7171

7272
override func remove(_ object: Any) {
73-
CFSetRemoveValue(_cfMutableObject, unsafeBitCast(_SwiftValue.store(object), to: UnsafeRawPointer.self))
73+
CFSetRemoveValue(_cfMutableObject, unsafeBitCast(__SwiftValue.store(object), to: UnsafeRawPointer.self))
7474
}
7575

7676
}
@@ -106,7 +106,7 @@ internal func _CFSwiftSetGetValues(_ set: AnyObject, _ values: UnsafeMutablePoin
106106
}
107107
} else {
108108
set.enumerateObjects( { v, _ in
109-
let value = _SwiftValue.store(v)
109+
let value = __SwiftValue.store(v)
110110
values?[idx] = Unmanaged<AnyObject>.passUnretained(value)
111111
set._storage.update(with: value)
112112
idx += 1
@@ -122,7 +122,7 @@ internal func _CFSwiftSetGetValue(_ set: AnyObject, value: AnyObject, key: AnyOb
122122
}
123123

124124
} else {
125-
let v = _SwiftValue.store(set.member(value))
125+
let v = __SwiftValue.store(set.member(value))
126126
if let obj = v {
127127
set._storage.update(with: obj)
128128
return Unmanaged<AnyObject>.passUnretained(obj)
@@ -143,7 +143,7 @@ internal func _CFSwiftSetGetValueIfPresent(_ set: AnyObject, object: AnyObject,
143143

144144
internal func _CFSwiftSetApplyFunction(_ set: AnyObject, applier: @convention(c) (AnyObject, UnsafeMutableRawPointer) -> Void, context: UnsafeMutableRawPointer) {
145145
(set as! NSSet).enumerateObjects({ value, _ in
146-
applier(_SwiftValue.store(value), context)
146+
applier(__SwiftValue.store(value), context)
147147
})
148148
}
149149

‎Foundation/NSDictionary.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ open class NSDictionary : NSObject, NSCopying, NSMutableCopying, NSSecureCoding,
2626
guard type(of: self) === NSDictionary.self || type(of: self) === NSMutableDictionary.self else {
2727
NSRequiresConcreteImplementation()
2828
}
29-
if let val = _storage[_SwiftValue.store(aKey)] {
30-
return _SwiftValue.fetch(nonOptional: val)
29+
if let val = _storage[__SwiftValue.store(aKey)] {
30+
return __SwiftValue.fetch(nonOptional: val)
3131
}
3232
return nil
3333
}
@@ -41,7 +41,7 @@ open class NSDictionary : NSObject, NSCopying, NSMutableCopying, NSSecureCoding,
4141
NSRequiresConcreteImplementation()
4242
}
4343

44-
return NSGeneratorEnumerator(_storage.keys.map { _SwiftValue.fetch(nonOptional: $0) }.makeIterator())
44+
return NSGeneratorEnumerator(_storage.keys.map { __SwiftValue.fetch(nonOptional: $0) }.makeIterator())
4545
}
4646

4747
@available(*, deprecated)
@@ -136,7 +136,7 @@ open class NSDictionary : NSObject, NSCopying, NSMutableCopying, NSSecureCoding,
136136
mutableDictionary._storage = self._storage
137137
return mutableDictionary
138138
}
139-
return NSMutableDictionary(objects: self.allValues, forKeys: self.allKeys.map { _SwiftValue.store($0) } )
139+
return NSMutableDictionary(objects: self.allValues, forKeys: self.allKeys.map { __SwiftValue.store($0) } )
140140
}
141141

142142
public convenience init(object: Any, forKey key: NSCopying) {
@@ -148,7 +148,7 @@ open class NSDictionary : NSObject, NSCopying, NSMutableCopying, NSSecureCoding,
148148
keyBuffer.initialize(from: keys, count: keys.count)
149149

150150
let valueBuffer = UnsafeMutablePointer<AnyObject>.allocate(capacity: objects.count)
151-
valueBuffer.initialize(from: objects.map { _SwiftValue.store($0) }, count: objects.count)
151+
valueBuffer.initialize(from: objects.map { __SwiftValue.store($0) }, count: objects.count)
152152

153153
self.init(objects: valueBuffer, forKeys:keyBuffer, count: keys.count)
154154

@@ -159,7 +159,7 @@ open class NSDictionary : NSObject, NSCopying, NSMutableCopying, NSSecureCoding,
159159
}
160160

161161
public convenience init(dictionary otherDictionary: [AnyHashable : Any]) {
162-
self.init(objects: Array(otherDictionary.values), forKeys: otherDictionary.keys.map { _SwiftValue.store($0) })
162+
self.init(objects: Array(otherDictionary.values), forKeys: otherDictionary.keys.map { __SwiftValue.store($0) })
163163
}
164164

165165
open override func isEqual(_ value: Any?) -> Bool {
@@ -209,8 +209,8 @@ open class NSDictionary : NSObject, NSCopying, NSMutableCopying, NSSecureCoding,
209209
open func getObjects(_ objects: inout [Any], andKeys keys: inout [Any], count: Int) {
210210
if type(of: self) === NSDictionary.self || type(of: self) === NSMutableDictionary.self {
211211
for (key, value) in _storage {
212-
keys.append(_SwiftValue.fetch(nonOptional: key))
213-
objects.append(_SwiftValue.fetch(nonOptional: value))
212+
keys.append(__SwiftValue.fetch(nonOptional: key))
213+
objects.append(__SwiftValue.fetch(nonOptional: value))
214214
}
215215
} else {
216216

@@ -398,7 +398,7 @@ open class NSDictionary : NSObject, NSCopying, NSMutableCopying, NSSecureCoding,
398398
} else {
399399
let otherBridgeable = otherDictionary[key as! AnyHashable]
400400
let bridgeable = object(forKey: key)!
401-
let equal = _SwiftValue.store(optional: otherBridgeable)?.isEqual(_SwiftValue.store(bridgeable))
401+
let equal = __SwiftValue.store(optional: otherBridgeable)?.isEqual(__SwiftValue.store(bridgeable))
402402
if equal != true {
403403
return false
404404
}
@@ -544,7 +544,7 @@ open class NSDictionary : NSObject, NSCopying, NSMutableCopying, NSSecureCoding,
544544
var values = [Any]()
545545

546546
for (key, value) in elements {
547-
keys.append(_SwiftValue.store(key))
547+
keys.append(__SwiftValue.store(key))
548548
values.append(value)
549549
}
550550

@@ -578,15 +578,15 @@ open class NSMutableDictionary : NSDictionary {
578578
NSRequiresConcreteImplementation()
579579
}
580580

581-
_storage.removeValue(forKey: _SwiftValue.store(aKey))
581+
_storage.removeValue(forKey: __SwiftValue.store(aKey))
582582
}
583583

584584
/// - Note: this diverges from the darwin version that requires NSCopying (this differential preserves allowing strings and such to be used as keys)
585585
open func setObject(_ anObject: Any, forKey aKey: AnyHashable) {
586586
guard type(of: self) === NSDictionary.self || type(of: self) === NSMutableDictionary.self else {
587587
NSRequiresConcreteImplementation()
588588
}
589-
_storage[_SwiftValue.store(aKey)] = _SwiftValue.store(anObject)
589+
_storage[__SwiftValue.store(aKey)] = __SwiftValue.store(anObject)
590590
}
591591

592592
public convenience required init() {

‎Foundation/NSKeyedArchiver.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ open class NSKeyedArchiver : NSCoder {
352352
return NSKeyedArchiveNullObjectReference
353353
}
354354

355-
let value = _SwiftValue.store(objv)!
355+
let value = __SwiftValue.store(objv)!
356356

357357
uid = self._objRefMap[value]
358358
if uid == nil {
@@ -376,7 +376,7 @@ open class NSKeyedArchiver : NSCoder {
376376
if objv == nil {
377377
return true // always have a null reference
378378
} else {
379-
return self._objRefMap[_SwiftValue.store(objv!)] != nil
379+
return self._objRefMap[__SwiftValue.store(objv!)] != nil
380380
}
381381
}
382382

@@ -448,7 +448,7 @@ open class NSKeyedArchiver : NSCoder {
448448
unwrappedDelegate.archiver(self, willReplace: object, with: replacement)
449449
}
450450

451-
self._replacementMap[_SwiftValue.store(object)] = replacement
451+
self._replacementMap[__SwiftValue.store(object)] = replacement
452452
}
453453

454454
/**
@@ -597,7 +597,7 @@ open class NSKeyedArchiver : NSCoder {
597597
object = _replacementObject(objv)
598598

599599
// bridge value types
600-
object = _SwiftValue.store(object)
600+
object = __SwiftValue.store(object)
601601

602602
objectRef = _referenceObject(object, conditional: conditional)
603603
guard let unwrappedObjectRef = objectRef else {
@@ -852,7 +852,7 @@ open class NSKeyedArchiver : NSCoder {
852852
objectRefs.reserveCapacity(objects.count)
853853

854854
for object in objects {
855-
let objectRef = _encodeObject(_SwiftValue.store(object))!
855+
let objectRef = _encodeObject(__SwiftValue.store(object))!
856856

857857
objectRefs.append(objectRef)
858858
}

‎Foundation/NSKeyedUnarchiver.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ open class NSKeyedUnarchiver : NSCoder {
370370
unwrappedDelegate.unarchiver(self, willReplace: object, with: replacement)
371371
}
372372

373-
self._replacementMap[_SwiftValue.store(object)] = replacement
373+
self._replacementMap[__SwiftValue.store(object)] = replacement
374374
}
375375

376376
private func _decodingError(_ code: CocoaError.Code, withDescription description: String) -> NSError {
@@ -387,7 +387,7 @@ open class NSKeyedUnarchiver : NSCoder {
387387
}
388388

389389
// check replacement cache
390-
object = self._replacementMap[_SwiftValue.store(decodedObject!)]
390+
object = self._replacementMap[__SwiftValue.store(decodedObject!)]
391391
if object != nil {
392392
return object
393393
}
@@ -483,7 +483,7 @@ open class NSKeyedUnarchiver : NSCoder {
483483
_cacheObject(object!, forReference: objectRef as! _NSKeyedArchiverUID)
484484
}
485485
} else {
486-
object = _SwiftValue.store(dereferencedObject)
486+
object = __SwiftValue.store(dereferencedObject)
487487
}
488488

489489
return _replacementObject(object)

‎Foundation/NSLocale.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ open class NSLocale: NSObject, NSCopying, NSSecureCoding {
2828
}
2929

3030
open func object(forKey key: NSLocale.Key) -> Any? {
31-
return _SwiftValue.fetch(CFLocaleGetValue(_cfObject, key.rawValue._cfObject))
31+
return __SwiftValue.fetch(CFLocaleGetValue(_cfObject, key.rawValue._cfObject))
3232
}
3333

3434
open func displayName(forKey key: Key, value: String) -> String? {
@@ -103,31 +103,31 @@ extension NSLocale {
103103
}
104104

105105
open class var availableLocaleIdentifiers: [String] {
106-
return _SwiftValue.fetch(CFLocaleCopyAvailableLocaleIdentifiers()) as? [String] ?? []
106+
return __SwiftValue.fetch(CFLocaleCopyAvailableLocaleIdentifiers()) as? [String] ?? []
107107
}
108108

109109
open class var isoLanguageCodes: [String] {
110-
return _SwiftValue.fetch(CFLocaleCopyISOLanguageCodes()) as? [String] ?? []
110+
return __SwiftValue.fetch(CFLocaleCopyISOLanguageCodes()) as? [String] ?? []
111111
}
112112

113113
open class var isoCountryCodes: [String] {
114-
return _SwiftValue.fetch(CFLocaleCopyISOCountryCodes()) as? [String] ?? []
114+
return __SwiftValue.fetch(CFLocaleCopyISOCountryCodes()) as? [String] ?? []
115115
}
116116

117117
open class var isoCurrencyCodes: [String] {
118-
return _SwiftValue.fetch(CFLocaleCopyISOCurrencyCodes()) as? [String] ?? []
118+
return __SwiftValue.fetch(CFLocaleCopyISOCurrencyCodes()) as? [String] ?? []
119119
}
120120

121121
open class var commonISOCurrencyCodes: [String] {
122-
return _SwiftValue.fetch(CFLocaleCopyCommonISOCurrencyCodes()) as? [String] ?? []
122+
return __SwiftValue.fetch(CFLocaleCopyCommonISOCurrencyCodes()) as? [String] ?? []
123123
}
124124

125125
open class var preferredLanguages: [String] {
126-
return _SwiftValue.fetch(CFLocaleCopyPreferredLanguages()) as? [String] ?? []
126+
return __SwiftValue.fetch(CFLocaleCopyPreferredLanguages()) as? [String] ?? []
127127
}
128128

129129
open class func components(fromLocaleIdentifier string: String) -> [String : String] {
130-
return _SwiftValue.fetch(CFLocaleCreateComponentsFromLocaleIdentifier(kCFAllocatorSystemDefault, string._cfObject)) as? [String : String] ?? [:]
130+
return __SwiftValue.fetch(CFLocaleCreateComponentsFromLocaleIdentifier(kCFAllocatorSystemDefault, string._cfObject)) as? [String : String] ?? [:]
131131
}
132132

133133
open class func localeIdentifier(fromComponents dict: [String : String]) -> String {

‎Foundation/NSNotification.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ extension Sequence where Iterator.Element : NSNotificationReceiver {
109109
let nameSpecified = name != nil
110110
let differentName = observer.name != name
111111
let objectSpecified = object != nil
112-
let differentSender = observer.sender !== _SwiftValue.store(object)
112+
let differentSender = observer.sender !== __SwiftValue.store(object)
113113

114114
return differentObserver || (nameSpecified && differentName) || (objectSpecified && differentSender)
115115
}
@@ -127,7 +127,7 @@ extension Sequence where Iterator.Element : NSNotificationReceiver {
127127
let emptyName = observer.name == nil
128128
let sameName = observer.name == name
129129
let emptySender = observer.sender == nil
130-
let sameSender = observer.sender === _SwiftValue.store(sender)
130+
let sameSender = observer.sender === __SwiftValue.store(sender)
131131

132132
return (emptySender || sameSender) && (emptyName || sameName)
133133
}
@@ -200,7 +200,7 @@ open class NotificationCenter: NSObject {
200200
newObserver.object = object
201201
newObserver.name = name
202202
newObserver.block = block
203-
newObserver.sender = _SwiftValue.store(obj)
203+
newObserver.sender = __SwiftValue.store(obj)
204204
newObserver.queue = queue
205205

206206
_observersLock.synchronized({

‎Foundation/NSOrderedSet.swift

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ open class NSOrderedSet : NSObject, NSCopying, NSMutableCopying, NSSecureCoding,
4242
preconditionFailure("Unkeyed coding is unsupported.")
4343
}
4444
for idx in 0..<self.count {
45-
aCoder.encode(_SwiftValue.store(self.object(at: idx)), forKey:"NS.object.\(idx)")
45+
aCoder.encode(__SwiftValue.store(self.object(at: idx)), forKey:"NS.object.\(idx)")
4646
}
4747
}
4848

@@ -67,11 +67,11 @@ open class NSOrderedSet : NSObject, NSCopying, NSMutableCopying, NSSecureCoding,
6767
}
6868

6969
open func object(at idx: Int) -> Any {
70-
return _SwiftValue.fetch(nonOptional: _orderedStorage[idx])
70+
return __SwiftValue.fetch(nonOptional: _orderedStorage[idx])
7171
}
7272

7373
open func index(of object: Any) -> Int {
74-
return _orderedStorage.index(of: _SwiftValue.store(object)) ?? NSNotFound
74+
return _orderedStorage.index(of: __SwiftValue.store(object)) ?? NSNotFound
7575
}
7676

7777
public convenience override init() {
@@ -100,7 +100,7 @@ open class NSOrderedSet : NSObject, NSCopying, NSMutableCopying, NSSecureCoding,
100100
}
101101

102102
fileprivate func _insertObject(_ object: Any) {
103-
let value = _SwiftValue.store(object)
103+
let value = __SwiftValue.store(object)
104104
guard !contains(value) else {
105105
return
106106
}
@@ -118,7 +118,7 @@ open class NSOrderedSet : NSObject, NSCopying, NSMutableCopying, NSSecureCoding,
118118

119119
internal var allObjects: [Any] {
120120
if type(of: self) === NSOrderedSet.self || type(of: self) === NSMutableOrderedSet.self {
121-
return _orderedStorage.map { _SwiftValue.fetch(nonOptional: $0) }
121+
return _orderedStorage.map { __SwiftValue.fetch(nonOptional: $0) }
122122
} else {
123123
return (0..<count).map { idx in
124124
return self[idx]
@@ -158,15 +158,15 @@ extension NSOrderedSet {
158158

159159
public var firstObject: Any? {
160160
if let value = _orderedStorage.first {
161-
return _SwiftValue.fetch(nonOptional: value)
161+
return __SwiftValue.fetch(nonOptional: value)
162162
} else {
163163
return nil
164164
}
165165
}
166166

167167
public var lastObject: Any? {
168168
if let value = _orderedStorage.last {
169-
return _SwiftValue.fetch(nonOptional: value)
169+
return __SwiftValue.fetch(nonOptional: value)
170170
} else {
171171
return nil
172172
}
@@ -190,7 +190,7 @@ extension NSOrderedSet {
190190
}
191191

192192
open func contains(_ object: Any) -> Bool {
193-
return _storage.contains(_SwiftValue.store(object))
193+
return _storage.contains(__SwiftValue.store(object))
194194
}
195195

196196
open func intersects(_ other: NSOrderedSet) -> Bool {
@@ -231,19 +231,19 @@ extension NSOrderedSet {
231231
guard type(of: self) === NSOrderedSet.self || type(of: self) === NSMutableOrderedSet.self else {
232232
NSRequiresConcreteImplementation()
233233
}
234-
return NSGeneratorEnumerator(_orderedStorage.map { _SwiftValue.fetch(nonOptional: $0) }.makeIterator())
234+
return NSGeneratorEnumerator(_orderedStorage.map { __SwiftValue.fetch(nonOptional: $0) }.makeIterator())
235235
}
236236

237237
public func reverseObjectEnumerator() -> NSEnumerator {
238238
guard type(of: self) === NSOrderedSet.self || type(of: self) === NSMutableOrderedSet.self else {
239239
NSRequiresConcreteImplementation()
240240
}
241-
return NSGeneratorEnumerator(_orderedStorage.map { _SwiftValue.fetch(nonOptional: $0) }.reversed().makeIterator())
241+
return NSGeneratorEnumerator(_orderedStorage.map { __SwiftValue.fetch(nonOptional: $0) }.reversed().makeIterator())
242242
}
243243

244244
/*@NSCopying*/
245245
public var reversed: NSOrderedSet {
246-
return NSOrderedSet(array: _orderedStorage.map { _SwiftValue.fetch(nonOptional: $0) }.reversed())
246+
return NSOrderedSet(array: _orderedStorage.map { __SwiftValue.fetch(nonOptional: $0) }.reversed())
247247
}
248248

249249
// These two methods return a facade object for the receiving ordered set,
@@ -298,7 +298,7 @@ extension NSOrderedSet {
298298
public convenience init(array: [Any]) {
299299
let buffer = UnsafeMutablePointer<AnyObject>.allocate(capacity: array.count)
300300
for (idx, element) in array.enumerated() {
301-
buffer.advanced(by: idx).initialize(to: _SwiftValue.store(element))
301+
buffer.advanced(by: idx).initialize(to: __SwiftValue.store(element))
302302
}
303303
self.init(objects: buffer, count: array.count)
304304
buffer.deinitialize(count: array.count)
@@ -342,7 +342,7 @@ open class NSMutableOrderedSet : NSOrderedSet {
342342
fatalError("\(self): Index out of bounds")
343343
}
344344

345-
let value = _SwiftValue.store(object)
345+
let value = __SwiftValue.store(object)
346346

347347
if contains(value) {
348348
return
@@ -362,8 +362,8 @@ open class NSMutableOrderedSet : NSOrderedSet {
362362
fatalError("\(self): Index out of bounds")
363363
}
364364

365-
let value = _SwiftValue.store(obj)
366-
let objectToReplace = _SwiftValue.store(object(at: idx))
365+
let value = __SwiftValue.store(obj)
366+
let objectToReplace = __SwiftValue.store(object(at: idx))
367367
_orderedStorage[idx] = value
368368
_storage.remove(objectToReplace)
369369
_storage.insert(value)
@@ -382,7 +382,7 @@ open class NSMutableOrderedSet : NSOrderedSet {
382382
public required init?(coder aDecoder: NSCoder) { NSUnimplemented() }
383383

384384
fileprivate func _removeObject(_ object: Any) {
385-
let value = _SwiftValue.store(object)
385+
let value = __SwiftValue.store(object)
386386

387387
guard contains(object) else {
388388
return
@@ -426,8 +426,8 @@ extension NSMutableOrderedSet {
426426

427427
let object1 = self.object(at: idx1)
428428
let object2 = self.object(at: idx2)
429-
_orderedStorage[idx1] = _SwiftValue.store(object2)
430-
_orderedStorage[idx2] = _SwiftValue.store(object1)
429+
_orderedStorage[idx1] = __SwiftValue.store(object2)
430+
_orderedStorage[idx2] = __SwiftValue.store(object1)
431431
}
432432

433433
open func moveObjects(at indexes: IndexSet, to idx: Int) {
@@ -451,7 +451,7 @@ extension NSMutableOrderedSet {
451451
}
452452

453453
open func setObject(_ obj: Any, at idx: Int) {
454-
let object = _SwiftValue.store(obj)
454+
let object = __SwiftValue.store(obj)
455455
_storage.insert(object)
456456
if idx == _orderedStorage.count {
457457
_orderedStorage.append(object)
@@ -497,7 +497,7 @@ extension NSMutableOrderedSet {
497497
}
498498

499499
open func remove(_ val: Any) {
500-
let object = _SwiftValue.store(val)
500+
let object = __SwiftValue.store(val)
501501

502502
_storage.remove(object)
503503
_orderedStorage.remove(at: index(of: val))
@@ -555,7 +555,7 @@ extension NSMutableOrderedSet {
555555

556556
let swiftRange = Range(range)!
557557
_orderedStorage[swiftRange].sort { lhs, rhs in
558-
return cmptr(_SwiftValue.fetch(nonOptional: lhs), _SwiftValue.fetch(nonOptional: rhs)) == .orderedAscending
558+
return cmptr(__SwiftValue.fetch(nonOptional: lhs), __SwiftValue.fetch(nonOptional: rhs)) == .orderedAscending
559559
}
560560
}
561561
}

‎Foundation/NSSet.swift

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ open class NSSet : NSObject, NSCopying, NSMutableCopying, NSSecureCoding, NSCodi
2525
guard type(of: self) === NSSet.self || type(of: self) === NSMutableSet.self || type(of: self) === NSCountedSet.self else {
2626
NSRequiresConcreteImplementation()
2727
}
28-
let value = _SwiftValue.store(object)
28+
let value = __SwiftValue.store(object)
2929
guard let idx = _storage.index(of: value) else { return nil }
3030
return _storage[idx]
3131
}
@@ -34,7 +34,7 @@ open class NSSet : NSObject, NSCopying, NSMutableCopying, NSSecureCoding, NSCodi
3434
guard type(of: self) === NSSet.self || type(of: self) === NSMutableSet.self || type(of: self) === NSCountedSet.self else {
3535
NSRequiresConcreteImplementation()
3636
}
37-
return NSGeneratorEnumerator(_storage.map { _SwiftValue.fetch(nonOptional: $0) }.makeIterator())
37+
return NSGeneratorEnumerator(_storage.map { __SwiftValue.fetch(nonOptional: $0) }.makeIterator())
3838
}
3939

4040
public convenience override init() {
@@ -46,7 +46,7 @@ open class NSSet : NSObject, NSCopying, NSMutableCopying, NSSecureCoding, NSCodi
4646
super.init()
4747
let buffer = UnsafeBufferPointer(start: objects, count: cnt)
4848
for obj in buffer {
49-
_storage.insert(_SwiftValue.store(obj))
49+
_storage.insert(__SwiftValue.store(obj))
5050
}
5151
}
5252

@@ -134,7 +134,7 @@ open class NSSet : NSObject, NSCopying, NSMutableCopying, NSSecureCoding, NSCodi
134134
public convenience init(array: [Any]) {
135135
let buffer = UnsafeMutablePointer<AnyObject>.allocate(capacity: array.count)
136136
for (idx, element) in array.enumerated() {
137-
buffer.advanced(by: idx).initialize(to: _SwiftValue.store(element))
137+
buffer.advanced(by: idx).initialize(to: __SwiftValue.store(element))
138138
}
139139
self.init(objects: buffer, count: array.count)
140140
buffer.deinitialize(count: array.count)
@@ -171,7 +171,7 @@ extension NSSet {
171171

172172
open var allObjects: [Any] {
173173
if type(of: self) === NSSet.self || type(of: self) === NSMutableSet.self {
174-
return _storage.map { _SwiftValue.fetch(nonOptional: $0) }
174+
return _storage.map { __SwiftValue.fetch(nonOptional: $0) }
175175
} else {
176176
let enumerator = objectEnumerator()
177177
var items = [Any]()
@@ -224,7 +224,7 @@ extension NSSet {
224224
open func addingObjects(from other: Set<AnyHashable>) -> Set<AnyHashable> {
225225
var result = Set<AnyHashable>(minimumCapacity: Swift.max(count, other.count))
226226
if type(of: self) === NSSet.self || type(of: self) === NSMutableSet.self {
227-
result.formUnion(_storage.map { _SwiftValue.fetch(nonOptional: $0) as! AnyHashable })
227+
result.formUnion(_storage.map { __SwiftValue.fetch(nonOptional: $0) as! AnyHashable })
228228
} else {
229229
for case let obj as NSObject in self {
230230
_ = result.insert(obj)
@@ -236,7 +236,7 @@ extension NSSet {
236236
open func addingObjects(from other: [Any]) -> Set<AnyHashable> {
237237
var result = Set<AnyHashable>(minimumCapacity: count)
238238
if type(of: self) === NSSet.self || type(of: self) === NSMutableSet.self {
239-
result.formUnion(_storage.map { _SwiftValue.fetch(nonOptional: $0) as! AnyHashable })
239+
result.formUnion(_storage.map { __SwiftValue.fetch(nonOptional: $0) as! AnyHashable })
240240
} else {
241241
for case let obj as AnyHashable in self {
242242
result.insert(obj)
@@ -315,15 +315,15 @@ open class NSMutableSet : NSSet {
315315
guard type(of: self) === NSMutableSet.self else {
316316
NSRequiresConcreteImplementation()
317317
}
318-
_storage.insert(_SwiftValue.store(object))
318+
_storage.insert(__SwiftValue.store(object))
319319
}
320320

321321
open func remove(_ object: Any) {
322322
guard type(of: self) === NSMutableSet.self else {
323323
NSRequiresConcreteImplementation()
324324
}
325325

326-
_storage.remove(_SwiftValue.store(object))
326+
_storage.remove(__SwiftValue.store(object))
327327
}
328328

329329
override public init(objects: UnsafePointer<AnyObject>!, count cnt: Int) {
@@ -345,7 +345,7 @@ open class NSMutableSet : NSSet {
345345
open func addObjects(from array: [Any]) {
346346
if type(of: self) === NSMutableSet.self {
347347
for case let obj in array {
348-
_storage.insert(_SwiftValue.store(obj))
348+
_storage.insert(__SwiftValue.store(obj))
349349
}
350350
} else {
351351
array.forEach(add)
@@ -354,7 +354,7 @@ open class NSMutableSet : NSSet {
354354

355355
open func intersect(_ otherSet: Set<AnyHashable>) {
356356
if type(of: self) === NSMutableSet.self {
357-
_storage.formIntersection(otherSet.map { _SwiftValue.store($0) })
357+
_storage.formIntersection(otherSet.map { __SwiftValue.store($0) })
358358
} else {
359359
for obj in self {
360360
if !otherSet.contains(obj as! AnyHashable) {
@@ -366,7 +366,7 @@ open class NSMutableSet : NSSet {
366366

367367
open func minus(_ otherSet: Set<AnyHashable>) {
368368
if type(of: self) === NSMutableSet.self {
369-
_storage.subtract(otherSet.map { _SwiftValue.store($0) })
369+
_storage.subtract(otherSet.map { __SwiftValue.store($0) })
370370
} else {
371371
otherSet.forEach(remove)
372372
}
@@ -382,15 +382,15 @@ open class NSMutableSet : NSSet {
382382

383383
open func union(_ otherSet: Set<AnyHashable>) {
384384
if type(of: self) === NSMutableSet.self {
385-
_storage.formUnion(otherSet.map { _SwiftValue.store($0) })
385+
_storage.formUnion(otherSet.map { __SwiftValue.store($0) })
386386
} else {
387387
otherSet.forEach(add)
388388
}
389389
}
390390

391391
open func setSet(_ otherSet: Set<AnyHashable>) {
392392
if type(of: self) === NSMutableSet.self {
393-
_storage = Set(otherSet.map { _SwiftValue.store($0) })
393+
_storage = Set(otherSet.map { __SwiftValue.store($0) })
394394
} else {
395395
removeAllObjects()
396396
union(otherSet)
@@ -415,7 +415,7 @@ open class NSCountedSet : NSMutableSet {
415415
public convenience init(array: [Any]) {
416416
self.init(capacity: array.count)
417417
for object in array {
418-
let value = _SwiftValue.store(object)
418+
let value = __SwiftValue.store(object)
419419
if let count = _table[value] {
420420
_table[value] = count + 1
421421
} else {
@@ -455,7 +455,7 @@ open class NSCountedSet : NSMutableSet {
455455
guard type(of: self) === NSCountedSet.self else {
456456
NSRequiresConcreteImplementation()
457457
}
458-
let value = _SwiftValue.store(object)
458+
let value = __SwiftValue.store(object)
459459
guard let count = _table[value] else {
460460
return 0
461461
}
@@ -466,7 +466,7 @@ open class NSCountedSet : NSMutableSet {
466466
guard type(of: self) === NSCountedSet.self else {
467467
NSRequiresConcreteImplementation()
468468
}
469-
let value = _SwiftValue.store(object)
469+
let value = __SwiftValue.store(object)
470470
if let count = _table[value] {
471471
_table[value] = count + 1
472472
} else {
@@ -479,7 +479,7 @@ open class NSCountedSet : NSMutableSet {
479479
guard type(of: self) === NSCountedSet.self else {
480480
NSRequiresConcreteImplementation()
481481
}
482-
let value = _SwiftValue.store(object)
482+
let value = __SwiftValue.store(object)
483483
guard let count = _table[value] else {
484484
return
485485
}

‎Foundation/Notification.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public struct Notification : ReferenceConvertible, Equatable, Hashable {
6161
}
6262
if let lhsObj = lhs.object {
6363
if let rhsObj = rhs.object {
64-
if _SwiftValue.store(lhsObj) !== _SwiftValue.store(rhsObj) {
64+
if __SwiftValue.store(lhsObj) !== __SwiftValue.store(rhsObj) {
6565
return false
6666
}
6767
} else {

‎Foundation/NotificationQueue.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,15 @@ open class NotificationQueue: NSObject {
110110
switch coalesceMask {
111111
case [.onName, .onSender]:
112112
predicate = { entry in
113-
return _SwiftValue.store(notification.object) !== _SwiftValue.store(entry.0.object) || notification.name != entry.0.name
113+
return __SwiftValue.store(notification.object) !== __SwiftValue.store(entry.0.object) || notification.name != entry.0.name
114114
}
115115
case [.onName]:
116116
predicate = { entry in
117117
return notification.name != entry.0.name
118118
}
119119
case [.onSender]:
120120
predicate = { entry in
121-
return _SwiftValue.store(notification.object) !== _SwiftValue.store(entry.0.object)
121+
return __SwiftValue.store(notification.object) !== __SwiftValue.store(entry.0.object)
122122
}
123123
default:
124124
return

‎Foundation/NumberFormatter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ open class NumberFormatter : Formatter {
8989

9090
open override func string(for obj: Any) -> String? {
9191
//we need to allow Swift's numeric types here - Int, Double et al.
92-
guard let number = _SwiftValue.store(obj) as? NSNumber else { return nil }
92+
guard let number = __SwiftValue.store(obj) as? NSNumber else { return nil }
9393
return string(from: number)
9494
}
9595

‎Foundation/PropertyListSerialization.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ open class PropertyListSerialization : NSObject {
4444
#else
4545
let fmt = CFPropertyListFormat(format.rawValue)
4646
#endif
47-
let plistObj = _SwiftValue.store(plist)
47+
let plistObj = __SwiftValue.store(plist)
4848
return CFPropertyListIsValid(plistObj, fmt)
4949
}
5050

@@ -57,7 +57,7 @@ open class PropertyListSerialization : NSObject {
5757
let fmt = CFPropertyListFormat(format.rawValue)
5858
#endif
5959
let options = CFOptionFlags(opt)
60-
let plistObj = _SwiftValue.store(plist)
60+
let plistObj = __SwiftValue.store(plist)
6161
let d = CFPropertyListCreateData(kCFAllocatorSystemDefault, plistObj, fmt, options, outErr)
6262
return d?.takeRetainedValue()
6363
}
@@ -84,7 +84,7 @@ open class PropertyListSerialization : NSObject {
8484
if let err = error {
8585
throw err.takeUnretainedValue()._nsObject
8686
} else {
87-
return _SwiftValue.fetch(nonOptional: decoded!)
87+
return __SwiftValue.fetch(nonOptional: decoded!)
8888
}
8989
}
9090

@@ -104,7 +104,7 @@ open class PropertyListSerialization : NSObject {
104104
if let err = error {
105105
throw err.takeUnretainedValue()._nsObject
106106
} else {
107-
return _SwiftValue.fetch(nonOptional: decoded!)
107+
return __SwiftValue.fetch(nonOptional: decoded!)
108108
}
109109
}
110110

‎Foundation/Set.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ extension Set : _ObjectiveCBridgeable {
4141
set.insert(o)
4242
} else {
4343
// here obj must be a swift type
44-
if let nsObject = _SwiftValue.store(obj) as? Element {
44+
if let nsObject = __SwiftValue.store(obj) as? Element {
4545
set.insert(nsObject)
4646
} else {
4747
failedConversion = true

‎Foundation/UserDefaults.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ fileprivate func bridgeFromNSCFTypeIfNeeded(_ value: Any) -> Any {
1616
// This line will produce a 'Conditional cast always succeeds' warning if compoiled on Darwin, since Darwin has bridging casts of any value to an object,
1717
// but is required for non-Darwin to work correctly, since that platform _doesn't_ have bridging casts of that kind for now.
1818
if let object = value as? AnyObject {
19-
return _SwiftValue.fetch(nonOptional: object)
19+
return __SwiftValue.fetch(nonOptional: object)
2020
} else {
2121
return value
2222
}
@@ -118,7 +118,7 @@ open class UserDefaults: NSObject {
118118
return getFromRegistered()
119119
}
120120

121-
if let fetched = _SwiftValue.fetch(anObj) {
121+
if let fetched = __SwiftValue.fetch(anObj) {
122122
return UserDefaults._unboxingNSNumbers(fetched)
123123
} else {
124124
return nil
@@ -145,7 +145,7 @@ open class UserDefaults: NSObject {
145145
fatalError("This value is not supported by set(_:forKey:)")
146146
}
147147

148-
CFPreferencesSetAppValue(defaultName._cfObject, _SwiftValue.store(value), suite?._cfObject ?? kCFPreferencesCurrentApplication)
148+
CFPreferencesSetAppValue(defaultName._cfObject, __SwiftValue.store(value), suite?._cfObject ?? kCFPreferencesCurrentApplication)
149149
}
150150
open func removeObject(forKey defaultName: String) {
151151
CFPreferencesSetAppValue(defaultName._cfObject, nil, suite?._cfObject ?? kCFPreferencesCurrentApplication)
@@ -299,7 +299,7 @@ open class UserDefaults: NSObject {
299299
return registeredDefaultsIfAllowed
300300
}
301301

302-
let defaultsFromDiskWithNumbersBoxed = _SwiftValue.fetch(defaultsFromDiskCF) as? [String: Any] ?? [:]
302+
let defaultsFromDiskWithNumbersBoxed = __SwiftValue.fetch(defaultsFromDiskCF) as? [String: Any] ?? [:]
303303

304304
if registeredDefaultsIfAllowed.isEmpty {
305305
return UserDefaults._unboxingNSNumbers(defaultsFromDiskWithNumbersBoxed) as! [String: Any]

0 commit comments

Comments
 (0)
Please sign in to comment.