# MethodError: no matching method for Int64 despite specifying Real

**URL:** <https://discourse.julialang.org/t/methoderror-no-matching-method-for-int64-despite-specifying-real/98809>\
**Category:** New to Julia\
**Tags:** question, parametric-types, function-parameters\
**Created:** [May 13, 2023, 7:16pm UTC](https://discourse.julialang.org/t/methoderror-no-matching-method-for-int64-despite-specifying-real/98809 "2023-05-13T19:16:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![JoO0oss](https://avatars.discourse-cdn.com/v4/letter/j/a5b964/32.png) [@JoO0oss](https://discourse.julialang.org/u/JoO0oss)\
**Post date:** [May 13, 2023, 7:16pm UTC](https://discourse.julialang.org/t/methoderror-no-matching-method-for-int64-despite-specifying-real/98809/1 "2023-05-13T19:16:26Z")

</div>

I’ve looked at [this question](https://discourse.julialang.org/t/help-understanding-type-error-int64-and-number/55133) on the Julia discourse and checked [parametric types](https://docs.julialang.org/en/v1/manual/types/#Parametric-Composite-Types) in the docs (which are fantastic docs, I’d like to add) and I’m not sure what to do next.

I have a function which wants tuples of numbers, making sure to specify `<:Real` instead of just `Real`:

```julia
function point_within(point::Tuple{<:Real, <:Real}, polygon::Vector{Tuple{<:Real, <:Real}})

```

Yet, giving it Int64s yields the following error:

LoadError: MethodError: no method matching point\_within(::Tuple{Int64, Int64}, ::Vector{Tuple{Int64, Int64}})  
Closest candidates are:  
point\_within(::Tuple{Real, Real}, _::Vector{Tuple{Real, Real}}_)

I’d be most grateful to know best practise for dealing with abstract parametric types and if possible, something to replace the above example of an offending function definition with.

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [May 13, 2023, 7:22pm UTC](https://discourse.julialang.org/t/methoderror-no-matching-method-for-int64-despite-specifying-real/98809/2 "2023-05-13T19:22:46Z")

</div>

Try

```julia
function point_within(point::Tuple{<:Real, <:Real}, polygon::Vector{<:Tuple{<:Real, <:Real}})

```

---

<div class="post-metadata">

**Author:** ![JoO0oss](https://avatars.discourse-cdn.com/v4/letter/j/a5b964/32.png) [@JoO0oss](https://discourse.julialang.org/u/JoO0oss)\
**Post date:** [May 13, 2023, 7:34pm UTC](https://discourse.julialang.org/t/methoderror-no-matching-method-for-int64-despite-specifying-real/98809/3 "2023-05-13T19:34:50Z")

</div>

Ah, it hadn’t occurred to me to make sure `<:` is applied through all levels.

That has worked great, thanks.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [May 13, 2023, 7:37pm UTC](https://discourse.julialang.org/t/methoderror-no-matching-method-for-int64-despite-specifying-real/98809/4 "2023-05-13T19:37:02Z")

</div>

> [@mkitti](#):
>
> `Vector{<:Tuple{<:Real, <:Real}}`

I think `Vector{<:Tuple{Real, Real}}` should work as well as Tuples are covariant (if I remember the term correctly)

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [May 13, 2023, 8:56pm UTC](https://discourse.julialang.org/t/methoderror-no-matching-method-for-int64-despite-specifying-real/98809/5 "2023-05-13T20:56:03Z")

</div>

This is correct.
