Skip to content

Eta expanding overloaded method with different type parameters selects an arbitrary overload #10850

@martijnhoekstra

Description

@martijnhoekstra
def overloaded[A](a: A): A = a
def overloaded[A, B](a: A, b: B): A = a

def f = overloaded _

compiles in scala 2.12

In dotty this results in

|Ambiguous overload. The overloaded alternatives of method overloaded in object Test with types
| [A, B](a: A, b: B): A
| [A](a: A): A
|both match expected type ?

I expected the same behaviour in scala

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)should not compile

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions