summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHubert Plociniczak <hubert.plociniczak@epfl.ch>2010-09-22 14:00:35 +0000
committerHubert Plociniczak <hubert.plociniczak@epfl.ch>2010-09-22 14:00:35 +0000
commita5d47fb693d9b88ea9ed414762f16e027be64ada (patch)
treec6c5962343a7c7a4e1c7d98dcc6b2ad930c91344 /test
parent39a8b1042e04a5b838ac5688e014c29680bf0561 (diff)
downloadscala-a5d47fb693d9b88ea9ed414762f16e027be64ada.tar.gz
scala-a5d47fb693d9b88ea9ed414762f16e027be64ada.tar.bz2
scala-a5d47fb693d9b88ea9ed414762f16e027be64ada.zip
Closes #1591.
Diffstat (limited to 'test')
-rw-r--r--test/files/jvm/serialization.scala26
-rw-r--r--test/files/pos/t1591.scala7
-rw-r--r--test/files/run/t1591.check1
-rw-r--r--test/files/run/t1591.scala14
4 files changed, 48 insertions, 0 deletions
diff --git a/test/files/jvm/serialization.scala b/test/files/jvm/serialization.scala
index 06086f4038..b8656888c6 100644
--- a/test/files/jvm/serialization.scala
+++ b/test/files/jvm/serialization.scala
@@ -532,6 +532,31 @@ object Test6 {
}
//############################################################################
+// Nested objects cannot get readresolve automatically because after deserialization
+// they would be null (they are treated as lazy vals)
+@serializable
+class Outer {
+
+ @serializable
+ object Inner
+}
+
+object Test7 {
+ val x = new Outer
+ x.Inner // initialize
+ try {
+ val y:Outer = read(write(x))
+ if (y.Inner == null)
+ println("Inner object is null")
+ }
+ catch {
+ case e: Exception =>
+ println("Error in Test7: " + e)
+ }
+
+}
+
+//############################################################################
// Test code
object Test {
@@ -542,6 +567,7 @@ object Test {
Test4_xml
Test5
Test6
+ Test7
}
}
diff --git a/test/files/pos/t1591.scala b/test/files/pos/t1591.scala
new file mode 100644
index 0000000000..4f55d7ce19
--- /dev/null
+++ b/test/files/pos/t1591.scala
@@ -0,0 +1,7 @@
+trait A
+
+object Test {
+ lazy val a = new A {
+ object Zenek
+ }
+}
diff --git a/test/files/run/t1591.check b/test/files/run/t1591.check
new file mode 100644
index 0000000000..48082f72f0
--- /dev/null
+++ b/test/files/run/t1591.check
@@ -0,0 +1 @@
+12
diff --git a/test/files/run/t1591.scala b/test/files/run/t1591.scala
new file mode 100644
index 0000000000..434064a5dd
--- /dev/null
+++ b/test/files/run/t1591.scala
@@ -0,0 +1,14 @@
+abstract class A {
+
+ lazy val lazyBar = bar
+
+ object bar {
+ val foo = 12
+ }
+
+}
+
+object Test extends Application {
+ val a = new A{}
+ println(a.lazyBar.foo)
+}