From 5bbb198b246f43b80dba8f4466862b2ca8b9a9cb Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Thu, 28 Jul 2011 22:26:57 +0000 Subject: 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. --- test/files/pos/bug4853.scala | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 test/files/pos/bug4853.scala (limited to 'test/files') 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 -- cgit v1.2.3