Skip to content

Commit 9928fd4

Browse files
committed
Fix #8035: Add missing transformFollowing to VCInlineMethods
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.
1 parent 428bddb commit 9928fd4

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
package dotty.tools.dotc
1+
package dotty.tools
2+
package dotc
23
package transform
34

45
import ast.{Trees, tpd}
@@ -71,10 +72,11 @@ class VCInlineMethods extends MiniPhase with IdentityDenotTransformer {
7172
evalOnce(qual) { ev =>
7273
val ctArgs = ctParams.map(tparam =>
7374
TypeTree(tparam.typeRef.asSeenFrom(ev.tpe, origCls)))
74-
ref(extensionMeth)
75+
transformFollowing(
76+
ref(extensionMeth)
7577
.appliedToTypeTrees(mtArgs ++ ctArgs)
7678
.appliedTo(ev)
77-
.appliedToArgss(mArgss)
79+
.appliedToArgss(mArgss))
7880
}
7981
else
8082
ref(extensionMeth)

tests/run/i8035.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ implicit class Ops[A](val a: String) extends AnyVal {
22
def foo(e: => String): Unit = ()
33
}
44

5-
def bar(e: => String): Unit = (new Ops("")).foo(e)
6-
def baz(e: => String): Unit = "".foo(e)
5+
def bar(e1: => String): Unit = (new Ops("")).foo(e1)
6+
def baz(e2: => String): Unit = "".foo(e2)
77

88
@main def Test = baz("")

0 commit comments

Comments
 (0)