Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test.detect_unbound_args reports cases that are reasonable and harmless #56698

Open
LilithHafner opened this issue Nov 27, 2024 · 0 comments
Open
Labels
testsystem The unit testing framework and Test stdlib types and dispatch Types, subtyping and method dispatch

Comments

@LilithHafner
Copy link
Member

If the unbound static parameter is not used in the function body, then it should not get reported by detect_unbound_args. There are perfectly valid functions that don't use their static parameters. For example:

julia> module Mod
           f(x::NTuple{<:Any, T}, y::NTuple{<:Any, T}) where T = (x..., y...)
       end
Main.Mod

julia> Test.detect_unbound_args(Mod)
[1] f(x::NTuple{var"#s5", T} where var"#s5", y::NTuple{var"#s4", T} where var"#s4") where T @ Main.Mod REPL[14]:2

julia> Mod.f((1,2),(3,4))
(1, 2, 3, 4)

julia> Mod.f((1,2),(3,4.0))
ERROR: MethodError: no method matching f(::Tuple{Int64, Int64}, ::Tuple{Int64, Float64})
The function `f` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  f(::NTuple{var"#s5", T} where var"#s5", ::NTuple{var"#s4", T} where var"#s4") where T
   @ Main.Mod REPL[14]:2

Stacktrace:
 [1] top-level scope
   @ REPL[17]:1

julia> Mod.f((),())
()

This causes spurious test failures in #54494

@LilithHafner LilithHafner added testsystem The unit testing framework and Test stdlib types and dispatch Types, subtyping and method dispatch labels Nov 27, 2024
LilithHafner added a commit that referenced this issue Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testsystem The unit testing framework and Test stdlib types and dispatch Types, subtyping and method dispatch
Projects
None yet
Development

No branches or pull requests

1 participant