diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-01-14 15:30:30 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-01-14 15:30:30 -0800 |
commit | 9739002305057e755957eb59d7e259e519b91537 (patch) | |
tree | 4d9ca11cf7049728561552b5c0d2ef5a093194d3 /test | |
parent | 1a305a5aa8aae2a6d196918664c0c4a9cf808687 (diff) | |
parent | 51f574ac9ff0dbcb665f48a8c1a380c59f2bb641 (diff) | |
download | scala-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')
-rw-r--r-- | test/files/pos/t6925.scala | 9 | ||||
-rw-r--r-- | test/files/pos/t6925b.scala | 18 |
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 |