diff --git a/base/deepcopy.jl b/base/deepcopy.jl index 3b5ba7f7cc1f9..787be75d00165 100644 --- a/base/deepcopy.jl +++ b/base/deepcopy.jl @@ -7,7 +7,7 @@ deepcopy(x) = deepcopy_internal(x, ObjectIdDict()) -deepcopy_internal(x::Union{Symbol,LambdaStaticData,TopNode,QuoteNode, +deepcopy_internal(x::Union{Symbol,LambdaStaticData,TopNode,GlobalRef, DataType,Union,Task}, stackdict::ObjectIdDict) = x deepcopy_internal(x::Tuple, stackdict::ObjectIdDict) = diff --git a/test/copy.jl b/test/copy.jl index 0a047802dd079..cd5ca21cb3567 100644 --- a/test/copy.jl +++ b/test/copy.jl @@ -47,3 +47,13 @@ for (dest, src, bigsrc, emptysrc, res) in [ @test_throws BoundsError copy!(dest, 1, src(), 2, 2) end + +# test behavior of shallow and deep copying +let a = Any[[1]], q = QuoteNode([1]) + ca = copy(a); dca = deepcopy(a) + @test ca !== a + @test ca[1] === a[1] + @test dca !== a + @test dca[1] !== a[1] + @test deepcopy(q).value !== q.value +end