diff options
author | Martin Odersky <odersky@gmail.com> | 2016-09-05 13:51:44 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-10-02 16:11:21 +0200 |
commit | 4dd8469391c440728fa8ee4e45d521b7933d5bd8 (patch) | |
tree | a64baa34b874596e621ca69b97bc580d0728eaf4 /src/dotty/tools/dotc/typer/TypeAssigner.scala | |
parent | 29acee02f66c988cc9763057c785c98477201755 (diff) | |
download | dotty-4dd8469391c440728fa8ee4e45d521b7933d5bd8.tar.gz dotty-4dd8469391c440728fa8ee4e45d521b7933d5bd8.tar.bz2 dotty-4dd8469391c440728fa8ee4e45d521b7933d5bd8.zip |
Avoid reference to local bindings in Inlined nodes
To do this, use a proper TypeAssigner for Inlined, analogous to
how we type Blocks.
Diffstat (limited to 'src/dotty/tools/dotc/typer/TypeAssigner.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/TypeAssigner.scala | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/typer/TypeAssigner.scala b/src/dotty/tools/dotc/typer/TypeAssigner.scala index ba8f35cd8..0c55d977e 100644 --- a/src/dotty/tools/dotc/typer/TypeAssigner.scala +++ b/src/dotty/tools/dotc/typer/TypeAssigner.scala @@ -127,6 +127,9 @@ trait TypeAssigner { widenMap(tp) } + def avoidingType(expr: Tree, bindings: List[Tree])(implicit ctx: Context): Type = + avoid(expr.tpe, localSyms(bindings).filter(_.isTerm)) + def seqToRepeated(tree: Tree)(implicit ctx: Context): Tree = Typed(tree, TypeTree(tree.tpe.widen.translateParameterized(defn.SeqClass, defn.RepeatedParamClass))) @@ -383,7 +386,10 @@ trait TypeAssigner { tree.withType(defn.UnitType) def assignType(tree: untpd.Block, stats: List[Tree], expr: Tree)(implicit ctx: Context) = - tree.withType(avoid(expr.tpe, localSyms(stats) filter (_.isTerm))) + tree.withType(avoidingType(expr, stats)) + + def assignType(tree: untpd.Inlined, bindings: List[Tree], expansion: Tree)(implicit ctx: Context) = + tree.withType(avoidingType(expansion, bindings)) def assignType(tree: untpd.If, thenp: Tree, elsep: Tree)(implicit ctx: Context) = tree.withType(thenp.tpe | elsep.tpe) |