diff options
author | Martin Odersky <odersky@gmail.com> | 2013-12-19 18:20:43 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-12-19 18:20:43 +0100 |
commit | 3d2c4454640f6e410b9413eac885c65f1f9763f5 (patch) | |
tree | c4b50788041d48ca08e4e8e07f78563cb65a53c6 /src/dotty/tools/dotc/ast/TreeInfo.scala | |
parent | dacea9fd70d6de85688da75fc7fa0f7493bcc06a (diff) | |
download | dotty-3d2c4454640f6e410b9413eac885c65f1f9763f5.tar.gz dotty-3d2c4454640f6e410b9413eac885c65f1f9763f5.tar.bz2 dotty-3d2c4454640f6e410b9413eac885c65f1f9763f5.zip |
Refinement to shadowing checking for implicits
Shadowing got confused if the shadowing expression truned out to be a closure.
Diffstat (limited to 'src/dotty/tools/dotc/ast/TreeInfo.scala')
-rw-r--r-- | src/dotty/tools/dotc/ast/TreeInfo.scala | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/ast/TreeInfo.scala b/src/dotty/tools/dotc/ast/TreeInfo.scala index 2d6f8bfef..9d9d4c9ff 100644 --- a/src/dotty/tools/dotc/ast/TreeInfo.scala +++ b/src/dotty/tools/dotc/ast/TreeInfo.scala @@ -83,6 +83,12 @@ trait TreeInfo[T >: Untyped] { self: Trees.Instance[T] => case mp => mp } + /** If tree is a closure, it's body, otherwise tree itself */ + def closureBody(tree: tpd.Tree): tpd.Tree = tree match { + case Block(DefDef(_, nme.ANON_FUN, _, _, _, rhs) :: Nil, Closure(_, _, _)) => rhs + case _ => tree + } + /** If this is an application, its function part, stripping all * Apply nodes (but leaving TypeApply nodes in). Otherwise the tree itself. */ |