Skip to content

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

Open
@LilithHafner

Description

@LilithHafner

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsystemThe unit testing framework and Test stdlibtypes and dispatchTypes, subtyping and method dispatch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions