Skip to content

No import suggestions for conditional implicit definitions #8827

Closed
@julienrf

Description

@julienrf

This issue is different from #8823 because it is related to conditional implicit definitions, not conversions.

Minimized code

package nonempty

trait Order[A]

object Order {
  implicit def orderList[A](implicit orderA: Order[A]): Order[List[A]] = ???
}

class Foo

object Implicits {
  implicit def orderFoo: Order[Foo] = ???
}

@main def main: Unit = summon[Order[List[Foo]]]

https://scastie.scala-lang.org/eVaWn1IASUar0hFzfPpVTA

Output

no implicit argument of type Order[List[Foo]] was found for parameter x of method summon in object DottyPredef.
I found:

    Order.orderList[A](
      /* missing */implicitly[Order[Foo]]
    )

But no implicit values were found that match type Order[Foo].

Expectation

We should suggest importing Implicits.orderFoo.

Note that with the same code, if we try to summon[Order[Foo]] we get the suggestion to import Implicits.orderFoo.

Metadata

Metadata

Assignees

Labels

area:reportingError reporting including formatting, implicit suggestions, etcitype:bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions