Skip to content

Commit f207224

Browse files
authored
Add missing arg in TOML printvalue (#57584)
Otherwise error when calling `print_inline_table`
1 parent e950915 commit f207224

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

stdlib/TOML/src/print.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ end
7777
# Fallback
7878
function printvalue(f::MbyFunc, io::IO, value, sorted::Bool)
7979
toml_value = to_toml_value(f, value)
80-
@invokelatest printvalue(f, io, toml_value)
80+
@invokelatest printvalue(f, io, toml_value, sorted)
8181
end
8282

8383
function printvalue(f::MbyFunc, io::IO, value::AbstractVector, sorted::Bool)
@@ -156,7 +156,7 @@ function print_table(f::MbyFunc, io::IO, a::AbstractDict,
156156
)
157157

158158
if a in inline_tables
159-
@invokelatest print_inline_table(f, io, a)
159+
@invokelatest print_inline_table(f, io, a, sorted)
160160
return
161161
end
162162

stdlib/TOML/test/print.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ loaders = ["gzip", { driver = "csv", args = {delim = "\t"}}]
9494
a = 222
9595
d = 333
9696
"""
97+
98+
# https://github.com/JuliaLang/julia/pull/57584
99+
d = Dict("b" => [MyStruct(1), MyStruct(2)])
100+
@test toml_str(d) do x
101+
x isa MyStruct && return Dict("a" => x.a)
102+
end == """
103+
b = [{a = 1}, {a = 2}]
104+
"""
97105
end
98106

99107
@testset "unsigned integers" for (x, s) in [
@@ -196,6 +204,14 @@ LocalPkg = {path = "LocalPkg"}
196204
@test toml_str(d; sorted=true, inline_tables) == s
197205
@test roundtrip(s)
198206

207+
208+
# https://github.com/JuliaLang/julia/pull/57584
209+
d = Dict("a" => 1, "b" => 2)
210+
inline_tables = IdSet{Dict}([d])
211+
s = "{a = 1, b = 2}"
212+
@test toml_str(d; sorted=true, inline_tables) == s
213+
214+
199215
# multiline strings (#55083)
200216
s = """
201217
a = \"\"\"lorem ipsum

0 commit comments

Comments
 (0)