Skip to content

Commit 764a905

Browse files
committed
Collect all local class definitions
Inline accessor was generated correctly and added at the end of the class. Then transforming `bar` the `foo$inline` method was not collected yet. Fixes #14373
1 parent c58f5c5 commit 764a905

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ abstract class TreeMapWithStages(@constructorOnly ictx: Context) extends TreeMap
149149
case (_:Import | _:Export) =>
150150
tree
151151

152+
case _: Template =>
153+
val last = enteredSyms
154+
tree.symbol.owner.info.decls.foreach(markSymbol)
155+
mapOverTree(last)
156+
152157
case _ =>
153158
markDef(tree)
154159
mapOverTree(enteredSyms)

tests/pos-macros/i14373.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import scala.quoted._
2+
trait Foo
3+
object Foo {
4+
def apply_impl(using Quotes): Expr[Any] = '{
5+
new Foo {
6+
private def foo: String = ???
7+
def bar: Any = ${ '{ foo }; ??? }
8+
}
9+
}
10+
}

0 commit comments

Comments
 (0)