Skip to content

No import suggestions for conditional implicit definitions #8827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
julienrf opened this issue Apr 29, 2020 · 0 comments · Fixed by #17976
Closed

No import suggestions for conditional implicit definitions #8827

julienrf opened this issue Apr 29, 2020 · 0 comments · Fixed by #17976
Assignees
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc itype:bug
Milestone

Comments

@julienrf
Copy link
Contributor

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.

@julienrf julienrf added itype:bug area:implicits related to implicits labels Apr 29, 2020
julienrf added a commit to scalacenter/dotty that referenced this issue Jun 14, 2023
julienrf added a commit to scalacenter/dotty that referenced this issue Jun 16, 2023
…found error

We used to suggest imports for the outermost type of a chain of implicits.
Now, we suggest imports for the `expectedType` of the underlying `NoMatchingImplicits`.

Fixes scala#8827
julienrf added a commit to scalacenter/dotty that referenced this issue Jun 19, 2023
…found error

We used to suggest imports for the outermost type of a chain of implicits.
Now, we suggest imports for the `expectedType` of the underlying `NoMatchingImplicits`.

Fixes scala#8827
julienrf added a commit to scalacenter/dotty that referenced this issue Jun 19, 2023
…found error

We used to suggest imports for the outermost type of a chain of implicits.
Now, we suggest imports for the `expectedType` of the underlying `NoMatchingImplicits`.

Fixes scala#8827
julienrf added a commit to scalacenter/dotty that referenced this issue Jun 19, 2023
…found error

We used to suggest imports for the outermost type of a chain of implicits.
Now, we suggest imports for the `expectedType` of the underlying `NoMatchingImplicits`.

Fixes scala#8827
julienrf added a commit that referenced this issue Jun 20, 2023
…found error

We used to suggest imports for the outermost type of a chain of implicits.
Now, we suggest imports for the `expectedType` of the underlying `NoMatchingImplicits`.

Fixes #8827
@julienrf julienrf added area:reporting Error reporting including formatting, implicit suggestions, etc and removed area:implicits related to implicits labels Jun 22, 2023
@Kordyjan Kordyjan added this to the 3.4.0 milestone Aug 1, 2023
Kordyjan pushed a commit that referenced this issue Nov 23, 2023
…found error

We used to suggest imports for the outermost type of a chain of implicits.
Now, we suggest imports for the `expectedType` of the underlying `NoMatchingImplicits`.

Fixes #8827

[Cherry-picked b614d84]
Kordyjan pushed a commit that referenced this issue Nov 29, 2023
…found error

We used to suggest imports for the outermost type of a chain of implicits.
Now, we suggest imports for the `expectedType` of the underlying `NoMatchingImplicits`.

Fixes #8827

[Cherry-picked b614d84]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc itype:bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants