Transparent Annotation

Hi there,
A silly question for my understanding.
I was going through Scala 3 documentation regarding transparent traits. I came across the transparentTrait annotation documentation here(transparentTrait).

It says that “An annotation that can be used from Scala 2 to mark a trait as transparent.”. However, I could not find this annotation in scala 2 code.
So, what is the meaning of the above sentence that this annotation @transparentTrait can be used instead of transparent trait?


Sample usage on reflect.Enum where apparently it served as migration for bootstrapping. It flip-flopped on transparent trait or @mixin.

Presumably, your Scala 2 project can depend on scala3-library and it works.

The test works the same:

//transparent trait A
//transparent trait B
import annotation.*
@transparentTrait trait A
@transparentTrait trait B
trait C

object Test:
  val x = identity(new A with B) // infers A with B (because there's no non-transparent trait in the intersection)
  val x2: A with B = x // OK

  val y = identity(new A with B with C) // infers C
  val y2: C = y // OK
  val y3: A with B = y // error

The only tragic thing is that you still have to import annotations.

Thanks @som-snytt
When I read the doc, I thought that this was there in 2.13.x. So, this makes sense if the scala 2 code is dependant on scala-library, I believe.
Thanks again