summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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