aboutsummaryrefslogtreecommitdiff
path: root/tests/run/generic/Shapes.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-01-31 14:46:24 +1100
committerMartin Odersky <odersky@gmail.com>2017-02-08 19:35:58 +1100
commitfe09e0d8fe68e0b48d5e864e1de12ae5ee86077d (patch)
tree67279b95ae5e7a2f2ebd2418d3a4b12002f107ae /tests/run/generic/Shapes.scala
parentbc06d17ebfd7c8d6003dffe925c3cf9ebca6b1b9 (diff)
downloaddotty-fe09e0d8fe68e0b48d5e864e1de12ae5ee86077d.tar.gz
dotty-fe09e0d8fe68e0b48d5e864e1de12ae5ee86077d.tar.bz2
dotty-fe09e0d8fe68e0b48d5e864e1de12ae5ee86077d.zip
ADT and Serialization test
The test exercises all the improvements made in previous commits of this branch.
Diffstat (limited to 'tests/run/generic/Shapes.scala')
-rw-r--r--tests/run/generic/Shapes.scala22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/run/generic/Shapes.scala b/tests/run/generic/Shapes.scala
new file mode 100644
index 000000000..8304551e3
--- /dev/null
+++ b/tests/run/generic/Shapes.scala
@@ -0,0 +1,22 @@
+package generic
+
+object Shapes {
+
+ trait Sum[+S1, +S2]
+ case class Fst[+F](x: F) extends Sum[F, Nothing]
+ case class Snd[+S](x: S) extends Sum[Nothing, S]
+
+ case class Prod[+P1, +P2](fst: P1, snd: P2)
+
+ case class Singleton[SI](value: SI)
+
+ case class EnumValue[E](tag: Int)
+
+ trait shaped[SH1, SH2] extends unfolds[SH1, SH2]
+
+ trait unfolds[UN1, UN2] {
+ def toShape(x: UN1): UN2
+ def fromShape(x: UN2): UN1
+ }
+}
+