Skip to content

Incorrect method dispatch for overloaded methods using implicit parameters #15989

Closed
@WojciechMazur

Description

@WojciechMazur

Regression found in Open CB #4753 for tofu-tf/glass
Part of 3.2.1-RC1 regression tracker #15949

Compiler version

3.2.1-RC1

Bisect points to 882b435

Minimized code

type Contains[A, B]   = PContains[A, A, B, B]

abstract class MonoOpticCompanion:
  type O[a, b]
  def apply[A, B](implicit o: O[A, B]): O[A, B] = o

trait PContains[-S, +T, +A, -B]:
  def apply(a: B): Unit = ???

object Contains extends MonoOpticCompanion:
  def apply[A] = new ContainsApplied[A](true)

  class ContainsApplied[A](private val dummy: Boolean) extends AnyVal:
    def apply[B](fget: A => B)(fset: (A, B) => A): Contains[A, B] = ???

trait CollectionFunctions:
  def setAt[A](a: A): Contains[Set[A], Boolean] =
    Contains[Set[A]](???)(???) // error

Output

Compiling project (Scala 3.2.1-RC1, JVM)
[error] ./lib.scala:18:5: method apply in object Contains does not take parameters
[error]     Contains[Set[A]](???)(???) // error
[error]     ^^^^^^^^^^^^^^^^

Expectation

Should compile

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions