diff --git a/compiler/src/dotty/tools/dotc/typer/Inliner.scala b/compiler/src/dotty/tools/dotc/typer/Inliner.scala index d5027192b269..7bad2b4a9fce 100644 --- a/compiler/src/dotty/tools/dotc/typer/Inliner.scala +++ b/compiler/src/dotty/tools/dotc/typer/Inliner.scala @@ -1376,7 +1376,11 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(using Context) { super.typedValDef(vdef1, sym) override def typedApply(tree: untpd.Apply, pt: Type)(using Context): Tree = - val res = constToLiteral(betaReduce(super.typedApply(tree, pt))) match { + def cancelQuotes(tree: Tree): Tree = + tree match + case Quoted(Spliced(inner)) => inner + case _ => tree + val res = cancelQuotes(constToLiteral(betaReduce(super.typedApply(tree, pt)))) match { case res: Apply if res.symbol == defn.QuotedRuntime_exprSplice && level == 0 && !hasInliningErrors => diff --git a/tests/pos-macros/i12173.scala b/tests/pos-macros/i12173.scala new file mode 100644 index 000000000000..c5c56ed3e0e7 --- /dev/null +++ b/tests/pos-macros/i12173.scala @@ -0,0 +1,7 @@ +object TestMacro { + inline def test[T](inline t: T): T = ${ '{ ${ 't } } } +} + +object Test { + TestMacro.test("x") +} diff --git a/tests/pos-macros/i12173b.scala b/tests/pos-macros/i12173b.scala new file mode 100644 index 000000000000..ce638485b74c --- /dev/null +++ b/tests/pos-macros/i12173b.scala @@ -0,0 +1,7 @@ +object TestMacro { + inline def test[T](inline t: T): T = ${ '{ ${ '{ ${ 't } } } } } +} + +object Test { + TestMacro.test("x") +} diff --git a/tests/pos-macros/i12173c.scala b/tests/pos-macros/i12173c.scala new file mode 100644 index 000000000000..2806a2183fdb --- /dev/null +++ b/tests/pos-macros/i12173c.scala @@ -0,0 +1,7 @@ +object TestMacro { + inline def test[T](inline t: T): T = ${ '{ ${ '{ ${ '{ ${ '{ ${ '{ ${ '{ ${ '{ ${ 't } } } } } } } } } } } } } } } +} + +object Test { + TestMacro.test("x") +}