# Why doesn't an argument of type Any match an Int64

**URL:** <https://discourse.julialang.org/t/why-doesnt-an-argument-of-type-any-match-an-int64/69278>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [October 6, 2021, 3:41am UTC](https://discourse.julialang.org/t/why-doesnt-an-argument-of-type-any-match-an-int64/69278 "2021-10-06T03:41:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Soldalma](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/soldalma/32/29388_2.png) [@Soldalma](https://discourse.julialang.org/u/Soldalma)\
**Post date:** [October 6, 2021, 3:41am UTC](https://discourse.julialang.org/t/why-doesnt-an-argument-of-type-any-match-an-int64/69278/1 "2021-10-06T03:41:53Z")

</div>

I must be missing something about the Julia language, because my perhaps naive logic tells me a parameter of type Any should match an argument of a concrete type. Still, I am getting this message:

````julia
Closest candidates are:
  calculate_statistic(::ProgramParameters, ::Tuple{Int64, Dict{String, Any}}, ::UnitRange{Int64}, ::Int64)```

The argument ```::Tuple{Int64, Dict{String, Any}}``` appears in red. If I remove this argument's type qualification the program runs fine, so this question is more to satisfy my curiosity and perhaps avoid future errors.

```ProgramParameters``` is a struct. It is not related to this problem, which existed in a previous version where a Dictionary was the first argument.
````

---

<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:** [October 6, 2021, 3:47am UTC](https://discourse.julialang.org/t/why-doesnt-an-argument-of-type-any-match-an-int64/69278/2 "2021-10-06T03:47:42Z")

</div>

Types in Julia are invariant. `Dict{String, X}` is a subtype of `Dict{String, Any}` only when `X=Any`. You want to define your function to take `Dict{String, <:Any}`.

---

<div class="post-metadata">

**Author:** ![Soldalma](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/soldalma/32/29388_2.png) [@Soldalma](https://discourse.julialang.org/u/Soldalma)\
**Post date:** [October 6, 2021, 11:38pm UTC](https://discourse.julialang.org/t/why-doesnt-an-argument-of-type-any-match-an-int64/69278/3 "2021-10-06T23:38:23Z")

</div>

Thanks. Your suggestion worked.
