Skip to content

Commit 8c79d34

Browse files
committed
Only mark inline method with top level splices as macros
1 parent c2067f5 commit 8c79d34

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

compiler/src/dotty/tools/dotc/typer/Applications.scala

+5-2
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,11 @@ object Applications {
199199
else if (c.owner.isInlineMethod) c.owner.setFlag(Macro)
200200
else if (!c.outer.owner.is(Package)) markAsMacro(c.outer)
201201
val sym = tree.symbol
202-
if (sym.isSplice || sym.isQuote) {
203-
markAsMacro(ctx)
202+
if (sym.isSplice) {
203+
if (StagingContext.level == 0)
204+
markAsMacro(ctx)
205+
ctx.compilationUnit.needsStaging = true
206+
} else if (sym.isQuote) {
204207
ctx.compilationUnit.needsStaging = true
205208
}
206209

tests/pos/quoted-inline-quote.scala

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class Foo {
2+
inline def foo(x: quoted.Expr[String]) = '{ println(${x}) }
3+
foo('{"abc"})
4+
}

0 commit comments

Comments
 (0)