Skip to content

Commit

Permalink
Fix #8035: Add missing transformFollowing to VCInlineMethods
Browse files Browse the repository at this point in the history
VCinline methods rewires function calls and sometimes pulls out the prefix
so the original call becomes a subnode. In that case it has to make sure
that the subnode call is still transformed by the following phases.
  • Loading branch information
odersky committed Jan 21, 2020
1 parent 428bddb commit 9928fd4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions compiler/src/dotty/tools/dotc/transform/VCInlineMethods.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package dotty.tools.dotc
package dotty.tools
package dotc
package transform

import ast.{Trees, tpd}
Expand Down Expand Up @@ -71,10 +72,11 @@ class VCInlineMethods extends MiniPhase with IdentityDenotTransformer {
evalOnce(qual) { ev =>
val ctArgs = ctParams.map(tparam =>
TypeTree(tparam.typeRef.asSeenFrom(ev.tpe, origCls)))
ref(extensionMeth)
transformFollowing(
ref(extensionMeth)
.appliedToTypeTrees(mtArgs ++ ctArgs)
.appliedTo(ev)
.appliedToArgss(mArgss)
.appliedToArgss(mArgss))
}
else
ref(extensionMeth)
Expand Down
4 changes: 2 additions & 2 deletions tests/run/i8035.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ implicit class Ops[A](val a: String) extends AnyVal {
def foo(e: => String): Unit = ()
}

def bar(e: => String): Unit = (new Ops("")).foo(e)
def baz(e: => String): Unit = "".foo(e)
def bar(e1: => String): Unit = (new Ops("")).foo(e1)
def baz(e2: => String): Unit = "".foo(e2)

@main def Test = baz("")

0 comments on commit 9928fd4

Please sign in to comment.