Skip to content

Commit 32fc04b

Browse files
authored
Merge pull request #11153 from dotty-staging/fix-#11152
Fix implicit search in Inlining phase
2 parents 504b9dd + 2db4c89 commit 32fc04b

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

compiler/src/dotty/tools/dotc/transform/Inlining.scala

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import dotty.tools.dotc.quoted._
2626
import dotty.tools.dotc.transform.TreeMapWithStages._
2727
import dotty.tools.dotc.typer.Inliner
2828
import dotty.tools.dotc.typer.ImportInfo.withRootImports
29+
import dotty.tools.dotc.ast.TreeMapWithImplicits
2930

3031
import scala.annotation.constructorOnly
3132

@@ -57,6 +58,11 @@ class Inlining extends MacroTransform {
5758

5859
protected def newTransformer(using Context): Transformer = new Transformer {
5960
override def transform(tree: tpd.Tree)(using Context): tpd.Tree =
61+
new InliningTreeMap().transform(tree)
62+
}
63+
64+
private class InliningTreeMap extends TreeMapWithImplicits {
65+
override def transform(tree: Tree)(using Context): Tree = {
6066
tree match
6167
case tree: DefTree =>
6268
if tree.symbol.is(Inline) then tree
@@ -75,7 +81,7 @@ class Inlining extends MacroTransform {
7581
super.transform(tree)(using StagingContext.spliceContext)
7682
case _ =>
7783
super.transform(tree)
78-
84+
}
7985
}
8086
}
8187

tests/run-staging/i11152.scala

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
import scala.quoted._
3+
import scala.quoted.staging._
4+
5+
object Test {
6+
7+
given Toolbox = Toolbox.make(getClass.getClassLoader)
8+
9+
def main(args: Array[String]): Unit = run {
10+
'{
11+
given Int = 10
12+
compiletime.summonInline[Int]
13+
()
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)