Closed
Description
Compiler version
3.6.3
Minimized code
Macros inside an object cannot access methods inherited by the object without calling the object itself.
import scala.quoted.*
trait Foo:
def inherited = ()
object Bar extends Foo:
def local = ()
def macro1(using Quotes): Expr[Unit] = '{ local } // Ok
def macro2(using Quotes): Expr[Unit] = '{ Bar.inherited } // Ok
def macro3(using Quotes): Expr[Unit] = '{ inherited } // Error
Output
access to object Bar from wrong staging level:
- the definition is at level 0,
- but the access is at level 1.
Expectation
This should work.