Skip to content

Arbitrary call priority when two methods differ only by presence of type parameter #19413

Closed
@nalimilan

Description

In the following, the second test method does not overwrite the previous one despite actually accepting exactly the same argument types. Even more annoyingly, no method consistently takes precedence on the other: the method which is called is the first one which was used in the session. So the code below returns 1 as-is, and 2 when removing test(0) and running it in a new session.

test(x) = 1
test(0)
test{T}(x::T) = 2
test(0)

(Sorry if it's been reported elsewhere, I know similar issues are around but I couldn't find them.)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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