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

methods returns wrong result for triangular dispatch #18348

Closed
yuyichao opened this issue Sep 3, 2016 · 2 comments
Closed

methods returns wrong result for triangular dispatch #18348

yuyichao opened this issue Sep 3, 2016 · 2 comments
Labels
types and dispatch Types, subtyping and method dispatch

Comments

@yuyichao
Copy link
Contributor

yuyichao commented Sep 3, 2016

See below, methods returns two methods even though only the second one (the first in the returned array) can possibly be called. This is the reason we are doing a dynamic dispatch at all in #18331 . (and without this fixed allocation elimination can't fully work either)

julia> f{T<:Any}(::Type{T}, x) = 1
f (generic function with 1 method)

julia> f{T<:Any}(::Type{T}, x::T) = 2
f (generic function with 2 methods)

julia> methods(f, Tuple{Type{Any},Any})
#2 methods for generic function "f":
f{T}(::Type{T}, x::T) at REPL[2]:1
f{T}(::Type{T}, x) at REPL[1]:1
@yuyichao
Copy link
Contributor Author

yuyichao commented Sep 3, 2016

Ah....... Just notice this is the first thing @vtjnash mentioned in #18331 (comment) (Didn't realized that since this is also the case on 0.4 and is not the regression........... The regression is still the performance of the dynamic dispatch itself.)

@yuyichao yuyichao added the types and dispatch Types, subtyping and method dispatch label Sep 3, 2016
@JeffBezanson
Copy link
Member

closed by #18457

@vtjnash vtjnash mentioned this issue Jan 16, 2017
53 tasks
mauro3 added a commit to mauro3/julia that referenced this issue Jan 17, 2017
mauro3 added a commit to mauro3/julia that referenced this issue Jan 17, 2017
mauro3 added a commit to mauro3/julia that referenced this issue Jan 17, 2017
mauro3 added a commit to mauro3/julia that referenced this issue Jan 17, 2017
mauro3 added a commit to mauro3/julia that referenced this issue Jan 18, 2017
Added tests for issues JuliaLang#12580, JuliaLang#18348, JuliaLang#13165, JuliaLang#11803, JuliaLang#12721

Enabled extra tests for JuliaLang#11840, however, that isssue is not resolved
yet but needs tests triggering it.
mauro3 added a commit to mauro3/julia that referenced this issue Jan 20, 2017
Added tests for issues JuliaLang#12580, JuliaLang#18348, JuliaLang#13165, JuliaLang#12721

For JuliaLang#11803 it was decidided that no tests are needed.

Enabled extra tests for JuliaLang#11840, however, that isssue is not resolved
yet but needs new tests triggering it.
mauro3 added a commit to mauro3/julia that referenced this issue Jan 20, 2017
Added tests for issues JuliaLang#12580, JuliaLang#18348, JuliaLang#13165, JuliaLang#12721

For JuliaLang#11803 it was decidided that no tests are needed.

Enabled extra tests for JuliaLang#11840, however, that isssue is not resolved
yet but needs new tests triggering it.
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

2 participants