Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make return with no value return Nothing #35

Closed
StefanKarpinski opened this issue Jun 6, 2011 · 3 comments
Closed

make return with no value return Nothing #35

StefanKarpinski opened this issue Jun 6, 2011 · 3 comments
Assignees

Comments

@StefanKarpinski
Copy link
Member

Depends on issue #28.

@ghost ghost assigned StefanKarpinski Jun 6, 2011
@JeffBezanson
Copy link
Member

OK, this is taken care of. Now return by itself parses as (return (null)).

@StefanKarpinski
Copy link
Member Author

Ah, nice. So by making (null) return as Nothing this will fix the issue completely?

@JeffBezanson
Copy link
Member

Yes!

@ghost ghost assigned JeffBezanson Jun 7, 2011
ararslan pushed a commit that referenced this issue Feb 3, 2017
ararslan pushed a commit that referenced this issue Feb 3, 2017
StefanKarpinski pushed a commit that referenced this issue Feb 8, 2018
Ipnets / IPAddr compatibility
StefanKarpinski pushed a commit that referenced this issue Feb 8, 2018
Fix wrong use of reinterpret
StefanKarpinski pushed a commit that referenced this issue Feb 8, 2018
cmcaine pushed a commit to cmcaine/julia that referenced this issue Sep 24, 2020
aviatesk added a commit that referenced this issue May 30, 2021
Previously the printing pass for converted data only works for
non-tabular data (like simple number literals), and it doesn't work for
`Dict` or `Array`s. Rather it leads to runtime error because we don't
pass over the same `by` keyword  argument through recursive calls and it
may not be assigned:
```julia
julia> struct MyStruct
           a::Int
       end

julia> data = Dict(:foo => MyStruct(1))
Dict{Symbol, MyStruct} with 1 entry:
  :foo => MyStruct(1)

julia> TOML.print(data; softed=true) do x
           x isa MyStruct && return Dict(:bar => x.a)
       end
ERROR: MethodError: no method matching print(::var"#38#39", ::Dict{Symbol, MyStruct}; softed=true)
You may have intended to import Base.print
Closest candidates are:
  print(::Union{Nothing, Function}, ::AbstractDict; sorted, by) at /Users/aviatesk/julia/julia/stdlib/TOML/src/print.jl:130 got unsupported keyword argument "softed"
  print(::Union{Nothing, Function}, ::IO, ::AbstractDict; sorted, by) at /Users/aviatesk/julia/julia/stdlib/TOML/src/print.jl:129 got unsupported keyword argument "softed"
  print(::IO, ::AbstractDict; sorted, by) at /Users/aviatesk/julia/julia/stdlib/TOML/src/print.jl:131 got unsupported keyword argument "softed"
Stacktrace:
 [1] kwerr(::NamedTuple{(:softed,), Tuple{Bool}}, ::Function, ::Function, ::Dict{Symbol, MyStruct})
   @ Base ./error.jl:163
 [2] top-level scope
   @ none:1
```

<details><summary>Originally reported by JET:</summary>
julia> using JET, Pkg

