Skip to content

Commit f1a37dd

Browse files
Add comment
1 parent 8ce1fcc commit f1a37dd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,8 +494,12 @@ class ReifyQuotes extends MacroTransformWithImplicits {
494494
}
495495
)
496496
}
497-
497+
/* Lambdas are generated outside the quote that is beeing reified (i.e. in outer.rctx.owner).
498+
* In case the case that level == -1 the code is not in a quote, it is in an inline method,
499+
* hence we should take that as owner directly.
500+
*/
498501
val lambdaOwner = if (level == -1) ctx.owner else outer.rctx.owner
502+
499503
val tpe = MethodType(defn.SeqType.appliedTo(defn.AnyType) :: Nil, tree.tpe.widen)
500504
val meth = ctx.newSymbol(lambdaOwner, UniqueName.fresh(nme.ANON_FUN), Synthetic | Method, tpe)
501505
Closure(meth, tss => body(tss.head.head)(ctx.withOwner(meth)).changeOwner(ctx.owner, meth))

0 commit comments

Comments
 (0)