From c93635ffcea35f7c7845f5ced4489ea84758fff9 Mon Sep 17 00:00:00 2001
From: Jeremy Schonfeld <jschonfeld@apple.com>
Date: Wed, 24 Jul 2024 11:11:07 -0700
Subject: [PATCH] (113200224) JSON/PropertyList coders userInfo should require
 Sendable values

---
 Sources/FoundationEssentials/JSON/JSONDecoder.swift          | 5 +++--
 Sources/FoundationEssentials/JSON/JSONEncoder.swift          | 5 +++--
 Sources/FoundationEssentials/PropertyList/PlistDecoder.swift | 5 +++--
 Sources/FoundationEssentials/PropertyList/PlistEncoder.swift | 5 +++--
 4 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/Sources/FoundationEssentials/JSON/JSONDecoder.swift b/Sources/FoundationEssentials/JSON/JSONDecoder.swift
index fc9bf0b28..9d9aae7df 100644
--- a/Sources/FoundationEssentials/JSON/JSONDecoder.swift
+++ b/Sources/FoundationEssentials/JSON/JSONDecoder.swift
@@ -257,7 +257,8 @@ open class JSONDecoder {
     }
 
     /// Contextual user-provided information for use during decoding.
-    open var userInfo: [CodingUserInfoKey : Any] {
+    @preconcurrency
+    open var userInfo: [CodingUserInfoKey : any Sendable] {
         get {
             optionsLock.lock()
             defer { optionsLock.unlock() }
@@ -309,7 +310,7 @@ open class JSONDecoder {
         var dataDecodingStrategy: DataDecodingStrategy = .base64
         var nonConformingFloatDecodingStrategy: NonConformingFloatDecodingStrategy = .throw
         var keyDecodingStrategy: KeyDecodingStrategy = .useDefaultKeys
-        var userInfo: [CodingUserInfoKey : Any] = [:]
+        var userInfo: [CodingUserInfoKey : any Sendable] = [:]
         var json5: Bool = false
     }
 
diff --git a/Sources/FoundationEssentials/JSON/JSONEncoder.swift b/Sources/FoundationEssentials/JSON/JSONEncoder.swift
index 8ff91c4c9..5713e5e1f 100644
--- a/Sources/FoundationEssentials/JSON/JSONEncoder.swift
+++ b/Sources/FoundationEssentials/JSON/JSONEncoder.swift
@@ -295,7 +295,8 @@ open class JSONEncoder {
     }
 
     /// Contextual user-provided information for use during encoding.
-    open var userInfo: [CodingUserInfoKey : Any] {
+    @preconcurrency
+    open var userInfo: [CodingUserInfoKey : any Sendable] {
         get {
             optionsLock.lock()
             defer { optionsLock.unlock() }
@@ -324,7 +325,7 @@ open class JSONEncoder {
         var dataEncodingStrategy: DataEncodingStrategy = .base64
         var nonConformingFloatEncodingStrategy: NonConformingFloatEncodingStrategy = .throw
         var keyEncodingStrategy: KeyEncodingStrategy = .useDefaultKeys
-        var userInfo: [CodingUserInfoKey : Any] = [:]
+        var userInfo: [CodingUserInfoKey : any Sendable] = [:]
     }
 
     /// The options set on the top-level encoder.
diff --git a/Sources/FoundationEssentials/PropertyList/PlistDecoder.swift b/Sources/FoundationEssentials/PropertyList/PlistDecoder.swift
index 08d15e9a8..1b9919eac 100644
--- a/Sources/FoundationEssentials/PropertyList/PlistDecoder.swift
+++ b/Sources/FoundationEssentials/PropertyList/PlistDecoder.swift
@@ -38,7 +38,8 @@ open class PropertyListDecoder {
     // MARK: Options
 
     /// Contextual user-provided information for use during decoding.
-    open var userInfo: [CodingUserInfoKey : Any] {
+    @preconcurrency
+    open var userInfo: [CodingUserInfoKey : any Sendable] {
         get {
             optionsLock.lock()
             defer { optionsLock.unlock() }
@@ -62,7 +63,7 @@ open class PropertyListDecoder {
 
     /// Options set on the top-level encoder to pass down the decoding hierarchy.
     internal struct _Options {
-        var userInfo: [CodingUserInfoKey : Any] = [:]
+        var userInfo: [CodingUserInfoKey : any Sendable] = [:]
     }
 
     /// The options set on the top-level decoder.
diff --git a/Sources/FoundationEssentials/PropertyList/PlistEncoder.swift b/Sources/FoundationEssentials/PropertyList/PlistEncoder.swift
index 620035add..ad05dd463 100644
--- a/Sources/FoundationEssentials/PropertyList/PlistEncoder.swift
+++ b/Sources/FoundationEssentials/PropertyList/PlistEncoder.swift
@@ -49,7 +49,8 @@ open class PropertyListEncoder {
     }
 
     /// Contextual user-provided information for use during encoding.
-    open var userInfo: [CodingUserInfoKey : Any] {
+    @preconcurrency
+    open var userInfo: [CodingUserInfoKey : any Sendable] {
         get {
             optionsLock.lock()
             defer { optionsLock.unlock() }
@@ -74,7 +75,7 @@ open class PropertyListEncoder {
     /// Options set on the top-level encoder to pass down the encoding hierarchy.
     internal struct _Options {
         var outputFormat: PropertyListDecoder.PropertyListFormat = .binary
-        var userInfo: [CodingUserInfoKey : Any] = [:]
+        var userInfo: [CodingUserInfoKey : any Sendable] = [:]
     }
 
     /// The options set on the top-level encoder.