aboutsummaryrefslogtreecommitdiff
path: root/tests/pos/zoo.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-07-20 17:54:16 +0200
committerMartin Odersky <odersky@gmail.com>2014-07-20 17:54:16 +0200
commit65658a4d0c3250d0d27f7af51632b2356f829464 (patch)
treee16ca98ffb7f72fa5a8fb834d978200d413f2e28 /tests/pos/zoo.scala
parent9e1759f34dcfa90f688ef560c90f209dcb9b1374 (diff)
downloaddotty-65658a4d0c3250d0d27f7af51632b2356f829464.tar.gz
dotty-65658a4d0c3250d0d27f7af51632b2356f829464.tar.bz2
dotty-65658a4d0c3250d0d27f7af51632b2356f829464.zip
fix/148
Fixed typo in Splitter. Closes #148.
Diffstat (limited to 'tests/pos/zoo.scala')
-rw-r--r--tests/pos/zoo.scala44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/pos/zoo.scala b/tests/pos/zoo.scala
new file mode 100644
index 000000000..08f7eba63
--- /dev/null
+++ b/tests/pos/zoo.scala
@@ -0,0 +1,44 @@
+object Test {
+type Meat = {
+ type IsMeat = Any
+}
+type Grass = {
+ type IsGrass = Any
+}
+type Animal = {
+ type Food
+ def eats(food: Food): Unit
+ def gets: Food
+}
+type Cow = {
+ type IsMeat = Any
+ type Food <: Grass
+ def eats(food: Grass): Unit
+ def gets: Grass
+}
+type Lion = {
+ type Food = Meat
+ def eats(food: Meat): Unit
+ def gets: Meat
+}
+def newMeat: Meat = new {
+ type IsMeat = Any
+}
+def newGrass: Grass = new {
+ type IsGrass = Any
+}
+def newCow: Cow = new {
+ type IsMeat = Any
+ type Food = Grass
+ def eats(food: Grass) = ()
+ def gets = newGrass
+}
+def newLion: Lion = new {
+ type Food = Meat
+ def eats(food: Meat) = ()
+ def gets = newMeat
+}
+val milka = newCow
+val leo = newLion
+//leo.eats(milka) // structural select not supported
+}