aboutsummaryrefslogtreecommitdiff
path: root/tests/pickling
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-11-14 11:58:59 +0100
committerMartin Odersky <odersky@gmail.com>2016-11-16 14:25:40 +0100
commitfe20b9064fca765a38345a09aa484bfb537aa3c0 (patch)
tree99cce659b7c2fe7d79fd5c9c87ba51bcb96a7545 /tests/pickling
parent97b6985c34915b58e0c81fbab464f4bd532c27d0 (diff)
downloaddotty-fe20b9064fca765a38345a09aa484bfb537aa3c0.tar.gz
dotty-fe20b9064fca765a38345a09aa484bfb537aa3c0.tar.bz2
dotty-fe20b9064fca765a38345a09aa484bfb537aa3c0.zip
Pickle and unpickle type trees
Lots of other changes to make positions work out everywhere. One important change is that now trees can be shared, just as types can. This change improves memory requirements (a bit) and also makes positions in shared trees more robust.
Diffstat (limited to 'tests/pickling')
-rw-r--r--tests/pickling/annot.scala12
-rw-r--r--tests/pickling/pickleTypes.scala13
-rw-r--r--tests/pickling/simple.scala6
3 files changed, 31 insertions, 0 deletions
diff --git a/tests/pickling/annot.scala b/tests/pickling/annot.scala
new file mode 100644
index 000000000..d20a6cbf4
--- /dev/null
+++ b/tests/pickling/annot.scala
@@ -0,0 +1,12 @@
+trait Type
+class RefinedType extends Type
+
+
+object TestAnnot {
+ def toText(tp: Type) = tp match {
+ case tp: RefinedType =>
+ val parent :: (refined: List[RefinedType @unchecked]) = ???
+ ???
+ }
+ val xs: List[RefinedType @unchecked] = ???
+}
diff --git a/tests/pickling/pickleTypes.scala b/tests/pickling/pickleTypes.scala
new file mode 100644
index 000000000..ef322816a
--- /dev/null
+++ b/tests/pickling/pickleTypes.scala
@@ -0,0 +1,13 @@
+object pickleTypes {
+
+ abstract class C { type T; val x: T; def f: T; def g(y: T): T; def h[U](z: U, y: T): U }
+
+ val x1: Int = ???
+ val x2: List[List[Int]] = ???
+ val x3: C { type T <: C } = ???
+ val x4: C { type T = Int; val x: Int } = ???
+ val x5: C { type T = String; def f: String; def g(y: String): String } = ???
+ val x6: C { type T = String; def f: String; def g(y: String): String; def h[U](z: U, y: T): U } = ???
+
+
+}
diff --git a/tests/pickling/simple.scala b/tests/pickling/simple.scala
new file mode 100644
index 000000000..243b41117
--- /dev/null
+++ b/tests/pickling/simple.scala
@@ -0,0 +1,6 @@
+object Simple {}
+/*class Simple {
+ val x = 3
+ val y: String = ""
+}*/
+