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

last(::Tuple) should be type stable #19571

Closed
dlfivefifty opened this issue Dec 13, 2016 · 2 comments
Closed

last(::Tuple) should be type stable #19571

dlfivefifty opened this issue Dec 13, 2016 · 2 comments
Labels
types and dispatch Types, subtyping and method dispatch

Comments

@dlfivefifty
Copy link
Contributor

This caught me by surprise:

julia> x=(1,2.0,"hi");

julia> @code_warntype first(x)
Variables:
  #self#::Base.#first
  t::Tuple{Int64,Float64,String}

Body:
  begin 
      return (Base.getfield)(t::Tuple{Int64,Float64,String},1)::Int64
  end::Int64

julia> @code_warntype(last(x))
Variables:
  #self#::Base.#last
  a::Tuple{Int64,Float64,String}

Body:
  begin 
      SSAValue(0) = (Base.nfields)(a::Tuple{Int64,Float64,String})::Int64
      return (Base.getfield)(a::Tuple{Int64,Float64,String},SSAValue(0))::Union{Float64,Int64,String}
  end::Union{Float64,Int64,String}
@Sacha0
Copy link
Member

Sacha0 commented Dec 13, 2016

#19540

@kshyatt kshyatt added the types and dispatch Types, subtyping and method dispatch label Dec 13, 2016
@JeffBezanson
Copy link
Member

fixed by #19605.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
types and dispatch Types, subtyping and method dispatch
Projects
None yet
Development

No branches or pull requests

4 participants