summaryrefslogtreecommitdiff
path: root/test/files/pos/t5589.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-03-20 20:15:45 -0700
committerPaul Phillips <paulp@improving.org>2012-03-20 20:15:45 -0700
commitfcc63e2b667bdbaddbaacc843de97f8db02f6426 (patch)
tree9ee7bd6e4cb9e487a0d5c5b9c812a68c4c0ed025 /test/files/pos/t5589.scala
parent1c65152c7aaeb3aeaf8a5e39e6fd51e5b4b95836 (diff)
downloadscala-fcc63e2b667bdbaddbaacc843de97f8db02f6426.tar.gz
scala-fcc63e2b667bdbaddbaacc843de97f8db02f6426.tar.bz2
scala-fcc63e2b667bdbaddbaacc843de97f8db02f6426.zip
Restore irrefutability commits.
This reverts commit d8ba5d091e5641553b438ef9930a6023a2709dcd.
Diffstat (limited to 'test/files/pos/t5589.scala')
-rw-r--r--test/files/pos/t5589.scala22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/files/pos/t5589.scala b/test/files/pos/t5589.scala
new file mode 100644
index 0000000000..69cbb20391
--- /dev/null
+++ b/test/files/pos/t5589.scala
@@ -0,0 +1,22 @@
+class A {
+ // First three compile.
+ def f1(x: Either[Int, String]) = x.right map (y => y)
+ def f2(x: Either[Int, String]) = for (y <- x.right) yield y
+ def f3(x: Either[Int, (String, Int)]) = x.right map { case (y1, y2) => (y1, y2) }
+ // Last one fails.
+ def f4(x: Either[Int, (String, Int)]) = for ((y1, y2) <- x.right) yield ((y1, y2))
+/**
+./a.scala:5: error: constructor cannot be instantiated to expected type;
+ found : (T1, T2)
+ required: Either[Nothing,(String, Int)]
+ def f4(x: Either[Int, (String, Int)]) = for ((y1, y2) <- x.right) yield ((y1, y2))
+ ^
+./a.scala:5: error: not found: value y1
+ def f4(x: Either[Int, (String, Int)]) = for ((y1, y2) <- x.right) yield ((y1, y2))
+ ^
+./a.scala:5: error: not found: value y2
+ def f4(x: Either[Int, (String, Int)]) = for ((y1, y2) <- x.right) yield ((y1, y2))
+ ^
+three errors found
+**/
+}