You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A separate issue for @mbauman's #6383 (comment) which is distinct from the ambiguity problem.
julia> struct Foo{A<:Real} end
julia> f(x::Foo{A}) where A = 1
f (generic function with 1 method)
julia> f(x::Foo, y...) = 2
f (generic function with 2 methods)
julia> f(Foo{Int}())
2
The second method's 1-arg form appears (unless you're an Expert) as if it is less specific than the first. However, Foo is treated as Foo{T} where T<:Real, while the compiler puts a type bound of Any on A.
I think it would make sense if Foo{A} where A was treated as Foo{A} where A<:Real, at least in method definitions.
The original issue isn't really specific to ambiguities; the underlying issue is exactly the same whether you get an ambiguity or an unexpected sort order.
A separate issue for @mbauman's #6383 (comment) which is distinct from the ambiguity problem.
The second method's 1-arg form appears (unless you're an Expert) as if it is less specific than the first. However,
Foo
is treated asFoo{T} where T<:Real
, while the compiler puts a type bound ofAny
onA
.I think it would make sense if
Foo{A} where A
was treated asFoo{A} where A<:Real
, at least in method definitions.See also JuliaArrays/AxisArrays.jl#124 (comment)
The text was updated successfully, but these errors were encountered: