-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Labels
bugSomething isn't workingSomething isn't workingtest: unbound argswait-for-upstreamIssue needs to be fixed upstreamIssue needs to be fixed upstream
Description
Consider the module:
module Foo
foo(::Type{Union{Nothing,Vector{T}}}) where T = 1
foo(::Type{Nothing}) = 2
foo(::Type{Vector{T}}) where T = 3
endAs far as I can tell, T cannot be unbound in the first definition, because it is only dispatched to by a Union{Nothing,Vector{T}} where T, e.g.
julia> begin
using .Foo: foo
@show foo(Vector{Int})
@show foo(Nothing)
@show foo(Union{Nothing,Vector{Float64}}) # only this call can hit the first definition
# no other calls would match the signature:
@show Type{Nothing} <: Type{Union{Nothing,Vector{T}}} where T
@show Type{Vector{Float64}} <: Type{Union{Nothing,Vector{T}}} where T
@show Type{Union{Nothing,Vector}} <: Type{Union{Nothing,Vector{T}}} where T
end
foo(Vector{Int}) = 3
foo(Nothing) = 2
foo(Union{Nothing, Vector{Float64}}) = 1
Type{Nothing} <: (Type{Union{Nothing, Vector{T}}} where T) = false
Type{Vector{Float64}} <: (Type{Union{Nothing, Vector{T}}} where T) = false
Type{Union{Nothing, Vector}} <: (Type{Union{Nothing, Vector{T}}} where T) = falseBut Aqua.test_unbound_args says T can be unbound:
julia> Aqua.test_unbound_args(Foo)
Unbound type parameters detected:
[1] foo(::Type{Union{Nothing, Vector{T}}}) where T @ Main.Foo REPL[12]:2
Test Failed at /Users/nickr/.julia/packages/Aqua/EPo21/src/unbound_args.jl:37
Expression: isempty(unbounds)
Evaluated: isempty(Method[foo(::Type{Union{Nothing, Vector{T}}}) where T @ Main.Foo REPL[12]:2])
ERROR: There was an error during testingI think this is a false positive?
(Note this is not the same case as the Type issue in #333 or the Union 'issues' in #265 or #252)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingtest: unbound argswait-for-upstreamIssue needs to be fixed upstreamIssue needs to be fixed upstream