From 6a7cf593bf4b35e4557290541b7982b8ab56d621 Mon Sep 17 00:00:00 2001 From: Eric Bariaux <375613+ebariaux@users.noreply.github.com> Date: Thu, 18 Sep 2025 07:20:19 +0200 Subject: [PATCH 1/3] Codable not available right-now in Embedded mode --- Sources/ComplexModule/Complex+Codable.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sources/ComplexModule/Complex+Codable.swift b/Sources/ComplexModule/Complex+Codable.swift index f7f094f7..8d86d36b 100644 --- a/Sources/ComplexModule/Complex+Codable.swift +++ b/Sources/ComplexModule/Complex+Codable.swift @@ -12,6 +12,7 @@ import RealModule // FloatingPoint does not refine Codable, so this is a conditional conformance. +@_unavailableInEmbedded extension Complex: Decodable where RealType: Decodable { public init(from decoder: Decoder) throws { var unkeyedContainer = try decoder.unkeyedContainer() @@ -21,6 +22,7 @@ extension Complex: Decodable where RealType: Decodable { } } +@_unavailableInEmbedded extension Complex: Encodable where RealType: Encodable { public func encode(to encoder: Encoder) throws { var unkeyedContainer = encoder.unkeyedContainer() From d46e20b4c551db3ea708b2358967bede1a4dbf0d Mon Sep 17 00:00:00 2001 From: Eric Bariaux <375613+ebariaux@users.noreply.github.com> Date: Thu, 18 Sep 2025 07:21:15 +0200 Subject: [PATCH 2/3] String(reflecting:) not available in Embedded mode. And Real does not conform to CustomDebugStringConvertible, so can't access debugDescription property directly on x and y --- Sources/ComplexModule/Complex+StringConvertible.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Sources/ComplexModule/Complex+StringConvertible.swift b/Sources/ComplexModule/Complex+StringConvertible.swift index 85e7f781..778bc497 100644 --- a/Sources/ComplexModule/Complex+StringConvertible.swift +++ b/Sources/ComplexModule/Complex+StringConvertible.swift @@ -16,6 +16,7 @@ extension Complex: CustomStringConvertible { } } +@_unavailableInEmbedded extension Complex: CustomDebugStringConvertible { public var debugDescription: String { "Complex<\(RealType.self)>(\(String(reflecting: x)), \(String(reflecting: y)))" From 894008997c927f8ea64e7d1ee45c1cc4804e0de0 Mon Sep 17 00:00:00 2001 From: Eric Bariaux <375613+ebariaux@users.noreply.github.com> Date: Thu, 25 Sep 2025 12:41:14 +0200 Subject: [PATCH 3/3] Ensure compatibility with Swift versions below 6 --- Sources/ComplexModule/Complex+Codable.swift | 4 ++++ Sources/ComplexModule/Complex+StringConvertible.swift | 2 ++ 2 files changed, 6 insertions(+) diff --git a/Sources/ComplexModule/Complex+Codable.swift b/Sources/ComplexModule/Complex+Codable.swift index 8d86d36b..c233cb7c 100644 --- a/Sources/ComplexModule/Complex+Codable.swift +++ b/Sources/ComplexModule/Complex+Codable.swift @@ -12,7 +12,9 @@ import RealModule // FloatingPoint does not refine Codable, so this is a conditional conformance. +#if compiler(>=6.0) @_unavailableInEmbedded +#endif extension Complex: Decodable where RealType: Decodable { public init(from decoder: Decoder) throws { var unkeyedContainer = try decoder.unkeyedContainer() @@ -22,7 +24,9 @@ extension Complex: Decodable where RealType: Decodable { } } +#if compiler(>=6.0) @_unavailableInEmbedded +#endif extension Complex: Encodable where RealType: Encodable { public func encode(to encoder: Encoder) throws { var unkeyedContainer = encoder.unkeyedContainer() diff --git a/Sources/ComplexModule/Complex+StringConvertible.swift b/Sources/ComplexModule/Complex+StringConvertible.swift index 778bc497..1c88b5b3 100644 --- a/Sources/ComplexModule/Complex+StringConvertible.swift +++ b/Sources/ComplexModule/Complex+StringConvertible.swift @@ -16,7 +16,9 @@ extension Complex: CustomStringConvertible { } } +#if compiler(>=6.0) @_unavailableInEmbedded +#endif extension Complex: CustomDebugStringConvertible { public var debugDescription: String { "Complex<\(RealType.self)>(\(String(reflecting: x)), \(String(reflecting: y)))"