Skip to content

Commit e3454bd

Browse files
committed
Fix #7322: Remove ad-hoc inline node
This Inlined node not was added as part of a fix for issue #3898. It was an ad-hoc patch that ended up causing more issues than fixes and therfore is removed.
1 parent b274cd3 commit e3454bd

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -282,14 +282,7 @@ class ReifyQuotes extends MacroTransform {
282282

283283
val tpe = MethodType(defn.SeqType.appliedTo(defn.AnyType) :: Nil, tree.tpe.widen)
284284
val meth = ctx.newSymbol(lambdaOwner, UniqueName.fresh(nme.ANON_FUN), Synthetic | Method, tpe)
285-
val closure = Closure(meth, tss => body(tss.head.head)(ctx.withOwner(meth)).changeOwner(ctx.owner, meth)).withSpan(tree.span)
286-
287-
enclosingInlineds match {
288-
case enclosingInline :: _ =>
289-
// In case a tree was inlined inside of the quote and we this closure corresponds to code within it we need to keep the inlined node.
290-
Inlined(enclosingInline, Nil, closure)(ctx.withSource(lambdaOwner.topLevelClass.source))
291-
case Nil => closure
292-
}
285+
Closure(meth, tss => body(tss.head.head)(ctx.withOwner(meth)).changeOwner(ctx.owner, meth)).withSpan(tree.span)
293286
}
294287

295288
private def transformWithCapturer(tree: Tree)(capturer: mutable.Map[Symbol, Tree] => Tree => Tree)(implicit ctx: Context): Tree = {

tests/pos-macros/i7322/Macro_1.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import scala.quoted.{ QuoteContext, Expr, Type }
2+
3+
trait M[T] {
4+
def f: Any
5+
}
6+
7+
inline def g[T: Type](em: Expr[M[T]])(using QuoteContext) = '{$em.f}

tests/pos-macros/i7322/Test_2.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import scala.quoted.{ QuoteContext, Expr }
2+
3+
def h(m: Expr[M[String]])(using QuoteContext): Expr[Any] = g(m)

0 commit comments

Comments
 (0)