-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
area:metaprogramming:quotesIssues related to quotes and splicesIssues related to quotes and splicesitype:bug
Milestone
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.
Metadata
Metadata
Assignees
Labels
area:metaprogramming:quotesIssues related to quotes and splicesIssues related to quotes and splicesitype:bug