aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/transform/LambdaLift.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-04-17 20:13:38 +0200
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2015-04-17 21:32:05 +0200
commit0b4e4cb7e71367752558fac29129f7e182d9206a (patch)
tree8c462d1bde9566c1ca049ebebe58566e1b63fd43 /src/dotty/tools/dotc/transform/LambdaLift.scala
parentb0b690285bf46ba7e4df91e131bff6921430be48 (diff)
downloaddotty-0b4e4cb7e71367752558fac29129f7e182d9206a.tar.gz
dotty-0b4e4cb7e71367752558fac29129f7e182d9206a.tar.bz2
dotty-0b4e4cb7e71367752558fac29129f7e182d9206a.zip
Fix #342 Lambda lift idents need to get new prefix
Idents of lifted symbols become class members, need to carry the right reference with the right prefix as type.
Diffstat (limited to 'src/dotty/tools/dotc/transform/LambdaLift.scala')
-rw-r--r--src/dotty/tools/dotc/transform/LambdaLift.scala9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/transform/LambdaLift.scala b/src/dotty/tools/dotc/transform/LambdaLift.scala
index 5d47d2143..9b35d1d99 100644
--- a/src/dotty/tools/dotc/transform/LambdaLift.scala
+++ b/src/dotty/tools/dotc/transform/LambdaLift.scala
@@ -394,8 +394,13 @@ class LambdaLift extends MiniPhase with IdentityDenotTransformer { thisTransform
val sym = tree.symbol
tree.tpe match {
case tpe @ TermRef(prefix, _) =>
- if ((prefix eq NoPrefix) && sym.enclosure != currentEnclosure && !sym.isStatic)
- (if (sym is Method) memberRef(sym) else proxyRef(sym)).withPos(tree.pos)
+ if (prefix eq NoPrefix)
+ if (sym.enclosure != currentEnclosure && !sym.isStatic)
+ (if (sym is Method) memberRef(sym) else proxyRef(sym)).withPos(tree.pos)
+ else if (sym.owner.isClass) // sym was lifted out
+ ref(sym).withPos(tree.pos)
+ else
+ tree
else if (!prefixIsElidable(tpe)) ref(tpe)
else tree
case _ =>