Skip to content

method dispatch ambiguity failure #8652

@vtjnash

Description

@vtjnash

The following ambiguous method situation fails to produce a method ambiguity warning:

~/Documents/no-backup/julia$ ./julia 
julia> f{T<:Integer}(::Type{T}, ::Ptr{Integer}) = 2
f (generic function with 1 method)

julia> f{T<:Integer}(::Type{T}, ::Ptr{T}) = 1
f (generic function with 2 methods)

julia> f(Integer, convert(Ptr{Integer}, C_NULL))
1

~/Documents/no-backup/julia$ ./julia 
julia> f{T<:Integer}(::Type{T}, ::Ptr{T}) = 1
f (generic function with 1 method)

julia> f{T<:Integer}(::Type{T}, ::Ptr{Integer}) = 2
f (generic function with 2 methods)

julia> f(Integer, convert(Ptr{Integer}, C_NULL))
2

this affects the behavior of the following lines:
https://github.com/JuliaLang/Gtk.jl/blob/5d1e5ee360aafae97c2189b8970345b70707024a/src/GLib/gtype.jl#L270
https://github.com/JuliaLang/Gtk.jl/blob/5d1e5ee360aafae97c2189b8970345b70707024a/src/GLib/gtype.jl#L284
currently, it works as intended, but if I switch the order of those two statements, it instead turns into a stack overflow

Metadata

Metadata

Assignees

No one assigned

    Labels

    types 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