Skip to content

Commit 9f042bc

Browse files
author
Itai Ferber
committed
Apply annotations to further non-trivial types
1 parent 402457b commit 9f042bc

15 files changed

+51
-51
lines changed

stdlib/public/SDK/Foundation/Calendar.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public struct Calendar : Hashable, Equatable, ReferenceConvertible, _MutableBoxi
9797
/// Returns a new Calendar.
9898
///
9999
/// - parameter identifier: The kind of calendar to use.
100-
public init(identifier: Identifier) {
100+
public init(identifier: __shared Identifier) {
101101
let result = __NSCalendarCreate(Calendar._toNSCalendarIdentifier(identifier))
102102
_handle = _MutableHandle(adoptingReference: result as! NSCalendar)
103103
_autoupdating = false

stdlib/public/SDK/Foundation/CharacterSet.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,23 +390,23 @@ public struct CharacterSet : ReferenceConvertible, Equatable, Hashable, SetAlgeb
390390
/// Initialize with the characters in the given string.
391391
///
392392
/// - parameter string: The string content to inspect for characters.
393-
public init(charactersIn string: String) {
393+
public init(charactersIn string: __shared String) {
394394
_storage = _CharacterSetStorage(immutableReference: CFCharacterSetCreateWithCharactersInString(nil, string as CFString))
395395
}
396396

397397
/// Initialize with a bitmap representation.
398398
///
399399
/// This method is useful for creating a character set object with data from a file or other external data source.
400400
/// - parameter data: The bitmap representation.
401-
public init(bitmapRepresentation data: Data) {
401+
public init(bitmapRepresentation data: __shared Data) {
402402
_storage = _CharacterSetStorage(immutableReference: CFCharacterSetCreateWithBitmapRepresentation(nil, data as CFData))
403403
}
404404

405405
/// Initialize with the contents of a file.
406406
///
407407
/// Returns `nil` if there was an error reading the file.
408408
/// - parameter file: The file to read.
409-
public init?(contentsOfFile file: String) {
409+
public init?(contentsOfFile file: __shared String) {
410410
do {
411411
let data = try Data(contentsOf: URL(fileURLWithPath: file), options: .mappedIfSafe)
412412
_storage = _CharacterSetStorage(immutableReference: CFCharacterSetCreateWithBitmapRepresentation(nil, data as CFData))
@@ -427,7 +427,7 @@ public struct CharacterSet : ReferenceConvertible, Equatable, Hashable, SetAlgeb
427427
_storage = _uncopiedStorage
428428
}
429429

430-
fileprivate init(_builtIn: CFCharacterSetPredefinedSet) {
430+
fileprivate init(_builtIn: __shared CFCharacterSetPredefinedSet) {
431431
_storage = _CharacterSetStorage(immutableReference: CFCharacterSetGetPredefined(_builtIn))
432432
}
433433

stdlib/public/SDK/Foundation/Data.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,7 +1178,7 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
11781178
/// - parameter url: The `URL` to read.
11791179
/// - parameter options: Options for the read operation. Default value is `[]`.
11801180
/// - throws: An error in the Cocoa domain, if `url` cannot be read.
1181-
public init(contentsOf url: URL, options: Data.ReadingOptions = []) throws {
1181+
public init(contentsOf url: __shared URL, options: __shared Data.ReadingOptions = []) throws {
11821182
let d = try NSData(contentsOf: url, options: ReadingOptions(rawValue: options.rawValue))
11831183
_backing = _DataStorage(immutableReference: d, offset: 0)
11841184
_sliceRange = 0..<d.length
@@ -1189,7 +1189,7 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
11891189
/// Returns nil when the input is not recognized as valid Base-64.
11901190
/// - parameter base64String: The string to parse.
11911191
/// - parameter options: Encoding options. Default value is `[]`.
1192-
public init?(base64Encoded base64String: String, options: Data.Base64DecodingOptions = []) {
1192+
public init?(base64Encoded base64String: __shared String, options: __shared Data.Base64DecodingOptions = []) {
11931193
if let d = NSData(base64Encoded: base64String, options: Base64DecodingOptions(rawValue: options.rawValue)) {
11941194
_backing = _DataStorage(immutableReference: d, offset: 0)
11951195
_sliceRange = 0..<d.length
@@ -1204,7 +1204,7 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
12041204
///
12051205
/// - parameter base64Data: Base-64, UTF-8 encoded input data.
12061206
/// - parameter options: Decoding options. Default value is `[]`.
1207-
public init?(base64Encoded base64Data: Data, options: Data.Base64DecodingOptions = []) {
1207+
public init?(base64Encoded base64Data: __shared Data, options: __shared Data.Base64DecodingOptions = []) {
12081208
if let d = NSData(base64Encoded: base64Data, options: Base64DecodingOptions(rawValue: options.rawValue)) {
12091209
_backing = _DataStorage(immutableReference: d, offset: 0)
12101210
_sliceRange = 0..<d.length

stdlib/public/SDK/Foundation/Decimal.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ extension Decimal {
452452
}
453453

454454
extension Decimal : CustomStringConvertible {
455-
public init?(string: String, locale: Locale? = nil) {
455+
public init?(string: __shared String, locale: __shared Locale? = nil) {
456456
let scan = Scanner(string: string)
457457
var theDecimal = Decimal()
458458
scan.locale = locale

stdlib/public/SDK/Foundation/IndexPath.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public struct IndexPath : ReferenceConvertible, Equatable, Hashable, MutableColl
156156
}
157157
}
158158

159-
mutating func append(contentsOf other: [Int]) {
159+
mutating func append(contentsOf other: __owned [Int]) {
160160
switch self {
161161
case .empty:
162162
switch other.count {

stdlib/public/SDK/Foundation/NSError.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ extension CFError : Error {
359359
public protocol _ObjectiveCBridgeableError : Error {
360360
/// Produce a value of the error type corresponding to the given NSError,
361361
/// or return nil if it cannot be bridged.
362-
init?(_bridgedNSError: NSError)
362+
init?(_bridgedNSError: __shared NSError)
363363
}
364364

365365
/// A hook for the runtime to use _ObjectiveCBridgeableError in order to

stdlib/public/SDK/Foundation/NSExpression.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
extension NSExpression {
1616
// + (NSExpression *) expressionWithFormat:(NSString *)expressionFormat, ...;
1717
public
18-
convenience init(format expressionFormat: String, _ args: CVarArg...) {
18+
convenience init(format expressionFormat: __shared String, _ args: CVarArg...) {
1919
let va_args = getVaList(args)
2020
self.init(format: expressionFormat, arguments: va_args)
2121
}

stdlib/public/SDK/Foundation/NSObject.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ fileprivate extension NSObject {
8181

8282
@nonobjc static var keyPathTableLock = NSLock()
8383

84-
@nonobjc fileprivate static func _bridgeKeyPath(_ keyPath:AnyKeyPath) -> String {
84+
@nonobjc fileprivate static func _bridgeKeyPath(_ keyPath: __owned AnyKeyPath) -> String {
8585
guard let keyPathString = keyPath._kvcKeyPathString else { fatalError("Could not extract a String from KeyPath \(keyPath)") }
8686
_KVOKeyPathBridgeMachinery.keyPathTableLock.lock()
8787
defer { _KVOKeyPathBridgeMachinery.keyPathTableLock.unlock() }
@@ -199,27 +199,27 @@ public extension _KeyValueCodingAndObserving {
199199
return result
200200
}
201201

202-
public func willChangeValue<Value>(for keyPath: KeyPath<Self, Value>) {
202+
public func willChangeValue<Value>(for keyPath: __owned KeyPath<Self, Value>) {
203203
(self as! NSObject).willChangeValue(forKey: _bridgeKeyPathToString(keyPath))
204204
}
205205

206-
public func willChange<Value>(_ changeKind: NSKeyValueChange, valuesAt indexes: IndexSet, for keyPath: KeyPath<Self, Value>) {
206+
public func willChange<Value>(_ changeKind: NSKeyValueChange, valuesAt indexes: IndexSet, for keyPath: __owned KeyPath<Self, Value>) {
207207
(self as! NSObject).willChange(changeKind, valuesAt: indexes, forKey: _bridgeKeyPathToString(keyPath))
208208
}
209209

210-
public func willChangeValue<Value>(for keyPath: KeyPath<Self, Value>, withSetMutation mutation: NSKeyValueSetMutationKind, using set: Set<Value>) -> Void {
210+
public func willChangeValue<Value>(for keyPath: __owned KeyPath<Self, Value>, withSetMutation mutation: NSKeyValueSetMutationKind, using set: Set<Value>) -> Void {
211211
(self as! NSObject).willChangeValue(forKey: _bridgeKeyPathToString(keyPath), withSetMutation: mutation, using: set)
212212
}
213213

214-
public func didChangeValue<Value>(for keyPath: KeyPath<Self, Value>) {
214+
public func didChangeValue<Value>(for keyPath: __owned KeyPath<Self, Value>) {
215215
(self as! NSObject).didChangeValue(forKey: _bridgeKeyPathToString(keyPath))
216216
}
217217

218-
public func didChange<Value>(_ changeKind: NSKeyValueChange, valuesAt indexes: IndexSet, for keyPath: KeyPath<Self, Value>) {
218+
public func didChange<Value>(_ changeKind: NSKeyValueChange, valuesAt indexes: IndexSet, for keyPath: __owned KeyPath<Self, Value>) {
219219
(self as! NSObject).didChange(changeKind, valuesAt: indexes, forKey: _bridgeKeyPathToString(keyPath))
220220
}
221221

222-
public func didChangeValue<Value>(for keyPath: KeyPath<Self, Value>, withSetMutation mutation: NSKeyValueSetMutationKind, using set: Set<Value>) -> Void {
222+
public func didChangeValue<Value>(for keyPath: __owned KeyPath<Self, Value>, withSetMutation mutation: NSKeyValueSetMutationKind, using set: Set<Value>) -> Void {
223223
(self as! NSObject).didChangeValue(forKey: _bridgeKeyPathToString(keyPath), withSetMutation: mutation, using: set)
224224
}
225225
}

stdlib/public/SDK/Foundation/NSPredicate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
extension NSPredicate {
1616
// + (NSPredicate *)predicateWithFormat:(NSString *)predicateFormat, ...;
1717
public
18-
convenience init(format predicateFormat: String, _ args: CVarArg...) {
18+
convenience init(format predicateFormat: __shared String, _ args: CVarArg...) {
1919
let va_args = getVaList(args)
2020
self.init(format: predicateFormat, arguments: va_args)
2121
}

stdlib/public/SDK/Foundation/NSRange.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ extension NSRange : CustomStringConvertible, CustomDebugStringConvertible {
3737
}
3838

3939
extension NSRange {
40-
public init?(_ string: String) {
40+
public init?(_ string: __shared String) {
4141
var savedLocation = 0
4242
if string.isEmpty {
4343
// fail early if the string is empty
@@ -178,7 +178,7 @@ extension Range where Bound == Int {
178178
}
179179

180180
extension Range where Bound == String.Index {
181-
public init?(_ range: NSRange, in string: String) {
181+
public init?(_ range: NSRange, in string: __shared String) {
182182
let u = string.utf16
183183
guard range.location != NSNotFound,
184184
let start = u.index(u.startIndex, offsetBy: range.location, limitedBy: u.endIndex),

0 commit comments

Comments
 (0)