Is this `Test.detect_unbound_args` result valid or a bug?

A module:

module M
  f(::Tuple{}) = nothing
  f(::NTuple{n, F}) where {n, F} = F
end

The second method gets flagged as having an unbound argument, even though the first method protects it from ever being called in such a situation:

julia> detect_unbound_args(M)
[1] f(::Tuple{Vararg{F, n}}) where {n, F} in Main.M at REPL[2]:3

Should this be considered a bug? If not, detect_unbound_args seems useless, as this seems like a very basic false positive. Hope I’m not misunderstanding Julia 101 or something.

This happens with both Julia nightly and with 1.8.5.

It’s definitely annoying. I don’t even know how to call the second method with an empty tuple using invoke.

If you want to avoid it, instead write

f(::Tuple{F,Vararg{F,nMinus1}}) where {F,nMinus1} = ...

I do this. detect_unbound_args is useful, but less so now that you get warnings during precompilation.

Wow, I’ll definitely keep this “tuple type with minimal size” trick in mind.

Yeah its an issue,

its been there for a long time someone should fix it :3