# Failed method resolution

**URL:** <https://discourse.julialang.org/t/failed-method-resolution/29500>\
**Category:** New to Julia\
**Created:** [October 4, 2019, 7:42pm UTC](https://discourse.julialang.org/t/failed-method-resolution/29500 "2019-10-04T19:42:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jth](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jth/32/10627_2.png) [@jth](https://discourse.julialang.org/u/jth)\
**Post date:** [October 4, 2019, 7:42pm UTC](https://discourse.julialang.org/t/failed-method-resolution/29500/1 "2019-10-04T19:42:59Z")

</div>

I am having a hard time understanding why my method is not resolving. The error message I am receiving is:

```julia
julia> DataUtil.train_val_test_split(sdata, .8, .1)
ERROR: MethodError: no method matching train_val_test_split(::Main.DataUtil.Dataset, ::Float64, ::Float64)
Closest candidates are:
  train_val_test_split(::Main.DataUtil.Dataset, ::Float64, ::Float64) at /Users/julia-optim/src/data.jl:18
Stacktrace:
 [1] top-level scope at REPL[130]:1

```

The type signatures are the exact same.  
Just to be safe, if I check the types of the inputs via `typeof` I get

```julia
julia> typeof(sdata)
Main.DataUtil.Dataset

```

What am I missing?

**Edit** : The method definition looks like:

```julia
function train_val_test_split(data::Dataset, train_percent::Float64,
                              val_percent::Float64)::Tuple{Dataset, Dataset, Dataset}
    # Method implementation...
end

```

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [October 4, 2019, 8:17pm UTC](https://discourse.julialang.org/t/failed-method-resolution/29500/2 "2019-10-04T20:17:20Z")

</div>

You might have re-included the file that defines `Dataset` while not refreshing (re-including) the file with the method that takes the `DataSet`.

As an example:

```julia
julia> module M
           struct S end
       end
Main.M

julia> module N
           import ..M
           f(::M.S) = "foo"
       end
Main.N

julia> N.f(M.S())
"foo"

julia> module M
           struct S end
       end
WARNING: replacing module M.
Main.M

julia> N.f(M.S())
ERROR: MethodError: no method matching f(::Main.M.S)
Closest candidates are:
  f(::Main.M.S) at REPL[28]:3
Stacktrace:
 [1] top-level scope at REPL[31]:100:

```

---

<div class="post-metadata">

**Author:** ![jth](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jth/32/10627_2.png) [@jth](https://discourse.julialang.org/u/jth)\
**Post date:** [October 4, 2019, 8:19pm UTC](https://discourse.julialang.org/t/failed-method-resolution/29500/3 "2019-10-04T20:19:14Z")

</div>

They are in the same file. However, closing and re-opening the REPL solved the issue. Thanks!
