From fe09e0d8fe68e0b48d5e864e1de12ae5ee86077d Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 31 Jan 2017 14:46:24 +1100 Subject: ADT and Serialization test The test exercises all the improvements made in previous commits of this branch. --- tests/run/generic/Shapes.scala | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/run/generic/Shapes.scala (limited to 'tests/run/generic/Shapes.scala') 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 + } +} + -- cgit v1.2.3