From 442eea90f9817143794679d126d494dd7082d73a Mon Sep 17 00:00:00 2001 From: cham-s Date: Mon, 1 Apr 2024 17:00:10 +0200 Subject: [PATCH] Provide more type information on the JSONObject Parser --- Sources/swift-parsing-benchmark/JSON.swift | 5 ++++- Tests/ParsingTests/OneOfTests.swift | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Sources/swift-parsing-benchmark/JSON.swift b/Sources/swift-parsing-benchmark/JSON.swift index 18d4921d67..022e2e5b1d 100644 --- a/Sources/swift-parsing-benchmark/JSON.swift +++ b/Sources/swift-parsing-benchmark/JSON.swift @@ -70,7 +70,10 @@ let jsonSuite = BenchmarkSuite(name: "JSON") { suite in struct JSONObject: ParserPrinter { var body: some ParserPrinter { "{".utf8 - Many(into: [String: JSONValue.Output]()) { object, pair in + Many(into: [String: JSONValue.Output]()) { ( + object: inout [String: JSONValue.Output], + pair: (String, JSONValue.Output) + ) in let (name, value) = pair object[name] = value } decumulator: { object in diff --git a/Tests/ParsingTests/OneOfTests.swift b/Tests/ParsingTests/OneOfTests.swift index b0d829a53b..86a0bb4e5f 100644 --- a/Tests/ParsingTests/OneOfTests.swift +++ b/Tests/ParsingTests/OneOfTests.swift @@ -271,7 +271,10 @@ final class OneOfTests: XCTestCase { struct JSONObject: ParserPrinter { var body: some ParserPrinter { "{".utf8 - Many(into: [String: JSONValue.Output]()) { object, pair in + Many(into: [String: JSONValue.Output]()) { ( + object: inout [String: JSONValue.Output], + pair: (String, JSONValue.Output) + ) in let (name, value) = pair object[name] = value } decumulator: { object in