From 69e737de3db0a8d5426e8ef9ee966aa0ac3abb9a Mon Sep 17 00:00:00 2001 From: Guillaume Lessard Date: Thu, 7 Mar 2024 16:51:12 -0800 Subject: [PATCH] Generate SystemString.string consistently - SystemString.string and Slice.string should be generated in the same manner. Now they are. --- Sources/System/SystemString.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Sources/System/SystemString.swift b/Sources/System/SystemString.swift index 01de8e8..2c73411 100644 --- a/Sources/System/SystemString.swift +++ b/Sources/System/SystemString.swift @@ -230,7 +230,9 @@ extension Slice where Base == SystemString { } internal var string: String { - withCodeUnits { String(decoding: $0, as: CInterop.PlatformUnicodeEncoding.self) } + withCodeUnits { + String(decoding: $0, as: CInterop.PlatformUnicodeEncoding.self) + } } internal func withPlatformString( @@ -272,7 +274,11 @@ extension SystemString: ExpressibleByStringLiteral { } extension SystemString: CustomStringConvertible, CustomDebugStringConvertible { - internal var string: String { String(decoding: self) } + internal var string: String { + self.withCodeUnits { + String(decoding: $0, as: CInterop.PlatformUnicodeEncoding.self) + } + } internal var description: String { string } internal var debugDescription: String { description.debugDescription }