diff options
author | Martin Odersky <odersky@gmail.com> | 2016-09-15 15:39:57 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-10-02 16:12:28 +0200 |
commit | 5a46d19dde76b739f6672c9b6f57355cfd38159a (patch) | |
tree | 57dc454cad17be45e71e9180bb283c7cd606920e /src/dotty/tools/dotc/ast/TreeTypeMap.scala | |
parent | c9fa504161cc34ec979ae3c1b73db6798adc4872 (diff) | |
download | dotty-5a46d19dde76b739f6672c9b6f57355cfd38159a.tar.gz dotty-5a46d19dde76b739f6672c9b6f57355cfd38159a.tar.bz2 dotty-5a46d19dde76b739f6672c9b6f57355cfd38159a.zip |
Handle inlining in inlining arguments
We got unbound symbols before because
a TreeTypeMap would copy a tree of an inline
DefDef but would not adapt the inline body
stored in the @inline annotation of the DefDef
to point to the updated tree.
Diffstat (limited to 'src/dotty/tools/dotc/ast/TreeTypeMap.scala')
-rw-r--r-- | src/dotty/tools/dotc/ast/TreeTypeMap.scala | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/ast/TreeTypeMap.scala b/src/dotty/tools/dotc/ast/TreeTypeMap.scala index 0593e8159..6d0c7d8e3 100644 --- a/src/dotty/tools/dotc/ast/TreeTypeMap.scala +++ b/src/dotty/tools/dotc/ast/TreeTypeMap.scala @@ -6,6 +6,8 @@ import core._ import Types._, Contexts._, Constants._, Names._, Flags._ import SymDenotations._, Symbols._, Annotations._, Trees._, Symbols._ import Denotations._, Decorators._ +import typer.Inliner +import config.Printers.inlining import dotty.tools.dotc.transform.SymUtils._ /** A map that applies three functions and a substitution together to a tree and @@ -92,7 +94,12 @@ final class TreeTypeMap( case ddef @ DefDef(name, tparams, vparamss, tpt, _) => val (tmap1, tparams1) = transformDefs(ddef.tparams) val (tmap2, vparamss1) = tmap1.transformVParamss(vparamss) - cpy.DefDef(ddef)(name, tparams1, vparamss1, tmap2.transform(tpt), tmap2.transform(ddef.rhs)) + val res = cpy.DefDef(ddef)(name, tparams1, vparamss1, tmap2.transform(tpt), tmap2.transform(ddef.rhs)) + if (Inliner.hasBodyToInline(res.symbol)) { + inlining.println(i"update inline body ${res.symbol}") + Inliner.updateInlineBody(res.symbol, res.rhs) + } + res case blk @ Block(stats, expr) => val (tmap1, stats1) = transformDefs(stats) val expr1 = tmap1.transform(expr) |