summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Burmako <burmako@epfl.ch>2011-11-29 15:25:45 +0000
committerEugene Burmako <burmako@epfl.ch>2011-11-29 15:25:45 +0000
commitca37db37e944c05a35f435c6130a815bdead8604 (patch)
tree14565766f3da6dac66f96fc21e3eec606259d593
parent3e04761ce2f4cfb9cf02db0db49b18e84b2b3d2d (diff)
downloadscala-ca37db37e944c05a35f435c6130a815bdead8604.tar.gz
scala-ca37db37e944c05a35f435c6130a815bdead8604.tar.bz2
scala-ca37db37e944c05a35f435c6130a815bdead8604.zip
Added the check against UnitClass in freeLocals...
Added the check against UnitClass in freeLocalsTraverser. Closes SI-5245. Review by odersky.
-rw-r--r--src/compiler/scala/tools/nsc/transform/LiftCode.scala2
-rw-r--r--test/files/pos/t5245.scala3
2 files changed, 4 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/LiftCode.scala b/src/compiler/scala/tools/nsc/transform/LiftCode.scala
index 40ce7128c8..08e35ff6c3 100644
--- a/src/compiler/scala/tools/nsc/transform/LiftCode.scala
+++ b/src/compiler/scala/tools/nsc/transform/LiftCode.scala
@@ -226,7 +226,7 @@ abstract class LiftCode extends Transform with TypingTransformers {
val symClass = symTpe.typeSymbol
atPhase(phase.next) {
def refType(valueRef: Map[Symbol, Symbol], objectRefClass: Symbol) =
- if (isValueClass(symClass)) valueRef(symClass).tpe
+ if (isValueClass(symClass) && symClass != UnitClass) valueRef(symClass).tpe
else appliedType(objectRefClass.typeConstructor, List(symTpe))
sym updateInfo (
diff --git a/test/files/pos/t5245.scala b/test/files/pos/t5245.scala
new file mode 100644
index 0000000000..3a4b4d286e
--- /dev/null
+++ b/test/files/pos/t5245.scala
@@ -0,0 +1,3 @@
+object Foo {
+ def bar = { var x = (); def foo() = x }
+} \ No newline at end of file