Skip to content

Commit

Permalink
Circumvent type-instability of deepcopy
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy committed Apr 5, 2016
1 parent adf800e commit 10d0593
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion base/deepcopy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Note: deepcopy_internal(::Any, ::ObjectIdDict) is
# only exposed for specialization by libraries

deepcopy(x) = deepcopy_internal(x, ObjectIdDict())
deepcopy(x) = deepcopy_internal(x, ObjectIdDict())::typeof(x)

deepcopy_internal(x::Union{Symbol,LambdaInfo,TopNode,GlobalRef,DataType,Union,Task},
stackdict::ObjectIdDict) = x
Expand Down
2 changes: 1 addition & 1 deletion test/copy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ end

# test behavior of shallow and deep copying
let a = Any[[1]], q = QuoteNode([1])
ca = copy(a); dca = deepcopy(a)
ca = copy(a); dca = @inferred(deepcopy(a))
@test ca !== a
@test ca[1] === a[1]
@test dca !== a
Expand Down

0 comments on commit 10d0593

Please sign in to comment.