Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deepcopy typestablility #15768

Closed
jw3126 opened this issue Apr 5, 2016 · 1 comment
Closed

deepcopy typestablility #15768

jw3126 opened this issue Apr 5, 2016 · 1 comment

Comments

@jw3126
Copy link
Contributor

jw3126 commented Apr 5, 2016

The return type of deepcopy is always the same as its input type, right? So why not make it typestable?

 @code_warntype deepcopy(randn(3))
Variables:
  #self#::Base.#deepcopy
  x::Array{Float64,1}
  ####dims#1300#7496::Tuple{Int64}

Body:
  begin  # deepcopy.jl, line 8: # dict.jl, line 330: # array.jl, line 163: # boot.jl, line 349: # boot.jl, line 331:
      GenSym(0) = (Core.convert)(Core.Int,32)::Any
      GenSym(1) = (top(ccall))(:jl_alloc_array_1d,(top(apply_type))(Core.Array,Any,1)::Type{Array{Any,1}},(top(svec))(Core.Any,Core.Int)::SimpleVector,Array{Any,1},0,(top(unsafe_convert))(Core.Int,GenSym(0))::Int64,GenSym(0))::Array{Any,1} # array.jl, line 195:
      return (Base.deepcopy_internal)(x::Array{Float64,1},$(Expr(:new, :((top(getfield))(Base,:ObjectIdDict)::Type{ObjectIdDict}), GenSym(1))))::Any
  end::Any
@timholy
Copy link
Member

timholy commented Apr 5, 2016

#13323

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants