summaryrefslogtreecommitdiff
path: root/test/files/pos
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2013-01-14 15:30:30 -0800
committerAdriaan Moors <adriaan.moors@typesafe.com>2013-01-14 15:30:30 -0800
commit9739002305057e755957eb59d7e259e519b91537 (patch)
tree4d9ca11cf7049728561552b5c0d2ef5a093194d3 /test/files/pos
parent1a305a5aa8aae2a6d196918664c0c4a9cf808687 (diff)
parent51f574ac9ff0dbcb665f48a8c1a380c59f2bb641 (diff)
downloadscala-9739002305057e755957eb59d7e259e519b91537.tar.gz
scala-9739002305057e755957eb59d7e259e519b91537.tar.bz2
scala-9739002305057e755957eb59d7e259e519b91537.zip
Merge pull request #1878 from adriaanm/ticket-6925
SI-6925 use concrete type in applyOrElse's match's selecto
Diffstat (limited to 'test/files/pos')
-rw-r--r--test/files/pos/t6925.scala9
-rw-r--r--test/files/pos/t6925b.scala18
2 files changed, 27 insertions, 0 deletions
diff --git a/test/files/pos/t6925.scala b/test/files/pos/t6925.scala
new file mode 100644
index 0000000000..862a6e9d0e
--- /dev/null
+++ b/test/files/pos/t6925.scala
@@ -0,0 +1,9 @@
+class Test {
+ def f[T](xs: Set[T]) /* no expected type to trigger inference */ =
+ xs collect { case x => x }
+
+ def g[T](xs: Set[T]): Set[T] = f[T](xs) // check that f's inferred type is Set[T]
+
+ // check that this type checks:
+ List(1).flatMap(n => Set(1).collect { case w => w })
+} \ No newline at end of file
diff --git a/test/files/pos/t6925b.scala b/test/files/pos/t6925b.scala
new file mode 100644
index 0000000000..ca25146dfc
--- /dev/null
+++ b/test/files/pos/t6925b.scala
@@ -0,0 +1,18 @@
+// code *generated* by test/scaladoc/run/SI-5933.scala
+// duplicated here because it's related to SI-6925
+
+import language.higherKinds
+
+abstract class Base[M[_, _]] {
+ def foo[A, B]: M[(A, B), Any]
+}
+
+class Derived extends Base[PartialFunction] {
+ def foo[AA, BB] /*: PartialFunction[(A, B) => Any]*/ = { case (a, b) => (a: AA, b: BB) }
+}
+
+object Test {
+ lazy val lx = { println("hello"); 3 }
+ def test1(x: Int = lx) = ???
+ def test2(x: Int = lx match { case 0 => 1; case 3 => 4 }) = ???
+} \ No newline at end of file