julia> @report_call Pkg.project()
═════ 3 possible errors found ═════
┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/API.jl:103 Pkg.API.EnvCache()
│┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/Types.jl:285 #self#(Pkg.Types.nothing)
││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/Types.jl:288 Pkg.Types.read_project(project_file)
│││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/project.jl:138 Pkg.Types.sprint(Pkg.Types.showerror, e)
││││┌ @ strings/io.jl:106 Base.#sprint#412(Core.tuple(Base.nothing, 0, #self#, f), args...)
│││││┌ @ strings/io.jl:112 f(Core.tuple(s), args...)
││││││┌ @ toml_parser.jl:326 Base.TOML.point_to_line(Base.getproperty(err, :str), pos, pos, io)
│││││││ for 1 of union split cases, no matching method found for call signatures (Tuple{typeof(Base.TOML.point_to_line), Nothing, Int64, Int64, IOBuffer})): Base.TOML.point_to_line(Base.getproperty(err::Base.TOML.ParserError, :str::Symbol)::Union{Nothing, String}, pos::Int64, pos::Int64, io::IOBuffer)
││││││└──────────────────────
│││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/project.jl:142 Pkg.Types.Project(raw)
││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/project.jl:124 Base.setproperty!(project, :targets, Pkg.Types.read_project_targets(Pkg.Types.get(raw, "targets", Pkg.Types.nothing), project))
│││││┌ @ Base.jl:35 Base.convert(Base.fieldtype(Base.typeof(x), f), v)
││││││┌ @ abstractdict.jl:523 _(x)
│││││││┌ @ dict.jl:104 Base.setindex!(h, v, k)
││││││││┌ @ dict.jl:382 Base.convert(_, v0)
│││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/LinearAlgebra/src/factorization.jl:58 _(f)
││││││││││ no matching method found for call signature (Tuple{Type{Vector{String}}, LinearAlgebra.Factorization}): _::Type{Vector{String}}(f::LinearAlgebra.Factorization)
│││││││││└─────────────────────────────────────────────────────────────────────────────────────────────────
││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/Types.jl:305 Pkg.Types.write_env_usage(manifest_file, "manifest_usage.toml")
│││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/Types.jl:436 Pkg.Types.sprint(#35)
││││┌ @ strings/io.jl:106 Base.#sprint#412(Core.tuple(Base.nothing, 0, #self#, f), args...)
│││││┌ @ strings/io.jl:112 f(Core.tuple(s), args...)
││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/Types.jl:437 TOML.print(io, Pkg.Types.Dict(Pkg.Types.=>(Core.getfield(#self#, :source_file), Base.vect(Pkg.Types.Dict(Pkg.Types.=>("time", Pkg.Types.now()))))))
│││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:131 TOML.Internals.Printer.#print#16(false, TOML.Internals.Printer.identity, #self#, io, a)
││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:131 Core.kwfunc(TOML.Internals.Printer._print)(Core.apply_type(Core.NamedTuple, (:sorted, :by))(Core.tuple(sorted, by)), TOML.Internals.Printer._print, TOML.Internals.Printer.nothing, io, a)
│││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:76 #s848(_2, _3, f, io, a, Base.getindex(TOML.Internals.Printer.String))
││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:76 TOML.Internals.Printer.#_print#11(indent, first_block, sorted, by, _3, f, io, a, ks)
│││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:88 Core.kwfunc(TOML.Internals.Printer.printvalue)(Core.apply_type(Core.NamedTuple, (:sorted,))(Core.tuple(sorted)), TOML.Internals.Printer.printvalue, f, io, value)
││││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:25 TOML.Internals.Printer.#printvalue#1(sorted, _3, f, io, value)
│││││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:29 Core.kwfunc(TOML.Internals.Printer._print)(Core.apply_type(Core.NamedTuple, (:sorted,))(Core.tuple(sorted)), TOML.Internals.Printer._print, f, io, x)
││││││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:76 #s848(_2, _3, f, io, a, Base.getindex(TOML.Internals.Printer.String))
│││││││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:76 Core.throw(Core.UndefKeywordError(:by))
││││││││││││││││ UndefKeywordError: keyword argument by not assigned
│││││││││││││││└────────────────────────────────────────────────────────────────────────────────
Pkg.API.ProjectInfo
</details>

With this PR, everything should work:
> After
```julia
julia> TOML.print(data; sorted=true) do x
           x isa MyStruct && return Dict(:bar => x.a)
       end
[foo]
bar = 1
```
aviatesk added a commit that referenced this issue May 30, 2021
Previously the printing pass for converted data only works for
non-tabular data (like simple number literals), and it doesn't work for
`Dict` or `Array`s. Rather it leads to runtime error because we don't
pass over the same `by` keyword  argument through recursive calls and it
may not be assigned:
```julia
julia> struct MyStruct
           a::Int
       end

julia> data = Dict(:foo => MyStruct(1))
Dict{Symbol, MyStruct} with 1 entry:
  :foo => MyStruct(1)

julia> TOML.print(data; softed=true) do x
           x isa MyStruct && return Dict(:bar => x.a)
       end
ERROR: MethodError: no method matching print(::var"#38#39", ::Dict{Symbol, MyStruct}; softed=true)
You may have intended to import Base.print
Closest candidates are:
  print(::Union{Nothing, Function}, ::AbstractDict; sorted, by) at /Users/aviatesk/julia/julia/stdlib/TOML/src/print.jl:130 got unsupported keyword argument "softed"
  print(::Union{Nothing, Function}, ::IO, ::AbstractDict; sorted, by) at /Users/aviatesk/julia/julia/stdlib/TOML/src/print.jl:129 got unsupported keyword argument "softed"
  print(::IO, ::AbstractDict; sorted, by) at /Users/aviatesk/julia/julia/stdlib/TOML/src/print.jl:131 got unsupported keyword argument "softed"
Stacktrace:
 [1] kwerr(::NamedTuple{(:softed,), Tuple{Bool}}, ::Function, ::Function, ::Dict{Symbol, MyStruct})
   @ Base ./error.jl:163
 [2] top-level scope
   @ none:1
```

<details><summary>Originally reported by JET:</summary>
julia> using JET, Pkg

julia> @report_call Pkg.project()
═════ 3 possible errors found ═════
┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/API.jl:103 Pkg.API.EnvCache()
│┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/Types.jl:285 #self#(Pkg.Types.nothing)
││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/Types.jl:288 Pkg.Types.read_project(project_file)
│││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/project.jl:138 Pkg.Types.sprint(Pkg.Types.showerror, e)
││││┌ @ strings/io.jl:106 Base.#sprint#412(Core.tuple(Base.nothing, 0, #self#, f), args...)
│││││┌ @ strings/io.jl:112 f(Core.tuple(s), args...)
││││││┌ @ toml_parser.jl:326 Base.TOML.point_to_line(Base.getproperty(err, :str), pos, pos, io)
│││││││ for 1 of union split cases, no matching method found for call signatures (Tuple{typeof(Base.TOML.point_to_line), Nothing, Int64, Int64, IOBuffer})): Base.TOML.point_to_line(Base.getproperty(err::Base.TOML.ParserError, :str::Symbol)::Union{Nothing, String}, pos::Int64, pos::Int64, io::IOBuffer)
││││││└──────────────────────
│││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/project.jl:142 Pkg.Types.Project(raw)
││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/project.jl:124 Base.setproperty!(project, :targets, Pkg.Types.read_project_targets(Pkg.Types.get(raw, "targets", Pkg.Types.nothing), project))
│││││┌ @ Base.jl:35 Base.convert(Base.fieldtype(Base.typeof(x), f), v)
││││││┌ @ abstractdict.jl:523 _(x)
│││││││┌ @ dict.jl:104 Base.setindex!(h, v, k)
││││││││┌ @ dict.jl:382 Base.convert(_, v0)
│││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/LinearAlgebra/src/factorization.jl:58 _(f)
││││││││││ no matching method found for call signature (Tuple{Type{Vector{String}}, LinearAlgebra.Factorization}): _::Type{Vector{String}}(f::LinearAlgebra.Factorization)
│││││││││└─────────────────────────────────────────────────────────────────────────────────────────────────
││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/Types.jl:305 Pkg.Types.write_env_usage(manifest_file, "manifest_usage.toml")
│││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/Types.jl:436 Pkg.Types.sprint(#35)
││││┌ @ strings/io.jl:106 Base.#sprint#412(Core.tuple(Base.nothing, 0, #self#, f), args...)
│││││┌ @ strings/io.jl:112 f(Core.tuple(s), args...)
││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/Types.jl:437 TOML.print(io, Pkg.Types.Dict(Pkg.Types.=>(Core.getfield(#self#, :source_file), Base.vect(Pkg.Types.Dict(Pkg.Types.=>("time", Pkg.Types.now()))))))
│││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:131 TOML.Internals.Printer.#print#16(false, TOML.Internals.Printer.identity, #self#, io, a)
││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:131 Core.kwfunc(TOML.Internals.Printer._print)(Core.apply_type(Core.NamedTuple, (:sorted, :by))(Core.tuple(sorted, by)), TOML.Internals.Printer._print, TOML.Internals.Printer.nothing, io, a)
│││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:76 #s848(_2, _3, f, io, a, Base.getindex(TOML.Internals.Printer.String))
││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:76 TOML.Internals.Printer.#_print#11(indent, first_block, sorted, by, _3, f, io, a, ks)
│││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:88 Core.kwfunc(TOML.Internals.Printer.printvalue)(Core.apply_type(Core.NamedTuple, (:sorted,))(Core.tuple(sorted)), TOML.Internals.Printer.printvalue, f, io, value)
││││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:25 TOML.Internals.Printer.#printvalue#1(sorted, _3, f, io, value)
│││││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:29 Core.kwfunc(TOML.Internals.Printer._print)(Core.apply_type(Core.NamedTuple, (:sorted,))(Core.tuple(sorted)), TOML.Internals.Printer._print, f, io, x)
││││││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:76 #s848(_2, _3, f, io, a, Base.getindex(TOML.Internals.Printer.String))
│││││││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:76 Core.throw(Core.UndefKeywordError(:by))
││││││││││││││││ UndefKeywordError: keyword argument by not assigned
│││││││││││││││└────────────────────────────────────────────────────────────────────────────────
Pkg.API.ProjectInfo
</details>

With this PR, everything should work:
> After
```julia
julia> TOML.print(data; sorted=true) do x
           x isa MyStruct && return Dict(:bar => x.a)
       end
[foo]
bar = 1
```
shirodkara pushed a commit to shirodkara/julia that referenced this issue Jun 9, 2021
Previously the printing pass for converted data only works for
non-tabular data (like simple number literals), and it doesn't work for
`Dict` or `Array`s. Rather it leads to runtime error because we don't
pass over the same `by` keyword  argument through recursive calls and it
may not be assigned:
```julia
julia> struct MyStruct
           a::Int
       end

julia> data = Dict(:foo => MyStruct(1))
Dict{Symbol, MyStruct} with 1 entry:
  :foo => MyStruct(1)

julia> TOML.print(data; softed=true) do x
           x isa MyStruct && return Dict(:bar => x.a)
       end
ERROR: MethodError: no method matching print(::var"JuliaLang#38#39", ::Dict{Symbol, MyStruct}; softed=true)
You may have intended to import Base.print
Closest candidates are:
  print(::Union{Nothing, Function}, ::AbstractDict; sorted, by) at /Users/aviatesk/julia/julia/stdlib/TOML/src/print.jl:130 got unsupported keyword argument "softed"
  print(::Union{Nothing, Function}, ::IO, ::AbstractDict; sorted, by) at /Users/aviatesk/julia/julia/stdlib/TOML/src/print.jl:129 got unsupported keyword argument "softed"
  print(::IO, ::AbstractDict; sorted, by) at /Users/aviatesk/julia/julia/stdlib/TOML/src/print.jl:131 got unsupported keyword argument "softed"
Stacktrace:
 [1] kwerr(::NamedTuple{(:softed,), Tuple{Bool}}, ::Function, ::Function, ::Dict{Symbol, MyStruct})
   @ Base ./error.jl:163
 [2] top-level scope
   @ none:1
```

<details><summary>Originally reported by JET:</summary>
julia> using JET, Pkg

julia> @report_call Pkg.project()
═════ 3 possible errors found ═════
┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/API.jl:103 Pkg.API.EnvCache()
│┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/Types.jl:285 #self#(Pkg.Types.nothing)
││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/Types.jl:288 Pkg.Types.read_project(project_file)
│││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/project.jl:138 Pkg.Types.sprint(Pkg.Types.showerror, e)
││││┌ @ strings/io.jl:106 Base.#sprint#412(Core.tuple(Base.nothing, 0, #self#, f), args...)
│││││┌ @ strings/io.jl:112 f(Core.tuple(s), args...)
││││││┌ @ toml_parser.jl:326 Base.TOML.point_to_line(Base.getproperty(err, :str), pos, pos, io)
│││││││ for 1 of union split cases, no matching method found for call signatures (Tuple{typeof(Base.TOML.point_to_line), Nothing, Int64, Int64, IOBuffer})): Base.TOML.point_to_line(Base.getproperty(err::Base.TOML.ParserError, :str::Symbol)::Union{Nothing, String}, pos::Int64, pos::Int64, io::IOBuffer)
││││││└──────────────────────
│││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/project.jl:142 Pkg.Types.Project(raw)
││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/project.jl:124 Base.setproperty!(project, :targets, Pkg.Types.read_project_targets(Pkg.Types.get(raw, "targets", Pkg.Types.nothing), project))
│││││┌ @ Base.jl:35 Base.convert(Base.fieldtype(Base.typeof(x), f), v)
││││││┌ @ abstractdict.jl:523 _(x)
│││││││┌ @ dict.jl:104 Base.setindex!(h, v, k)
││││││││┌ @ dict.jl:382 Base.convert(_, v0)
│││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/LinearAlgebra/src/factorization.jl:58 _(f)
││││││││││ no matching method found for call signature (Tuple{Type{Vector{String}}, LinearAlgebra.Factorization}): _::Type{Vector{String}}(f::LinearAlgebra.Factorization)
│││││││││└─────────────────────────────────────────────────────────────────────────────────────────────────
││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/Types.jl:305 Pkg.Types.write_env_usage(manifest_file, "manifest_usage.toml")
│││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/Types.jl:436 Pkg.Types.sprint(JuliaLang#35)
││││┌ @ strings/io.jl:106 Base.#sprint#412(Core.tuple(Base.nothing, 0, #self#, f), args...)
│││││┌ @ strings/io.jl:112 f(Core.tuple(s), args...)
││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/Types.jl:437 TOML.print(io, Pkg.Types.Dict(Pkg.Types.=>(Core.getfield(#self#, :source_file), Base.vect(Pkg.Types.Dict(Pkg.Types.=>("time", Pkg.Types.now()))))))
│││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:131 TOML.Internals.Printer.#print#16(false, TOML.Internals.Printer.identity, #self#, io, a)
││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:131 Core.kwfunc(TOML.Internals.Printer._print)(Core.apply_type(Core.NamedTuple, (:sorted, :by))(Core.tuple(sorted, by)), TOML.Internals.Printer._print, TOML.Internals.Printer.nothing, io, a)
│││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:76 #s848(_2, _3, f, io, a, Base.getindex(TOML.Internals.Printer.String))
││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:76 TOML.Internals.Printer.#_print#11(indent, first_block, sorted, by, _3, f, io, a, ks)
│││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:88 Core.kwfunc(TOML.Internals.Printer.printvalue)(Core.apply_type(Core.NamedTuple, (:sorted,))(Core.tuple(sorted)), TOML.Internals.Printer.printvalue, f, io, value)
││││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:25 TOML.Internals.Printer.#printvalue#1(sorted, _3, f, io, value)
│││││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:29 Core.kwfunc(TOML.Internals.Printer._print)(Core.apply_type(Core.NamedTuple, (:sorted,))(Core.tuple(sorted)), TOML.Internals.Printer._print, f, io, x)
││││││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:76 #s848(_2, _3, f, io, a, Base.getindex(TOML.Internals.Printer.String))
│││││││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:76 Core.throw(Core.UndefKeywordError(:by))
││││││││││││││││ UndefKeywordError: keyword argument by not assigned
│││││││││││││││└────────────────────────────────────────────────────────────────────────────────
Pkg.API.ProjectInfo
</details>

With this PR, everything should work:
> After
```julia
julia> TOML.print(data; sorted=true) do x
           x isa MyStruct && return Dict(:bar => x.a)
       end
[foo]
bar = 1
```
KristofferC pushed a commit that referenced this issue Jun 10, 2021
Previously the printing pass for converted data only works for
non-tabular data (like simple number literals), and it doesn't work for
`Dict` or `Array`s. Rather it leads to runtime error because we don't
pass over the same `by` keyword  argument through recursive calls and it
may not be assigned:
```julia
julia> struct MyStruct
           a::Int
       end

julia> data = Dict(:foo => MyStruct(1))
Dict{Symbol, MyStruct} with 1 entry:
  :foo => MyStruct(1)

julia> TOML.print(data; softed=true) do x
           x isa MyStruct && return Dict(:bar => x.a)
       end
ERROR: MethodError: no method matching print(::var"#38#39", ::Dict{Symbol, MyStruct}; softed=true)
You may have intended to import Base.print
Closest candidates are:
  print(::Union{Nothing, Function}, ::AbstractDict; sorted, by) at /Users/aviatesk/julia/julia/stdlib/TOML/src/print.jl:130 got unsupported keyword argument "softed"
  print(::Union{Nothing, Function}, ::IO, ::AbstractDict; sorted, by) at /Users/aviatesk/julia/julia/stdlib/TOML/src/print.jl:129 got unsupported keyword argument "softed"
  print(::IO, ::AbstractDict; sorted, by) at /Users/aviatesk/julia/julia/stdlib/TOML/src/print.jl:131 got unsupported keyword argument "softed"
Stacktrace:
 [1] kwerr(::NamedTuple{(:softed,), Tuple{Bool}}, ::Function, ::Function, ::Dict{Symbol, MyStruct})
   @ Base ./error.jl:163
 [2] top-level scope
   @ none:1
```

<details><summary>Originally reported by JET:</summary>
julia> using JET, Pkg

julia> @report_call Pkg.project()
═════ 3 possible errors found ═════
┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/API.jl:103 Pkg.API.EnvCache()
│┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/Types.jl:285 #self#(Pkg.Types.nothing)
││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/Types.jl:288 Pkg.Types.read_project(project_file)
│││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/project.jl:138 Pkg.Types.sprint(Pkg.Types.showerror, e)
││││┌ @ strings/io.jl:106 Base.#sprint#412(Core.tuple(Base.nothing, 0, #self#, f), args...)
│││││┌ @ strings/io.jl:112 f(Core.tuple(s), args...)
││││││┌ @ toml_parser.jl:326 Base.TOML.point_to_line(Base.getproperty(err, :str), pos, pos, io)
│││││││ for 1 of union split cases, no matching method found for call signatures (Tuple{typeof(Base.TOML.point_to_line), Nothing, Int64, Int64, IOBuffer})): Base.TOML.point_to_line(Base.getproperty(err::Base.TOML.ParserError, :str::Symbol)::Union{Nothing, String}, pos::Int64, pos::Int64, io::IOBuffer)
││││││└──────────────────────
│││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/project.jl:142 Pkg.Types.Project(raw)
││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/project.jl:124 Base.setproperty!(project, :targets, Pkg.Types.read_project_targets(Pkg.Types.get(raw, "targets", Pkg.Types.nothing), project))
│││││┌ @ Base.jl:35 Base.convert(Base.fieldtype(Base.typeof(x), f), v)
││││││┌ @ abstractdict.jl:523 _(x)
│││││││┌ @ dict.jl:104 Base.setindex!(h, v, k)
││││││││┌ @ dict.jl:382 Base.convert(_, v0)
│││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/LinearAlgebra/src/factorization.jl:58 _(f)
││││││││││ no matching method found for call signature (Tuple{Type{Vector{String}}, LinearAlgebra.Factorization}): _::Type{Vector{String}}(f::LinearAlgebra.Factorization)
│││││││││└─────────────────────────────────────────────────────────────────────────────────────────────────
││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/Types.jl:305 Pkg.Types.write_env_usage(manifest_file, "manifest_usage.toml")
│││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/Types.jl:436 Pkg.Types.sprint(#35)
││││┌ @ strings/io.jl:106 Base.#sprint#412(Core.tuple(Base.nothing, 0, #self#, f), args...)
│││││┌ @ strings/io.jl:112 f(Core.tuple(s), args...)
││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/Types.jl:437 TOML.print(io, Pkg.Types.Dict(Pkg.Types.=>(Core.getfield(#self#, :source_file), Base.vect(Pkg.Types.Dict(Pkg.Types.=>("time", Pkg.Types.now()))))))
│││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:131 TOML.Internals.Printer.#print#16(false, TOML.Internals.Printer.identity, #self#, io, a)
││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:131 Core.kwfunc(TOML.Internals.Printer._print)(Core.apply_type(Core.NamedTuple, (:sorted, :by))(Core.tuple(sorted, by)), TOML.Internals.Printer._print, TOML.Internals.Printer.nothing, io, a)
│││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:76 #s848(_2, _3, f, io, a, Base.getindex(TOML.Internals.Printer.String))
││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:76 TOML.Internals.Printer.#_print#11(indent, first_block, sorted, by, _3, f, io, a, ks)
│││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:88 Core.kwfunc(TOML.Internals.Printer.printvalue)(Core.apply_type(Core.NamedTuple, (:sorted,))(Core.tuple(sorted)), TOML.Internals.Printer.printvalue, f, io, value)
││││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:25 TOML.Internals.Printer.#printvalue#1(sorted, _3, f, io, value)
│││││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:29 Core.kwfunc(TOML.Internals.Printer._print)(Core.apply_type(Core.NamedTuple, (:sorted,))(Core.tuple(sorted)), TOML.Internals.Printer._print, f, io, x)
││││││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:76 #s848(_2, _3, f, io, a, Base.getindex(TOML.Internals.Printer.String))
│││││││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:76 Core.throw(Core.UndefKeywordError(:by))
││││││││││││││││ UndefKeywordError: keyword argument by not assigned
│││││││││││││││└────────────────────────────────────────────────────────────────────────────────
Pkg.API.ProjectInfo
</details>

With this PR, everything should work:
> After
```julia
julia> TOML.print(data; sorted=true) do x
           x isa MyStruct && return Dict(:bar => x.a)
       end
[foo]
bar = 1
```

(cherry picked from commit 311ff56)
johanmon pushed a commit to johanmon/julia that referenced this issue Jul 5, 2021
Previously the printing pass for converted data only works for
non-tabular data (like simple number literals), and it doesn't work for
`Dict` or `Array`s. Rather it leads to runtime error because we don't
pass over the same `by` keyword  argument through recursive calls and it
may not be assigned:
```julia
julia> struct MyStruct
           a::Int
       end

julia> data = Dict(:foo => MyStruct(1))
Dict{Symbol, MyStruct} with 1 entry:
  :foo => MyStruct(1)

julia> TOML.print(data; softed=true) do x
           x isa MyStruct && return Dict(:bar => x.a)
       end
ERROR: MethodError: no method matching print(::var"JuliaLang#38#39", ::Dict{Symbol, MyStruct}; softed=true)
You may have intended to import Base.print
Closest candidates are:
  print(::Union{Nothing, Function}, ::AbstractDict; sorted, by) at /Users/aviatesk/julia/julia/stdlib/TOML/src/print.jl:130 got unsupported keyword argument "softed"
  print(::Union{Nothing, Function}, ::IO, ::AbstractDict; sorted, by) at /Users/aviatesk/julia/julia/stdlib/TOML/src/print.jl:129 got unsupported keyword argument "softed"
  print(::IO, ::AbstractDict; sorted, by) at /Users/aviatesk/julia/julia/stdlib/TOML/src/print.jl:131 got unsupported keyword argument "softed"
Stacktrace:
 [1] kwerr(::NamedTuple{(:softed,), Tuple{Bool}}, ::Function, ::Function, ::Dict{Symbol, MyStruct})
   @ Base ./error.jl:163
 [2] top-level scope
   @ none:1
```

<details><summary>Originally reported by JET:</summary>
julia> using JET, Pkg

julia> @report_call Pkg.project()
═════ 3 possible errors found ═════
┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/API.jl:103 Pkg.API.EnvCache()
│┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/Types.jl:285 #self#(Pkg.Types.nothing)
││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/Types.jl:288 Pkg.Types.read_project(project_file)
│││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/project.jl:138 Pkg.Types.sprint(Pkg.Types.showerror, e)
││││┌ @ strings/io.jl:106 Base.#sprint#412(Core.tuple(Base.nothing, 0, #self#, f), args...)
│││││┌ @ strings/io.jl:112 f(Core.tuple(s), args...)
││││││┌ @ toml_parser.jl:326 Base.TOML.point_to_line(Base.getproperty(err, :str), pos, pos, io)
│││││││ for 1 of union split cases, no matching method found for call signatures (Tuple{typeof(Base.TOML.point_to_line), Nothing, Int64, Int64, IOBuffer})): Base.TOML.point_to_line(Base.getproperty(err::Base.TOML.ParserError, :str::Symbol)::Union{Nothing, String}, pos::Int64, pos::Int64, io::IOBuffer)
││││││└──────────────────────
│││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/project.jl:142 Pkg.Types.Project(raw)
││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/project.jl:124 Base.setproperty!(project, :targets, Pkg.Types.read_project_targets(Pkg.Types.get(raw, "targets", Pkg.Types.nothing), project))
│││││┌ @ Base.jl:35 Base.convert(Base.fieldtype(Base.typeof(x), f), v)
││││││┌ @ abstractdict.jl:523 _(x)
│││││││┌ @ dict.jl:104 Base.setindex!(h, v, k)
││││││││┌ @ dict.jl:382 Base.convert(_, v0)
│││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/LinearAlgebra/src/factorization.jl:58 _(f)
││││││││││ no matching method found for call signature (Tuple{Type{Vector{String}}, LinearAlgebra.Factorization}): _::Type{Vector{String}}(f::LinearAlgebra.Factorization)
│││││││││└─────────────────────────────────────────────────────────────────────────────────────────────────
││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/Types.jl:305 Pkg.Types.write_env_usage(manifest_file, "manifest_usage.toml")
│││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/Types.jl:436 Pkg.Types.sprint(JuliaLang#35)
││││┌ @ strings/io.jl:106 Base.#sprint#412(Core.tuple(Base.nothing, 0, #self#, f), args...)
│││││┌ @ strings/io.jl:112 f(Core.tuple(s), args...)
││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/Types.jl:437 TOML.print(io, Pkg.Types.Dict(Pkg.Types.=>(Core.getfield(#self#, :source_file), Base.vect(Pkg.Types.Dict(Pkg.Types.=>("time", Pkg.Types.now()))))))
│││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:131 TOML.Internals.Printer.#print#16(false, TOML.Internals.Printer.identity, #self#, io, a)
││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:131 Core.kwfunc(TOML.Internals.Printer._print)(Core.apply_type(Core.NamedTuple, (:sorted, :by))(Core.tuple(sorted, by)), TOML.Internals.Printer._print, TOML.Internals.Printer.nothing, io, a)
│││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:76 #s848(_2, _3, f, io, a, Base.getindex(TOML.Internals.Printer.String))
││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:76 TOML.Internals.Printer.#_print#11(indent, first_block, sorted, by, _3, f, io, a, ks)
│││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:88 Core.kwfunc(TOML.Internals.Printer.printvalue)(Core.apply_type(Core.NamedTuple, (:sorted,))(Core.tuple(sorted)), TOML.Internals.Printer.printvalue, f, io, value)
││││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:25 TOML.Internals.Printer.#printvalue#1(sorted, _3, f, io, value)
│││││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:29 Core.kwfunc(TOML.Internals.Printer._print)(Core.apply_type(Core.NamedTuple, (:sorted,))(Core.tuple(sorted)), TOML.Internals.Printer._print, f, io, x)
││││││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:76 #s848(_2, _3, f, io, a, Base.getindex(TOML.Internals.Printer.String))
│││││││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:76 Core.throw(Core.UndefKeywordError(:by))
││││││││││││││││ UndefKeywordError: keyword argument by not assigned
│││││││││││││││└────────────────────────────────────────────────────────────────────────────────
Pkg.API.ProjectInfo
</details>

With this PR, everything should work:
> After
```julia
julia> TOML.print(data; sorted=true) do x
           x isa MyStruct && return Dict(:bar => x.a)
       end
[foo]
bar = 1
```
LilithHafner pushed a commit to LilithHafner/julia that referenced this issue Oct 11, 2021
staticfloat pushed a commit that referenced this issue Dec 23, 2022
Previously the printing pass for converted data only works for
non-tabular data (like simple number literals), and it doesn't work for
`Dict` or `Array`s. Rather it leads to runtime error because we don't
pass over the same `by` keyword  argument through recursive calls and it
may not be assigned:
```julia
julia> struct MyStruct
           a::Int
       end

julia> data = Dict(:foo => MyStruct(1))
Dict{Symbol, MyStruct} with 1 entry:
  :foo => MyStruct(1)

julia> TOML.print(data; softed=true) do x
           x isa MyStruct && return Dict(:bar => x.a)
       end
ERROR: MethodError: no method matching print(::var"#38#39", ::Dict{Symbol, MyStruct}; softed=true)
You may have intended to import Base.print
Closest candidates are:
  print(::Union{Nothing, Function}, ::AbstractDict; sorted, by) at /Users/aviatesk/julia/julia/stdlib/TOML/src/print.jl:130 got unsupported keyword argument "softed"
  print(::Union{Nothing, Function}, ::IO, ::AbstractDict; sorted, by) at /Users/aviatesk/julia/julia/stdlib/TOML/src/print.jl:129 got unsupported keyword argument "softed"
  print(::IO, ::AbstractDict; sorted, by) at /Users/aviatesk/julia/julia/stdlib/TOML/src/print.jl:131 got unsupported keyword argument "softed"
Stacktrace:
 [1] kwerr(::NamedTuple{(:softed,), Tuple{Bool}}, ::Function, ::Function, ::Dict{Symbol, MyStruct})
   @ Base ./error.jl:163
 [2] top-level scope
   @ none:1
```

<details><summary>Originally reported by JET:</summary>
julia> using JET, Pkg

julia> @report_call Pkg.project()
═════ 3 possible errors found ═════
┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/API.jl:103 Pkg.API.EnvCache()
│┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/Types.jl:285 #self#(Pkg.Types.nothing)
││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/Types.jl:288 Pkg.Types.read_project(project_file)
│││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/project.jl:138 Pkg.Types.sprint(Pkg.Types.showerror, e)
││││┌ @ strings/io.jl:106 Base.#sprint#412(Core.tuple(Base.nothing, 0, #self#, f), args...)
│││││┌ @ strings/io.jl:112 f(Core.tuple(s), args...)
││││││┌ @ toml_parser.jl:326 Base.TOML.point_to_line(Base.getproperty(err, :str), pos, pos, io)
│││││││ for 1 of union split cases, no matching method found for call signatures (Tuple{typeof(Base.TOML.point_to_line), Nothing, Int64, Int64, IOBuffer})): Base.TOML.point_to_line(Base.getproperty(err::Base.TOML.ParserError, :str::Symbol)::Union{Nothing, String}, pos::Int64, pos::Int64, io::IOBuffer)
││││││└──────────────────────
│││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/project.jl:142 Pkg.Types.Project(raw)
││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/project.jl:124 Base.setproperty!(project, :targets, Pkg.Types.read_project_targets(Pkg.Types.get(raw, "targets", Pkg.Types.nothing), project))
│││││┌ @ Base.jl:35 Base.convert(Base.fieldtype(Base.typeof(x), f), v)
││││││┌ @ abstractdict.jl:523 _(x)
│││││││┌ @ dict.jl:104 Base.setindex!(h, v, k)
││││││││┌ @ dict.jl:382 Base.convert(_, v0)
│││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/LinearAlgebra/src/factorization.jl:58 _(f)
││││││││││ no matching method found for call signature (Tuple{Type{Vector{String}}, LinearAlgebra.Factorization}): _::Type{Vector{String}}(f::LinearAlgebra.Factorization)
│││││││││└─────────────────────────────────────────────────────────────────────────────────────────────────
││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/Types.jl:305 Pkg.Types.write_env_usage(manifest_file, "manifest_usage.toml")
│││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/Types.jl:436 Pkg.Types.sprint(#35)
││││┌ @ strings/io.jl:106 Base.#sprint#412(Core.tuple(Base.nothing, 0, #self#, f), args...)
│││││┌ @ strings/io.jl:112 f(Core.tuple(s), args...)
││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/Pkg/src/Types.jl:437 TOML.print(io, Pkg.Types.Dict(Pkg.Types.=>(Core.getfield(#self#, :source_file), Base.vect(Pkg.Types.Dict(Pkg.Types.=>("time", Pkg.Types.now()))))))
│││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:131 TOML.Internals.Printer.#print#16(false, TOML.Internals.Printer.identity, #self#, io, a)
││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:131 Core.kwfunc(TOML.Internals.Printer._print)(Core.apply_type(Core.NamedTuple, (:sorted, :by))(Core.tuple(sorted, by)), TOML.Internals.Printer._print, TOML.Internals.Printer.nothing, io, a)
│││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:76 #s848(_2, _3, f, io, a, Base.getindex(TOML.Internals.Printer.String))
││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:76 TOML.Internals.Printer.#_print#11(indent, first_block, sorted, by, _3, f, io, a, ks)
│││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:88 Core.kwfunc(TOML.Internals.Printer.printvalue)(Core.apply_type(Core.NamedTuple, (:sorted,))(Core.tuple(sorted)), TOML.Internals.Printer.printvalue, f, io, value)
││││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:25 TOML.Internals.Printer.#printvalue#1(sorted, _3, f, io, value)
│││││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:29 Core.kwfunc(TOML.Internals.Printer._print)(Core.apply_type(Core.NamedTuple, (:sorted,))(Core.tuple(sorted)), TOML.Internals.Printer._print, f, io, x)
││││││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:76 #s848(_2, _3, f, io, a, Base.getindex(TOML.Internals.Printer.String))
│││││││││││││││┌ @ /Users/aviatesk/julia/julia/usr/share/julia/stdlib/v1.7/TOML/src/print.jl:76 Core.throw(Core.UndefKeywordError(:by))
││││││││││││││││ UndefKeywordError: keyword argument by not assigned
│││││││││││││││└────────────────────────────────────────────────────────────────────────────────
Pkg.API.ProjectInfo
</details>

With this PR, everything should work:
> After
```julia
julia> TOML.print(data; sorted=true) do x
           x isa MyStruct && return Dict(:bar => x.a)
       end
[foo]
bar = 1
```

(cherry picked from commit 311ff56)
NHDaly pushed a commit that referenced this issue Sep 19, 2023
vtjnash pushed a commit that referenced this issue Jan 30, 2024
Stdlib: ArgTools
URL: https://github.com/JuliaIO/ArgTools.jl.git
Stdlib branch: master
Julia branch: master
Old commit: 4eccde4
New commit: 997089b
Julia version: 1.11.0-DEV
ArgTools version: 1.1.2(Does not match)
Bump invoked by: @vtjnash
Powered by:
[BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl)

Diff:
JuliaIO/ArgTools.jl@4eccde4...997089b

```
$ git log --oneline 4eccde4..997089b
997089b fix tests for TEMP_CLEANUP, which might be a Lockable (#35)
4a5f003 build(deps): bump actions/cache from 3 to 4 (#36)
84ba9e8 Hardcode doc edit backlink (#34)
9238839 build(deps): bump actions/checkout from 3 to 4 (#33)
```

Co-authored-by: Dilum Aluthge <[email protected]>
IanButterworth pushed a commit that referenced this issue Apr 11, 2024
…d56027 (#54056)

Stdlib: ArgTools
URL: https://github.com/JuliaIO/ArgTools.jl.git
Stdlib branch: release-1.10
Julia branch: backports-release-1.10
Old commit: 08b11b2
New commit: 5d56027
Julia version: 1.10.2
ArgTools version: 1.1.2(Does not match)
Bump invoked by: @IanButterworth
Powered by:
[BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl)

Diff:
JuliaIO/ArgTools.jl@08b11b2...5d56027

```
$ git log --oneline 08b11b2..5d56027
5d56027 build(deps): bump julia-actions/setup-julia from 1 to 2 (#38)
b6189c7 build(deps): bump codecov/codecov-action from 3 to 4 (#37)
997089b fix tests for TEMP_CLEANUP, which might be a Lockable (#35)
4a5f003 build(deps): bump actions/cache from 3 to 4 (#36)
84ba9e8 Hardcode doc edit backlink (#34)
9238839 build(deps): bump actions/checkout from 3 to 4 (#33)
4eccde4 build(deps): bump actions/checkout from 2 to 3 (#30)
6a4049d build(deps): bump codecov/codecov-action from 1 to 3 (#32)
f94a0d3 build(deps): bump actions/cache from 1 to 3 (#31)
cb66300 enable dependabot for GitHub actions (#29)
```

Co-authored-by: Dilum Aluthge <[email protected]>
IanButterworth pushed a commit that referenced this issue May 1, 2024
…4064)

Stdlib: NetworkOptions
URL: https://github.com/JuliaLang/NetworkOptions.jl.git
Stdlib branch: master
Julia branch: master
Old commit: aab83e5
New commit: 8eec5cb
Julia version: 1.12.0-DEV
NetworkOptions version: 1.2.0(Does not match)
Bump invoked by: @IanButterworth
Powered by:
[BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl)

Diff:
JuliaLang/NetworkOptions.jl@aab83e5...8eec5cb

```
$ git log --oneline aab83e5..8eec5cb
8eec5cb Hardcode doc edit backlink (#32)
0bd3345 also reset SYSTEM_CA_ROOTS and ENV_HOST_PATTERN_CACHE from __init__ (#35)
```

Co-authored-by: Dilum Aluthge <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants