Skip to content

Do not deprecate @compileTimeOnly #6419

Closed
@LPTK

Description

@LPTK

What's the rationale for deprecating @compileTimeOnly in #6416?

First, doing that would introduce unnecessary migration pain, for little gain (I assume it's quite straightforward to support in the compiler). Second, the proposed alternative doesn't cover all use cases of @compileTimeOnly well. For example, can you encode the following with just inline and error?

scala> trait A { @scala.annotation.compileTimeOnly("oops") def f: Int }
defined trait A

scala> class B extends A { def f = 0 }
defined class B

scala> (new B).f
res0: Int = 0

scala> (new B : A).f
<console>:14: error: oops
       (new B : A).f
                   ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions