Skip to content

Commit

Permalink
Add missing arg in TOML printvalue (#57584)
Browse files Browse the repository at this point in the history
Otherwise error when calling `print_inline_table`
  • Loading branch information
qiaojunfeng authored Mar 5, 2025
1 parent e950915 commit f207224
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stdlib/TOML/src/print.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ end
# Fallback
function printvalue(f::MbyFunc, io::IO, value, sorted::Bool)
toml_value = to_toml_value(f, value)
@invokelatest printvalue(f, io, toml_value)
@invokelatest printvalue(f, io, toml_value, sorted)
end

function printvalue(f::MbyFunc, io::IO, value::AbstractVector, sorted::Bool)
Expand Down Expand Up @@ -156,7 +156,7 @@ function print_table(f::MbyFunc, io::IO, a::AbstractDict,
)

if a in inline_tables
@invokelatest print_inline_table(f, io, a)
@invokelatest print_inline_table(f, io, a, sorted)
return
end

Expand Down
16 changes: 16 additions & 0 deletions stdlib/TOML/test/print.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ loaders = ["gzip", { driver = "csv", args = {delim = "\t"}}]
a = 222
d = 333
"""

# https://github.com/JuliaLang/julia/pull/57584
d = Dict("b" => [MyStruct(1), MyStruct(2)])
@test toml_str(d) do x
x isa MyStruct && return Dict("a" => x.a)
end == """
b = [{a = 1}, {a = 2}]
"""
end

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


# https://github.com/JuliaLang/julia/pull/57584
d = Dict("a" => 1, "b" => 2)
inline_tables = IdSet{Dict}([d])
s = "{a = 1, b = 2}"
@test toml_str(d; sorted=true, inline_tables) == s


# multiline strings (#55083)
s = """
a = \"\"\"lorem ipsum
Expand Down

0 comments on commit f207224

Please sign in to comment.