Skip to content

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

Closed
@julienrf

Description

@julienrf

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.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions