Skip to content

Commit 26c3215

Browse files
committed
Fix tests
1 parent 6c858d5 commit 26c3215

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/run-macros/i6988/FirstArg_1.scala

+4-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ object Macros {
1111
def argsImpl(given qctx: QuoteContext): Expr[FirstArg] = {
1212
import qctx.tasty.{_, given}
1313

14-
var enclosingCls: Symbol = rootContext.owner
14+
def enclosingClass(cur: Symbol = rootContext.owner): Symbol =
15+
if (cur.isClassDef) cur
16+
else enclosingClass(cur.owner)
1517

1618
def enclosingParamList(owner: Symbol): Seq[Seq[Symbol]] =
1719
if owner.isClassDef then
@@ -24,7 +26,7 @@ object Macros {
2426
Literal(Constant(value)).seal.asInstanceOf[Expr[String]]
2527
val paramss = enclosingParamList(rootContext.owner)
2628
val firstArg = paramss.flatten.head
27-
val ref = Select.unique(This(enclosingCls), firstArg.name)
29+
val ref = Select.unique(This(enclosingClass()), firstArg.name)
2830
'{ FirstArg(${ref.seal}, ${Expr(firstArg.name)}) }
2931
}
3032
}

0 commit comments

Comments
 (0)