Skip to content

Commit c40ef6e

Browse files
authored
Merge pull request #9920 from dotty-staging/remove-quoted-Lambda-extractor
Remove quoted.Lambda extractor
2 parents 68e34fc + 05e33df commit c40ef6e

File tree

7 files changed

+0
-107
lines changed

7 files changed

+0
-107
lines changed

compiler/src/dotty/tools/dotc/quoted/QuoteContextImpl.scala

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2668,46 +2668,6 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext:
26682668
case _ =>
26692669
None
26702670

2671-
def lambdaExtractor(fn: Term, paramTypes: List[Type]): Option[List[Term] => Term] = {
2672-
def rec(fn: Term, transformBody: Term => Term): Option[List[Term] => Term] = {
2673-
fn match {
2674-
case tpd.Inlined(call, bindings, expansion) =>
2675-
// this case must go before closureDef to avoid dropping the inline node
2676-
rec(expansion, tpd.cpy.Inlined(fn)(call, bindings, _))
2677-
case tpd.Typed(expr, tpt) =>
2678-
val tpe = tpt.tpe.dropDependentRefinement
2679-
// we checked that this is a plain Function closure, so there will be an apply method with a MethodType
2680-
// and the expected signature based on param types
2681-
val expectedSig = Signature(Nil, tpnme.WILDCARD).prependTermParams(paramTypes, false)
2682-
val method = tpt.tpe.member(nme.apply).atSignature(expectedSig)
2683-
if method.symbol.is(Deferred) then
2684-
val methodType = method.info.asInstanceOf[MethodType]
2685-
// result might contain paramrefs, so we substitute them with arg termrefs
2686-
val resultTypeWithSubst = methodType.resultType.substParams(methodType, paramTypes)
2687-
rec(expr, tpd.Typed(_, tpd.TypeTree(resultTypeWithSubst).withSpan(tpt.span)))
2688-
else
2689-
None
2690-
case cl @ tpd.closureDef(ddef) =>
2691-
def replace(body: Term, argRefs: List[Term]): Term = {
2692-
val paramSyms = ddef.vparamss.head.map(param => param.symbol)
2693-
val paramToVals = paramSyms.zip(argRefs).toMap
2694-
new dotc.ast.TreeTypeMap(
2695-
oldOwners = ddef.symbol :: Nil,
2696-
newOwners = ctx.owner :: Nil,
2697-
treeMap = tree => paramToVals.get(tree.symbol).map(_.withSpan(tree.span)).getOrElse(tree)
2698-
).transform(body)
2699-
}
2700-
Some(argRefs => replace(transformBody(ddef.rhs), argRefs))
2701-
case tpd.Block(stats, expr) =>
2702-
// this case must go after closureDef to avoid matching the closure
2703-
rec(expr, tpd.cpy.Block(fn)(stats, _))
2704-
case _ =>
2705-
None
2706-
}
2707-
}
2708-
rec(fn, identity)
2709-
}
2710-
27112671
def compilerId: Int = rootContext.outersIterator.toList.last.hashCode()
27122672

27132673
end tasty

library/src-bootstrapped/scala/quoted/Lambda.scala

Lines changed: 0 additions & 32 deletions
This file was deleted.

library/src/scala/internal/tasty/CompilerInterface.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ trait CompilerInterface { self: scala.tasty.Reflection =>
6464
/** Returns Some with a beta-reduced application or None */
6565
def betaReduce(tree: Term): Option[Term]
6666

67-
def lambdaExtractor(term: Term, paramTypes: List[Type]): Option[List[Term] => Term]
68-
6967
def compilerId: Int
7068

7169
}

tests/run-macros/lambda-extractor-1/Macro_1.scala

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/run-macros/lambda-extractor-1/Test_2.scala

Lines changed: 0 additions & 6 deletions
This file was deleted.

tests/run-macros/lambda-extractor-2/Macro_1.scala

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/run-macros/lambda-extractor-2/Test_2.scala

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)