From ca37db37e944c05a35f435c6130a815bdead8604 Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Tue, 29 Nov 2011 15:25:45 +0000 Subject: Added the check against UnitClass in freeLocals... Added the check against UnitClass in freeLocalsTraverser. Closes SI-5245. Review by odersky. --- src/compiler/scala/tools/nsc/transform/LiftCode.scala | 2 +- test/files/pos/t5245.scala | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 test/files/pos/t5245.scala 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 -- cgit v1.2.3