File tree 3 files changed +24
-1
lines changed
compiler/src/dotty/tools/dotc/typer
3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,12 @@ trait QuotesAndSplices {
70
70
}
71
71
72
72
private def makeInlineable (tree : Tree )(using Context ): Tree =
73
- ctx.compilationUnit.inlineAccessors.makeInlineable(tree)
73
+ def quoteOwner (sym : Symbol ): Symbol =
74
+ if sym.owner.isClass then sym else quoteOwner(sym.owner)
75
+ inContext(ctx.withOwner(quoteOwner(ctx.owner))) {
76
+ ctx.compilationUnit.inlineAccessors.makeInlineable(tree)
77
+ }
78
+
74
79
75
80
/** Translate `${ t: Expr[T] }` into expression `t.splice` while tracking the quotation level in the context */
76
81
def typedSplice (tree : untpd.Splice , pt : Type )(using Context ): Tree = {
Original file line number Diff line number Diff line change
1
+ package mylib
2
+ import scala .quoted .*
3
+
4
+ object Main :
5
+ protected def foo : Unit = {}
6
+ inline def fooCaller : Unit =
7
+ def f = foo
8
+ foo
9
+ inline def fooCallerM : Unit = $ { fooMacro }
10
+ def fooMacro (using Quotes ): Expr [Unit ] =
11
+ ' { foo }
12
+ val fooExpr = ' { foo }
13
+ ' { $fooExpr }
Original file line number Diff line number Diff line change
1
+ import mylib .Main
2
+
3
+ object Test :
4
+ Main .fooCaller
5
+ Main .fooCallerM
You can’t perform that action at this time.
0 commit comments