Skip to content

Nested overload resolution fails when splitting argument list #23011

Open
@EugeneFlesselle

Description

@EugeneFlesselle

Compiler version

Scala compiler version 3.7.1-RC1-bin-SNAPSHOT-nonbootstrapped-git-ac47299

Minimized code

type X = Double => Unit
def g(x: Double): Unit = ???
def g(x: String): Unit = ???

def f1(x: X) = ???

def f2(x: X, y: Int) = ???
def f2(x: X, y: Boolean) = ???

def f3(x: X)(y: Int) = ???
def f3(x: X)(y: Boolean) = ???

val r1 = f1(g) // ok
val r2 = f2(g, 1) // ok
val r3 = f3(g)(1) // error ambiguous overload for g

Output

-- [E051] Reference Error: tests/playground/example.scala:17:12 ----------------
17 |val r3 = f3(g)(1) // error ambiguous overload for g
   |            ^
   |  Ambiguous overload. The overloaded alternatives of method g with types
   |   (x: String): Unit
   |   (x: Double): Unit
   |  both match expected type <?>
   |
   | longer explanation available when compiling with `-explain`

Expectation

Ideally, all should be resolved unambiguously.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions