File tree 3 files changed +6
-4
lines changed
compiler/src/dotty/tools/dotc/transform
3 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,8 @@ import dotty.tools.dotc.ast.Trees._
4
4
import dotty .tools .dotc .ast .tpd
5
5
import dotty .tools .dotc .core .Contexts ._
6
6
import dotty .tools .dotc .core .Phases .Phase
7
- import dotty .tools .dotc .typer .Inliner
7
+ import dotty .tools .dotc .core .Types .MethodicType
8
+ import dotty .tools .dotc .typer .{ConstFold , Inliner }
8
9
9
10
10
11
class InlineCalls extends MacroTransform { thisPhase =>
@@ -22,14 +23,15 @@ class InlineCalls extends MacroTransform { thisPhase =>
22
23
23
24
class InlineCallsTransformer extends Transformer {
24
25
override def transform (tree : Tree )(implicit ctx : Context ): Tree = tree match {
25
- case _ : RefTree | _ : GenericApply [_] if Inliner .isInlineable(tree) && ! ctx.reporter.hasErrors =>
26
- transform(Inliner .inlineCall(tree, tree.tpe.widen))
26
+ case _ : RefTree | _ : GenericApply [_] if ! tree.tpe.widenDealias.isInstanceOf [MethodicType ] && Inliner .isInlineable(tree) && ! ctx.reporter.hasErrors =>
27
+ val tree2 = super .transform(tree) // transform arguments before inlining (inline arguments and constant fold arguments)
28
+ transform(Inliner .inlineCall(tree2, tree.tpe.widen))
27
29
case _ : MemberDef =>
28
30
val newTree = super .transform(tree)
29
31
newTree.symbol.defTree = newTree // update tree set in PostTyper or set for inlined members
30
32
newTree
31
33
case _ =>
32
- super .transform(tree)
34
+ ConstFold ( super .transform(tree) )
33
35
}
34
36
}
35
37
File renamed without changes.
File renamed without changes.
You can’t perform that action at this time.
0 commit comments