File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -154,7 +154,14 @@ internal struct Parser {
154154 return text
155155 }
156156 mutating func expectString( ) throws -> String {
157- String ( decoding: try expectStringBytes ( ) , as: UTF8 . self)
157+ // TODO: Use SE-0405 once we can upgrade minimum-supported Swift version to 6.0
158+ let bytes = try expectStringBytes ( )
159+ return try bytes. withUnsafeBufferPointer {
160+ guard let value = String . _tryFromUTF8 ( $0) else {
161+ throw WatParserError ( " invalid UTF-8 string " , location: lexer. location ( ) )
162+ }
163+ return value
164+ }
158165 }
159166
160167 mutating func expectStringList( ) throws -> [ UInt8 ] {
Original file line number Diff line number Diff line change @@ -106,9 +106,7 @@ class EncoderTests: XCTestCase {
106106 }
107107
108108 var stats = CompatibilityTestStats ( )
109- let excluded : [ String ] = [
110- " utf8-invalid-encoding.wast "
111- ]
109+ let excluded : [ String ] = [ ]
112110 for wastFile in Spectest . wastFiles ( include: [ ] , exclude: excluded) {
113111 try TestSupport . withTemporaryDirectory { tempDir, shouldRetain in
114112 let jsonFileName = wastFile. deletingPathExtension ( ) . lastPathComponent + " .json "
You can’t perform that action at this time.
0 commit comments