summaryrefslogtreecommitdiff
path: root/test/files/pos/bug4853.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-07-28 22:26:57 +0000
committerPaul Phillips <paulp@improving.org>2011-07-28 22:26:57 +0000
commit5bbb198b246f43b80dba8f4466862b2ca8b9a9cb (patch)
tree0fbe11c29eb9e14f32a5fb6cb5d154a762b29b7a /test/files/pos/bug4853.scala
parentcee5d977cbc2fff7c919a2d3026b81bd23120d9d (diff)
downloadscala-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/pos/bug4853.scala')
-rw-r--r--test/files/pos/bug4853.scala12
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