diff options
author | Paul Phillips <paulp@improving.org> | 2011-07-28 22:26:57 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-07-28 22:26:57 +0000 |
commit | 5bbb198b246f43b80dba8f4466862b2ca8b9a9cb (patch) | |
tree | 0fbe11c29eb9e14f32a5fb6cb5d154a762b29b7a /test/files | |
parent | cee5d977cbc2fff7c919a2d3026b81bd23120d9d (diff) | |
download | scala-5bbb198b246f43b80dba8f4466862b2ca8b9a9cb.tar.gz scala-5bbb198b246f43b80dba8f4466862b2ca8b9a9cb.tar.bz2 scala-5bbb198b246f43b80dba8f4466862b2ca8b9a9cb.zip |
Expression type argument instantiation should n...
Expression type argument instantiation should not fail in a context
expecting Unit if there is any valid instantiation, because value
discarding should kick in and offer a literal (). Closes SI-4853, review
by odersky.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/pos/bug4853.scala | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/files/pos/bug4853.scala b/test/files/pos/bug4853.scala new file mode 100644 index 0000000000..c91f2d6b05 --- /dev/null +++ b/test/files/pos/bug4853.scala @@ -0,0 +1,12 @@ +object Animal { + def main(args: Array[String]) { new Animal[Awake].goToSleep } +} + +class Animal[A <: AwakeOrAsleep] { + def goToSleep[B >: A <: Awake]: Animal[Asleep] = new Animal[Asleep] + def wakeUp[B >: A <: Asleep]: Animal[Awake] = new Animal[Awake] +} + +sealed trait AwakeOrAsleep +trait Awake extends AwakeOrAsleep +trait Asleep extends AwakeOrAsleep |