summaryrefslogtreecommitdiff
path: root/test/files/run/patmatnew.scala
diff options
context:
space:
mode:
authorBurak Emir <emir@epfl.ch>2007-08-14 16:24:20 +0000
committerBurak Emir <emir@epfl.ch>2007-08-14 16:24:20 +0000
commit2465b7e2aaddefb2204e3dec32ca6c0f3cbe681b (patch)
treeaf942c2ddfbf404bd0f5b2ca6548575b0e8e0898 /test/files/run/patmatnew.scala
parent4357e79096dd3ab9ecc1e78eeba8a20128c6d3d8 (diff)
downloadscala-2465b7e2aaddefb2204e3dec32ca6c0f3cbe681b.tar.gz
scala-2465b7e2aaddefb2204e3dec32ca6c0f3cbe681b.tar.bz2
scala-2465b7e2aaddefb2204e3dec32ca6c0f3cbe681b.zip
implemented #1196 by typer change and added tes...
implemented #1196 by typer change and added test cases
Diffstat (limited to 'test/files/run/patmatnew.scala')
-rw-r--r--test/files/run/patmatnew.scala44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/files/run/patmatnew.scala b/test/files/run/patmatnew.scala
index a54bac814f..1d4bf37e1a 100644
--- a/test/files/run/patmatnew.scala
+++ b/test/files/run/patmatnew.scala
@@ -289,5 +289,49 @@ object Test extends TestConsoleMain {
case FooBar => true
}
+ object Bug1270 { // unapply13
+
+ class Sync {
+ def apply(x: Int): Int = 42
+ def unapply(scrut: Any): Option[Int] = None
+ }
+
+ class Buffer {
+ object Get extends Sync
+
+ var ps: PartialFunction[Any, Any] = {
+ case Get(y) if y > 4 => // y gets a wildcard type for some reason?! hack
+ }
+ }
+
+ println((new Buffer).ps.isDefinedAt(42))
+ }
+
+ object Bug1261 {
+ sealed trait Elem
+ case class Foo extends Elem
+ case class Bar extends Elem
+ trait Row extends Elem
+ object Row {
+ def unapply(r: Row) = true
+
+ def f(elem: Elem) {
+ elem match {
+ case Bar() => ;
+ case Row() => ;
+ case Foo() => ; // used to give ERROR (unreachable code)
+ }}}
+ }
+
+ object Feature1196 {
+ def f(l: List[Int]) { }
+
+ val l: Seq[Int] = List(1, 2, 3)
+
+ l match {
+ case x @ List(1, _) => f(x) // x needs to get better type List[int] here
+ }
+ }
+
}