Skip to content

Commit

Permalink
Simplify adaptMethodCall
Browse files Browse the repository at this point in the history
  • Loading branch information
zeptometer committed Jun 19, 2023
1 parent 544818d commit 3652eca
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions compiler/src/scala/quoted/runtime/impl/QuoteMatcher.scala
Original file line number Diff line number Diff line change
Expand Up @@ -517,12 +517,7 @@ object QuoteMatcher {
* f has a method type `(x: Int): Int` and `f` maps to `g`, `p` should hold
* `g.apply(0)` because the type of `g` is `Int => Int` due to eta expansion.
*/
case Apply(_, _) if !tree.tpe.isInstanceOf[MethodicType] && env.contains(tree.symbol) =>
def adaptMethodCalls(t: Tree): Tree = t match
case id: Ident => env.get(id.symbol).flatMap(argsMap.get).getOrElse(t)
case Apply(fun, args) => adaptMethodCalls(fun).select(nme.apply).appliedToArgs(args)

adaptMethodCalls(tree)
case Apply(fun, args) if env.contains(tree.symbol) => transform(fun).select(nme.apply).appliedToArgs(args)
case tree: Ident => env.get(tree.symbol).flatMap(argsMap.get).getOrElse(tree)
case tree => super.transform(tree)
}.transform(tree)
Expand Down

0 comments on commit 3652eca

Please sign in to comment.