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 Sep 26, 2015
1 parent 262d6ba commit c1d28cf
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,LambdaStaticData,TopNode,GlobalRef,
DataType,Union,Task},
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 c1d28cf

Please sign in to comment.