Skip to content

Commit

Permalink
use invokelatest to prevent invalidations in TOML
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC committed Jan 2, 2023
1 parent a8adb39 commit 5c3646b
Showing 1 changed file with 2 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 @@ -126,7 +126,7 @@ is_array_of_tables(value) = isa(value, AbstractArray) &&
isa(value, AbstractArray{<:AbstractDict}) ||
all(v -> isa(v, AbstractDict), value)
)
is_tabular(value) = is_table(value) || is_array_of_tables(value)
is_tabular(value) = is_table(value) || @invokelatest(is_array_of_tables(value))

function print_table(f::MbyFunc, io::IO, a::AbstractDict,
ks::Vector{String} = String[];
Expand Down Expand Up @@ -176,7 +176,7 @@ function print_table(f::MbyFunc, io::IO, a::AbstractDict,
# Use runtime dispatch here since the type of value seems not to be enforced other than as AbstractDict
@invokelatest print_table(f, io, value, ks; indent = indent + header, first_block = header, sorted=sorted, by=by)
pop!(ks)
elseif is_array_of_tables(value)
elseif @invokelatest(is_array_of_tables(value))
# print array of tables
first_block || println(io)
first_block = false
Expand Down

0 comments on commit 5c3646b

Please sign in to comment.