Skip to content

Commit c93635f

Browse files
committed
(113200224) JSON/PropertyList coders userInfo should require Sendable values
1 parent e34e1c9 commit c93635f

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

Sources/FoundationEssentials/JSON/JSONDecoder.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,8 @@ open class JSONDecoder {
257257
}
258258

259259
/// Contextual user-provided information for use during decoding.
260-
open var userInfo: [CodingUserInfoKey : Any] {
260+
@preconcurrency
261+
open var userInfo: [CodingUserInfoKey : any Sendable] {
261262
get {
262263
optionsLock.lock()
263264
defer { optionsLock.unlock() }
@@ -309,7 +310,7 @@ open class JSONDecoder {
309310
var dataDecodingStrategy: DataDecodingStrategy = .base64
310311
var nonConformingFloatDecodingStrategy: NonConformingFloatDecodingStrategy = .throw
311312
var keyDecodingStrategy: KeyDecodingStrategy = .useDefaultKeys
312-
var userInfo: [CodingUserInfoKey : Any] = [:]
313+
var userInfo: [CodingUserInfoKey : any Sendable] = [:]
313314
var json5: Bool = false
314315
}
315316

Sources/FoundationEssentials/JSON/JSONEncoder.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,8 @@ open class JSONEncoder {
295295
}
296296

297297
/// Contextual user-provided information for use during encoding.
298-
open var userInfo: [CodingUserInfoKey : Any] {
298+
@preconcurrency
299+
open var userInfo: [CodingUserInfoKey : any Sendable] {
299300
get {
300301
optionsLock.lock()
301302
defer { optionsLock.unlock() }
@@ -324,7 +325,7 @@ open class JSONEncoder {
324325
var dataEncodingStrategy: DataEncodingStrategy = .base64
325326
var nonConformingFloatEncodingStrategy: NonConformingFloatEncodingStrategy = .throw
326327
var keyEncodingStrategy: KeyEncodingStrategy = .useDefaultKeys
327-
var userInfo: [CodingUserInfoKey : Any] = [:]
328+
var userInfo: [CodingUserInfoKey : any Sendable] = [:]
328329
}
329330

330331
/// The options set on the top-level encoder.

Sources/FoundationEssentials/PropertyList/PlistDecoder.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ open class PropertyListDecoder {
3838
// MARK: Options
3939

4040
/// Contextual user-provided information for use during decoding.
41-
open var userInfo: [CodingUserInfoKey : Any] {
41+
@preconcurrency
42+
open var userInfo: [CodingUserInfoKey : any Sendable] {
4243
get {
4344
optionsLock.lock()
4445
defer { optionsLock.unlock() }
@@ -62,7 +63,7 @@ open class PropertyListDecoder {
6263

6364
/// Options set on the top-level encoder to pass down the decoding hierarchy.
6465
internal struct _Options {
65-
var userInfo: [CodingUserInfoKey : Any] = [:]
66+
var userInfo: [CodingUserInfoKey : any Sendable] = [:]
6667
}
6768

6869
/// The options set on the top-level decoder.

Sources/FoundationEssentials/PropertyList/PlistEncoder.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ open class PropertyListEncoder {
4949
}
5050

5151
/// Contextual user-provided information for use during encoding.
52-
open var userInfo: [CodingUserInfoKey : Any] {
52+
@preconcurrency
53+
open var userInfo: [CodingUserInfoKey : any Sendable] {
5354
get {
5455
optionsLock.lock()
5556
defer { optionsLock.unlock() }
@@ -74,7 +75,7 @@ open class PropertyListEncoder {
7475
/// Options set on the top-level encoder to pass down the encoding hierarchy.
7576
internal struct _Options {
7677
var outputFormat: PropertyListDecoder.PropertyListFormat = .binary
77-
var userInfo: [CodingUserInfoKey : Any] = [:]
78+
var userInfo: [CodingUserInfoKey : any Sendable] = [:]
7879
}
7980

8081
/// The options set on the top-level encoder.

0 commit comments

Comments
 (0)