Skip to content

Method ambiguity detection: false positive? #6048

@pygy

Description

@pygy
foo(b::Bar...) = 1
# foo (generic function with 1 methods)

foo(a::Any, b::Bar) = 2
# foo (generic function with 2 methods)

foo(b::Bar, a::Any) = 3
# Warning: New definition
#     foo(Bar,Any)
# is ambiguous with:
#     foo(Any,Bar)
# To fix, define
#     foo(Bar,Bar)
# before the new definition.
# foo (generic function with 3 methods)

Semantically, foo(Bar,Bar)` is covered by the first definition, and the above example behaves as expected.

Is the warning really warranted?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions