diff options
author | Martin Odersky <odersky@gmail.com> | 2016-09-13 18:15:21 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-10-02 16:12:28 +0200 |
commit | 748d1d852ce28785f61f511758071c70a6137356 (patch) | |
tree | e6a8f0a4d8b8268792958a232e1fdc9f453259be /src/dotty/tools/dotc/ast/TreeInfo.scala | |
parent | b5132e87afe1a98467369d2f91ba4483a6a88ea4 (diff) | |
download | dotty-748d1d852ce28785f61f511758071c70a6137356.tar.gz dotty-748d1d852ce28785f61f511758071c70a6137356.tar.bz2 dotty-748d1d852ce28785f61f511758071c70a6137356.zip |
Generalize checkInlineConformant to functions
Pure expressions with function types now are considered
conforming. Necessitated a change in TreeInfo to accept
closures as pure expressions.
Test case in inlineForeach
Diffstat (limited to 'src/dotty/tools/dotc/ast/TreeInfo.scala')
-rw-r--r-- | src/dotty/tools/dotc/ast/TreeInfo.scala | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/ast/TreeInfo.scala b/src/dotty/tools/dotc/ast/TreeInfo.scala index 421ff5919..a6c49cffd 100644 --- a/src/dotty/tools/dotc/ast/TreeInfo.scala +++ b/src/dotty/tools/dotc/ast/TreeInfo.scala @@ -305,6 +305,8 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] => if (vdef.symbol.flags is Mutable) Impure else exprPurity(vdef.rhs) case _ => Impure + // TODO: It seem like this should be exprPurity(tree) + // But if we do that the repl/vars test break. Need to figure out why that's the case. } /** The purity level of this expression. @@ -321,7 +323,8 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] => case EmptyTree | This(_) | Super(_, _) - | Literal(_) => + | Literal(_) + | Closure(_, _, _) => Pure case Ident(_) => refPurity(tree) |