aboutsummaryrefslogtreecommitdiff
path: root/tests/pos/pickleOK/zoo.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-03-04 13:52:44 +0100
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2015-03-18 11:14:14 +0100
commit96fbd7bfe252026f59d1f5e8aa33f2d8fae65769 (patch)
treec4a53211dbf23913eb8174f74e248c16f1c26bab /tests/pos/pickleOK/zoo.scala
parente926f3167f8d9a1407f131abcb33a02b07477597 (diff)
downloaddotty-96fbd7bfe252026f59d1f5e8aa33f2d8fae65769.tar.gz
dotty-96fbd7bfe252026f59d1f5e8aa33f2d8fae65769.tar.bz2
dotty-96fbd7bfe252026f59d1f5e8aa33f2d8fae65769.zip
Allow several units to be pickle-tested at once.
Also: Make Pickler a plain phase; it is neither a macro transformer nor a miniphase. Add tests to pickleOK that are known to be stable under pickling/unpicking by comparing tree representations via show.
Diffstat (limited to 'tests/pos/pickleOK/zoo.scala')
-rw-r--r--tests/pos/pickleOK/zoo.scala41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/pos/pickleOK/zoo.scala b/tests/pos/pickleOK/zoo.scala
new file mode 100644
index 000000000..02dac8f5b
--- /dev/null
+++ b/tests/pos/pickleOK/zoo.scala
@@ -0,0 +1,41 @@
+object Test {
+trait FoodStuff
+trait Meat extends FoodStuff {
+ type IsMeat = Any
+}
+trait Grass extends FoodStuff {
+ type IsGrass = Any
+}
+trait Animal {
+ type Food <: FoodStuff
+ def eats(food: Food): Unit
+ def gets: Food
+}
+trait Cow extends Animal {
+ type IsMeat = Any
+ type Food <: Grass
+ def eats(food: Grass): Unit
+ def gets: Food
+}
+trait Lion extends Animal {
+ type Food = Meat
+ def eats(food: Meat): Unit
+ def gets: Meat
+}
+def newMeat: Meat = new Meat {
+}
+def newGrass: Grass = new Grass {
+}
+def newCow: Cow = new Cow {
+ type Food = Grass
+ def eats(food: Grass) = ()
+ def gets = newGrass
+}
+def newLion: Lion = new Lion {
+ def eats(food: Meat) = ()
+ def gets = newMeat
+}
+val milka = newCow
+val leo = newLion
+//leo.eats(milka) // structural select not supported
+}