# Methods() returning duplicate results?

**URL:** <https://discourse.julialang.org/t/methods-returning-duplicate-results/2323>\
**Category:** General Usage\
**Tags:** question\
**Created:** [February 26, 2017, 8:20pm UTC](https://discourse.julialang.org/t/methods-returning-duplicate-results/2323 "2017-02-26T20:20:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![barche](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/barche/32/79_2.png) [@barche](https://discourse.julialang.org/u/barche)\
**Post date:** [February 26, 2017, 8:20pm UTC](https://discourse.julialang.org/t/methods-returning-duplicate-results/2323/1 "2017-02-26T20:20:51Z")

</div>

The `methods` function appears to return duplicate results in this case, is that a bug?

REPL input:

```julia
foo(arg1::Union{Int32,Int64}, arg2::Union{Float64,Int64}) = 1
methods(foo, (Union{Int32,Int64},Union{Float64,Int64}))

```

output:

```nohighlight
foo(arg1::Union{Int32,Int64}, arg2::Union{Float64,Int64}) at REPL[1]:1
foo(arg1::Union{Int32,Int64}, arg2::Union{Float64,Int64}) at REPL[1]:1
foo(arg1::Union{Int32,Int64}, arg2::Union{Float64,Int64}) at REPL[1]:1
foo(arg1::Union{Int32,Int64}, arg2::Union{Float64,Int64}) at REPL[1]:1

```

---

<div class="post-metadata">

**Author:** ![felix](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/felix/32/604_2.png) [@felix](https://discourse.julialang.org/u/felix)\
**Post date:** [February 27, 2017, 12:17pm UTC](https://discourse.julialang.org/t/methods-returning-duplicate-results/2323/2 "2017-02-27T12:17:28Z")

</div>

Which version are you on? I can reproduce this on `v"0.6.0-dev.2539"`, and agree it looks like a bug not a feature. (I figure: when providing a type signature with a union, it should filter methods taking the whole set, not methods taking any subset. But that’s debatable.) If it’s the same on the current master build, then a bug report (or a PR!) on github would be appropriate, are you happy making one?

Smaller repo:

```julia
julia> bar(x::Union{Int8,Int16}) = 2;

julia> methods(bar)
# 1 method for generic function "bar":
bar(x::Union{Int16, Int8}) in Main at console:1

julia> methods(bar,[Union{Int8,Int16}])
# 2 methods for generic function "bar":
bar(x::Union{Int16, Int8}) in Main at console:1
bar(x::Union{Int16, Int8}) in Main at console:1

julia> methods(bar,[Union{Int8,Int32}])
# 1 method for generic function "bar":
bar(x::Union{Int16, Int8}) in Main at console:1

```
