summaryrefslogtreecommitdiff
path: root/test/files/pos/t6925.scala
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2013-01-06 01:43:20 -0800
committerAdriaan Moors <adriaan.moors@typesafe.com>2013-01-09 22:31:57 -0800
commitb1cea212f36b27636ef6aab76bf8992210a4426e (patch)
treef90697b53558394c3a1db7e30637e5236f89530d /test/files/pos/t6925.scala
parentf219ade08ed8174c7bded654e8070f4b61843513 (diff)
downloadscala-b1cea212f36b27636ef6aab76bf8992210a4426e.tar.gz
scala-b1cea212f36b27636ef6aab76bf8992210a4426e.tar.bz2
scala-b1cea212f36b27636ef6aab76bf8992210a4426e.zip
SI-6925 use concrete type in applyOrElse's match's selector
Fix a regression introduced in 28483739c3: PartialFunction synthesis was broken so that we'd get: ``` scala> def f[T](xs: Set[T]) = xs collect { case x => x } f: [T](xs: Set[T])scala.collection.immutable.Set[_ <: T] ``` rather than ``` scala> def f[T](xs: Set[T]) = xs collect { case x => x } f: [T](xs: Set[T])scala.collection.immutable.Set[T] ```
Diffstat (limited to 'test/files/pos/t6925.scala')
-rw-r--r--test/files/pos/t6925.scala9
1 files changed, 9 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