From ea6f17ae35c321271b92defa998e2d8e789459ca Mon Sep 17 00:00:00 2001 From: Will Tebbutt Date: Thu, 4 Jul 2024 08:44:43 +0100 Subject: [PATCH] Bump patch version --- Project.toml | 2 +- src/MistyClosures.jl | 5 +++++ test/runtests.jl | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index fdcd770..b4a244d 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "MistyClosures" uuid = "dbe65cb8-6be2-42dd-bbc5-4196aaced4f4" authors = ["Will Tebbutt", "Frames White", "Hong Ge"] -version = "1.0.0" +version = "1.0.1" [compat] julia = "1.10" diff --git a/src/MistyClosures.jl b/src/MistyClosures.jl index c63dbf4..0d03540 100644 --- a/src/MistyClosures.jl +++ b/src/MistyClosures.jl @@ -12,6 +12,11 @@ MistyClosure(ir::IRCode; kwargs...) = MistyClosure(OpaqueClosure(ir; kwargs...) (mc::MistyClosure)(x::Vararg{Any, N}) where {N} = mc.oc(x...) +# You can't deepcopy an `IRCode` because it contains a module. +function Base.deepcopy_internal(x::T, dict::IdDict) where {T<:MistyClosure} + return T(Base.deepcopy_internal(x.oc, dict), x.ir) +end + export MistyClosure end diff --git a/test/runtests.jl b/test/runtests.jl index 941017f..d1c9bc3 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -12,4 +12,7 @@ using Core: OpaqueClosure # Default constructor. mc_default = MistyClosure(OpaqueClosure(ir; do_compile=true), ir) @test @inferred(mc_default(5.0) == sin(5.0)) + + # deepcopy + @test deepcopy(mc) isa typeof(mc) end