Skip to content

Quotes are not checked for override errors / @deprecated usage / @experimental usage #17400

Open
@smarter

Description

@smarter

Compiler version

3.3.1-RC1-bin-20230502-dee0065-NIGHTLY

Minimized code

import scala.annotation.experimental
import scala.quoted.*

class A:
  def a: Int = 1

def checkOverride(using Quotes) =
  '{
     class Sub extends A:
       def a: String = ""
     new Sub
   }

class B:
  @deprecated def dep: Int = 1

def checkDeprecated(using Quotes) =
  '{
     val b = new B
     b.dep
   }

@experimental class C

def checkExperimental(using Quotes) =
  '{
     println(new C)
   }

Output

No compiler error

Expectation

  • checkOverride should emit an error since String is not a subtype of Int and the override keyword is missing
  • checkDeprecated should emit a deprecation warning
  • checkExperimental should emit an error since C is experimental.

The fact that we don't check for override errors has weird consequences like in #17398 (comment).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions