summaryrefslogtreecommitdiff
path: root/test/files/run/t8708_b
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2014-07-01 16:19:34 +0200
committerLukas Rytz <lukas.rytz@gmail.com>2014-07-07 10:41:11 +0200
commit14fa7bef120cbb996d042daba6095530167c49ed (patch)
tree7bb6a7674fb22ff5146eb2ab5c8f6b4d9514d200 /test/files/run/t8708_b
parent3f79f8eabfa4c55e167a4ca742fc46106f84b2e1 (diff)
downloadscala-14fa7bef120cbb996d042daba6095530167c49ed.tar.gz
scala-14fa7bef120cbb996d042daba6095530167c49ed.tar.bz2
scala-14fa7bef120cbb996d042daba6095530167c49ed.zip
SI-8708 Fix pickling of LOCAL_CHILD child of sealed classes
When a sealed class or trait has local children, they are not pickled in as part of the children of the symbol (introduced in 12a2b3b to fix Aladdin bug 1055). Instead the compiler adds a single child class named LOCAL_CHILD. The parents of its ClassInfoType were wrong: the first parent should be a class. For sealed traits, we were using the trait itself. Also, the LOCAL_CHILD dummy class was entered as a member of its enclosing class, which is wrong: it represents a local (non-member) class, and it's a synthetic dummy anyway.
Diffstat (limited to 'test/files/run/t8708_b')
-rw-r--r--test/files/run/t8708_b/A_1.scala8
-rw-r--r--test/files/run/t8708_b/Test_2.scala21
2 files changed, 29 insertions, 0 deletions
diff --git a/test/files/run/t8708_b/A_1.scala b/test/files/run/t8708_b/A_1.scala
new file mode 100644
index 0000000000..e767420f9e
--- /dev/null
+++ b/test/files/run/t8708_b/A_1.scala
@@ -0,0 +1,8 @@
+package p
+
+class C {
+
+ sealed trait T { def f: Int }
+
+ def foo: T = new T { def f = 1 }
+}
diff --git a/test/files/run/t8708_b/Test_2.scala b/test/files/run/t8708_b/Test_2.scala
new file mode 100644
index 0000000000..c978490609
--- /dev/null
+++ b/test/files/run/t8708_b/Test_2.scala
@@ -0,0 +1,21 @@
+import scala.tools.partest._
+import java.io.{Console => _, _}
+
+object Test extends DirectTest {
+
+ override def extraSettings: String = "-usejavacp -cp " + testOutput.path
+
+ override def code = ""
+
+ override def show(): Unit = {
+ val g = newCompiler()
+ withRun(g)(r => {
+ val c = g.rootMirror.getRequiredClass("p.C")
+ println(c.info.decls)
+ val t = c.info.member(g.newTypeName("T"))
+ // this test ensrues that the <local child> dummy class symbol is not entered in the
+ // scope of trait T during unpickling.
+ println(t.info.decls)
+ })
+ }
+}