diff --git a/Project.toml b/Project.toml index 23cdbd91..e0bdc1b9 100644 --- a/Project.toml +++ b/Project.toml @@ -3,7 +3,7 @@ uuid = "6f1fad26-d15e-5dc8-ae53-837a1d7b8c9f" license = "MIT" desc = "Tape based task copying in Turing" repo = "https://github.com/TuringLang/Libtask.jl.git" -version = "0.6.6" +version = "0.6.7" [deps] IRTools = "7869d1d1-7146-5819-86e3-90919afe41df" diff --git a/src/tapedfunction.jl b/src/tapedfunction.jl index 7f7c8c8b..3ff032ca 100644 --- a/src/tapedfunction.jl +++ b/src/tapedfunction.jl @@ -291,6 +291,9 @@ deeply copied, one can add a method to this function. """ function tape_copy end tape_copy(x) = x +# Core.Box is used as closure captured variable container, so we should tape_copy its contents +tape_copy(x::Core.Box) = Core.Box(tape_copy(x.contents)) +# ?? should we deepcopy Array and Dict by default? # tape_copy(x::Array) = deepcopy(x) # tape_copy(x::Dict) = deepcopy(x)