Skip to content

Order of implicits in file matters; could we at least fix this for implicit objects? #8697

@scabug

Description

@scabug

The following works:

trait T[_]
sealed trait A
sealed trait C


object A {
  implicit object AA extends T[A]
}

object C {
  implicit object CC extends T[C]
}

object B {
  implicitly[T[A]]
  implicitly[T[C]]
}

While the the following can not find the implicit T[C] instance:

trait T[_]
sealed trait A
sealed trait C


object A {
  implicit object AA extends T[A]
}

object B {
  implicitly[T[A]]
  implicitly[T[C]]
}

object C {
  implicit object CC extends T[C]
}

The only difference is the order of appearance for the B and C objects.

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/)implicitinfer

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions