JuliaTesting / Aqua.jl

Auto QUality Assurance for Julia packages
MIT License
334 stars 24 forks source link

`test_unbound_args` with Union fails #252

Closed filchristou closed 9 months ago

filchristou commented 9 months ago

I think the following should not fail, right ?

module TestMod

myfun(x::Union{Int, T}) where T<:Number = T

end
julia> Aqua.test_unbound_args(TestMod)
Unbound type parameters detected:
[1] myfun(x::Union{Int64, T}) where T<:Number @ Main.TestMod ~/code/julia/aquatest/testmod.jl:3
Test Failed at /u/home/wima/fchrstou/.julia/packages/Aqua/jBmtw/src/unbound_args.jl:50
  Expression: isempty(unbounds)
   Evaluated: isempty(Method[myfun(x::Union{Int64, T}) where T<:Number @ Main.TestMod ~/code/julia/aquatest/testmod.jl
:3])

ERROR: There was an error during testing

Test.has_unbound_vars(TestMod.myfun) == false if that means anything to you.

lgoettgens commented 9 months ago

When you input an element of type Int, the type parameter T does not have a well-defined value and thus let's the test fail here. Everything seems to be as intended.

filchristou commented 9 months ago

Hm.. Indeed. Ah that's weird; I expected in that case to get T===Int since Union{Int, Int} === Int.