File tree Expand file tree Collapse file tree 3 files changed +6
-4
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 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._
44import dotty .tools .dotc .ast .tpd
55import dotty .tools .dotc .core .Contexts ._
66import 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 }
89
910
1011class InlineCalls extends MacroTransform { thisPhase =>
@@ -22,14 +23,15 @@ class InlineCalls extends MacroTransform { thisPhase =>
2223
2324 class InlineCallsTransformer extends Transformer {
2425 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))
2729 case _ : MemberDef =>
2830 val newTree = super .transform(tree)
2931 newTree.symbol.defTree = newTree // update tree set in PostTyper or set for inlined members
3032 newTree
3133 case _ =>
32- super .transform(tree)
34+ ConstFold ( super .transform(tree) )
3335 }
3436 }
3537
File renamed without changes.
File renamed without changes.
You can’t perform that action at this time.
0 commit comments