@@ -5535,33 +5535,34 @@ internal struct _DictionaryCodingKey: CodingKey {
55355535/// and decoding `Dictionary` values keyed by the conforming type to and from
55365536/// a keyed container, rather than encoding and decoding the dictionary as an
55375537/// unkeyed container of alternating key-value pairs.
5538- @available ( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * )
5538+ @available ( SwiftStdlib 5 . 6 , * )
55395539public protocol CodingKeyRepresentable {
5540- @available ( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * )
5540+ @available ( SwiftStdlib 5 . 6 , * )
55415541 var codingKey : CodingKey { get }
5542- @available ( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * )
5542+ @available ( SwiftStdlib 5 . 6 , * )
55435543 init ? < T: CodingKey > ( codingKey: T )
55445544}
55455545
5546- @available ( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * )
5547- extension RawRepresentable where Self: CodingKeyRepresentable , RawValue == String {
5548- @available ( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * )
5546+ @available ( SwiftStdlib 5 . 6 , * )
5547+ extension RawRepresentable
5548+ where Self: CodingKeyRepresentable , RawValue == String {
5549+ @available ( SwiftStdlib 5 . 6 , * )
55495550 public var codingKey : CodingKey {
55505551 _DictionaryCodingKey ( stringValue: rawValue)
55515552 }
5552- @available ( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * )
5553+ @available ( SwiftStdlib 5 . 6 , * )
55535554 public init ? < T: CodingKey > ( codingKey: T ) {
55545555 self . init ( rawValue: codingKey. stringValue)
55555556 }
55565557}
55575558
5558- @available ( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * )
5559+ @available ( SwiftStdlib 5 . 6 , * )
55595560extension RawRepresentable where Self: CodingKeyRepresentable , RawValue == Int {
5560- @available ( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * )
5561+ @available ( SwiftStdlib 5 . 6 , * )
55615562 public var codingKey : CodingKey {
55625563 _DictionaryCodingKey ( intValue: rawValue)
55635564 }
5564- @available ( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * )
5565+ @available ( SwiftStdlib 5 . 6 , * )
55655566 public init ? < T: CodingKey > ( codingKey: T ) {
55665567 if let intValue = codingKey. intValue {
55675568 self . init ( rawValue: intValue)
@@ -5571,13 +5572,13 @@ extension RawRepresentable where Self: CodingKeyRepresentable, RawValue == Int {
55715572 }
55725573}
55735574
5574- @available ( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * )
5575+ @available ( SwiftStdlib 5 . 6 , * )
55755576extension Int : CodingKeyRepresentable {
5576- @available ( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * )
5577+ @available ( SwiftStdlib 5 . 6 , * )
55775578 public var codingKey : CodingKey {
55785579 _DictionaryCodingKey ( intValue: self )
55795580 }
5580- @available ( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * )
5581+ @available ( SwiftStdlib 5 . 6 , * )
55815582 public init ? < T: CodingKey > ( codingKey: T ) {
55825583 if let intValue = codingKey. intValue {
55835584 self = intValue
@@ -5587,13 +5588,13 @@ extension Int: CodingKeyRepresentable {
55875588 }
55885589}
55895590
5590- @available ( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * )
5591+ @available ( SwiftStdlib 5 . 6 , * )
55915592extension String : CodingKeyRepresentable {
5592- @available ( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * )
5593+ @available ( SwiftStdlib 5 . 6 , * )
55935594 public var codingKey : CodingKey {
55945595 _DictionaryCodingKey ( stringValue: self )
55955596 }
5596- @available ( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * )
5597+ @available ( SwiftStdlib 5 . 6 , * )
55975598 public init ? < T: CodingKey > ( codingKey: T ) {
55985599 self = codingKey. stringValue
55995600 }
@@ -5603,9 +5604,9 @@ extension Dictionary: Encodable where Key: Encodable, Value: Encodable {
56035604 /// Encodes the contents of this dictionary into the given encoder.
56045605 ///
56055606 /// If the dictionary uses keys that are `String`, `Int`, or a type conforming
5606- /// to `CodingKeyRepresentable`, the contents are encoded in a keyed container.
5607- /// Otherwise, the contents are encoded as alternating key-value pairs in an
5608- /// unkeyed container.
5607+ /// to `CodingKeyRepresentable`, the contents are encoded in a keyed
5608+ /// container. Otherwise, the contents are encoded as alternating key-value
5609+ /// pairs in an unkeyed container.
56095610 ///
56105611 /// This function throws an error if any values are invalid for the given
56115612 /// encoder's format.
@@ -5626,7 +5627,7 @@ extension Dictionary: Encodable where Key: Encodable, Value: Encodable {
56265627 let codingKey = _DictionaryCodingKey ( intValue: key as! Int )
56275628 try container. encode ( value, forKey: codingKey)
56285629 }
5629- } else if #available( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * ) ,
5630+ } else if #available( SwiftStdlib 5 . 6 , * ) ,
56305631 Key . self is CodingKeyRepresentable . Type {
56315632 // Since the keys are CodingKeyRepresentable, we can use the `codingKey`
56325633 // to create `_DictionaryCodingKey` instances.
@@ -5690,7 +5691,7 @@ extension Dictionary: Decodable where Key: Decodable, Value: Decodable {
56905691 let value = try container. decode ( Value . self, forKey: key)
56915692 self [ key. intValue! as! Key ] = value
56925693 }
5693- } else if #available( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * ) ,
5694+ } else if #available( SwiftStdlib 5 . 6 , * ) ,
56945695 let keyType = Key . self as? CodingKeyRepresentable . Type {
56955696 // The keys are CodingKeyRepresentable, so we should be able to expect
56965697 // a keyed container.
0 commit comments