From 184296f694d3623098864b8313b2ed7ccf7380f1 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 9 Sep 2016 21:41:56 +0200 Subject: Inline argument closures to inline methods If an argumnet to an inline method refers to a closure that is the result of eta-expanding another inline method inline the argument method. --- src/dotty/tools/dotc/typer/Typer.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/dotty/tools/dotc/typer/Typer.scala') diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 8830537e3..c8362522d 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -744,7 +744,11 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit case WildcardType(_) => untpd.TypeTree() case _ => untpd.TypeTree(protoResult) } - desugar.makeClosure(inferredParams, fnBody, resultTpt) + val inlineable = fnBody match { + case Apply(untpd.TypedSplice(fn), _) => Inliner.hasBodyToInline(fn.symbol) + case _ => false + } + desugar.makeClosure(inferredParams, fnBody, resultTpt, inlineable) } typed(desugared, pt) } -- cgit v1.2.3