# Multiple dispatch unexpected function call

**URL:** <https://discourse.julialang.org/t/multiple-dispatch-unexpected-function-call/78736>\
**Category:** General Usage\
**Tags:** question\
**Created:** [March 30, 2022, 12:14pm UTC](https://discourse.julialang.org/t/multiple-dispatch-unexpected-function-call/78736 "2022-03-30T12:14:23Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![mikmoore](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mikmoore/32/31109_2.png) [@mikmoore](https://discourse.julialang.org/u/mikmoore)\
**Post date:** [April 1, 2022, 11:43pm UTC](https://discourse.julialang.org/t/multiple-dispatch-unexpected-function-call/78736/22 "2022-04-01T23:43:03Z")

</div>

This is probably the easiest way to handle your issue. No need to get carried away with subtypes in every method definition.

```julia
abstract type AbstractType end
struct ExampleType1<:AbstractType end
struct ExampleType2<:AbstractType end
struct Concrete{AT<:AbstractType} end

is_same(c1::T, c2::T) where {T<:Concrete} = true
is_same(c1::Concrete, c2::Concrete) = false

c1 = Concrete{ExampleType1}()
c2 = Concrete{ExampleType1}()
@show is_same(c1,c2) # true

c1 = Concrete{ExampleType1}()
c2 = Concrete{ExampleType2}()
@show is_same(c1,c2) # false

```

---

<div class="post-metadata">

**Author:** ![goerch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerch/32/29122_2.png) [@goerch](https://discourse.julialang.org/u/goerch)\
**Post date:** [April 4, 2022, 9:21pm UTC](https://discourse.julialang.org/t/multiple-dispatch-unexpected-function-call/78736/23 "2022-04-04T21:21:42Z")

</div>

> [@goerch](#):
>
> One more question: does anyone see a way to call the second method or isn’t this dead code?

Sorry for bothering you all again. I believe the method

```julia
is_same(c1::Concrete{T}, c2::Concrete{T}) where T = true

```

from [here](https://discourse.julialang.org/t/multiple-dispatch-unexpected-function-call/78736/9) should be marked as ‘unreachable’ or ‘dead code’ by the compiler.

[Previous page](https://discourse.julialang.org/t/multiple-dispatch-unexpected-function-call/78736.md?page=1)
