Skip to content

@implicitNotFound is ignored when the queried type is a type member (not a trait or a class) #11797

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 Mar 18, 2021 · 1 comment · Fixed by #11823
Closed
Assignees
Labels
area:implicits related to implicits itype:bug
Milestone

Comments

@julienrf
Copy link
Contributor

Compiler version

3.0.0-RC1

Minimized code

object Foo:
  @annotation.implicitNotFound("Oops")
  type Bar

@main def run(): Unit =
  summon[Foo.Bar]

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

Output

The compilation error is:

no implicit argument of type Foo.Bar was found for parameter x of method summon in object Predef

Expectation

The compilation error message should display the content of the @implicitNotFound annotation. This is the case in Scala 2, FYI: https://scastie.scala-lang.org/YULABebLTOa66sTci8OLqg

However, there is a subtlety here. In the case of transparent type aliases, maybe we don’t want the compilation process to be impacted by the dealiasing process. But I see at least two good valid situations where we want the annotation to be taken into account: for opaque type aliases, and for abstract type members.

@odersky
Copy link
Contributor

odersky commented Mar 19, 2021

I think this is for @prolativ - he designed the implicit not found reporting.

odersky added a commit to dotty-staging/dotty that referenced this issue Mar 19, 2021
michelou pushed a commit to michelou/scala3 that referenced this issue Mar 22, 2021
michelou pushed a commit to michelou/scala3 that referenced this issue Mar 22, 2021
michelou pushed a commit to michelou/scala3 that referenced this issue Apr 14, 2021
@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:implicits related to implicits itype:bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants