From 5c3646bd636425b3d7299f16c810cd2b3bef377b Mon Sep 17 00:00:00 2001 From: Kristoffer Date: Mon, 2 Jan 2023 16:41:19 +0100 Subject: [PATCH] use invokelatest to prevent invalidations in TOML --- stdlib/TOML/src/print.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/TOML/src/print.jl b/stdlib/TOML/src/print.jl index 74efdfc97a05d..61d13a8f4853e 100644 --- a/stdlib/TOML/src/print.jl +++ b/stdlib/TOML/src/print.jl @@ -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[]; @@ -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