From 4c04213b991596aa73dec3aa34cb8816a277f538 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Sat, 5 May 2012 01:23:45 -0700 Subject: Test cases. Closes SI-4482, SI-4651, SI-3702. Pending tests for SI-1832, SI-3439, SI-5091, SI-5231, SI-5265. --- test/files/run/t3702.check | 2 ++ test/files/run/t3702.scala | 11 +++++++++++ test/files/run/t4482.check | 1 + test/files/run/t4482.scala | 15 +++++++++++++++ 4 files changed, 29 insertions(+) create mode 100644 test/files/run/t3702.check create mode 100644 test/files/run/t3702.scala create mode 100644 test/files/run/t4482.check create mode 100644 test/files/run/t4482.scala (limited to 'test/files/run') diff --git a/test/files/run/t3702.check b/test/files/run/t3702.check new file mode 100644 index 0000000000..31c2ac4ed1 --- /dev/null +++ b/test/files/run/t3702.check @@ -0,0 +1,2 @@ +() +6 diff --git a/test/files/run/t3702.scala b/test/files/run/t3702.scala new file mode 100644 index 0000000000..021abcb625 --- /dev/null +++ b/test/files/run/t3702.scala @@ -0,0 +1,11 @@ +object Test { + def foo(h: Any, t: List[Any]) = h match { + case 5 :: _ => () + case List(from) => from + } + + def main(args: Array[String]): Unit = { + println(foo(5 :: Nil, List(1,2,3))) + println(foo(6 :: Nil, List(1,2,3))) + } +} diff --git a/test/files/run/t4482.check b/test/files/run/t4482.check new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/files/run/t4482.check @@ -0,0 +1 @@ +2 diff --git a/test/files/run/t4482.scala b/test/files/run/t4482.scala new file mode 100644 index 0000000000..392861c22e --- /dev/null +++ b/test/files/run/t4482.scala @@ -0,0 +1,15 @@ +trait Foo { def i: Int } +trait Bar + +case class Spam(i: Int) extends Foo with Bar + +object Test { + def matchParent(p:Any) = p match { + case f:Foo if f.i == 1 => 1 + case _:Bar => 2 + case _:Foo => 3 + } + def main(args: Array[String]): Unit = { + println(matchParent(Spam(3))) + } +} -- cgit v1.2.3 From 5dac15ad80daf542ad24f7206262eb521f5597e6 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Thu, 10 May 2012 17:13:10 -0700 Subject: Checkfile update. Wonder if we should have a special area for high-turnover checkfiles. --- test/files/run/inline-ex-handlers.check | 88 ++++++++++++++++----------------- 1 file changed, 44 insertions(+), 44 deletions(-) (limited to 'test/files/run') diff --git a/test/files/run/inline-ex-handlers.check b/test/files/run/inline-ex-handlers.check index dbd778d8b1..a5d7e93334 100644 --- a/test/files/run/inline-ex-handlers.check +++ b/test/files/run/inline-ex-handlers.check @@ -17,11 +17,11 @@ 204a199,200 > 92 STORE_LOCAL(variable boxed1) > 92 LOAD_LOCAL(variable boxed1) -405c401 +395c391 < blocks: [1,2,3,4,5,8,11,13,14,16] --- > blocks: [1,2,3,5,8,11,13,14,16,17] -429c425,434 +419c415,424 < 103 THROW(MyException) --- > ? STORE_LOCAL(value ex5) @@ -34,15 +34,15 @@ > 106 LOAD_LOCAL(value x3) > 106 IS_INSTANCE REF(class MyException) > 106 CZJUMP (BOOL)NE ? 5 : 11 -442,444d446 +432,434d436 < 101 JUMP 4 < < 4: -532c534 +522c524 < blocks: [1,2,3,4,6,7,8,9,10] --- > blocks: [1,2,3,4,6,7,8,9,10,11,12,13] -561c563,568 +551c553,558 < 306 THROW(MyException) --- > ? JUMP 11 @@ -51,7 +51,7 @@ > ? LOAD_LOCAL(variable monitor4) > 305 MONITOR_EXIT > ? JUMP 12 -567c574,580 +557c564,570 < ? THROW(Throwable) --- > ? JUMP 12 @@ -61,7 +61,7 @@ > 304 MONITOR_EXIT > ? STORE_LOCAL(value t) > ? JUMP 13 -573c586,599 +563c576,589 < ? THROW(Throwable) --- > ? STORE_LOCAL(value t) @@ -78,30 +78,30 @@ > 310 CALL_PRIMITIVE(EndConcat) > 310 CALL_METHOD scala.Predef.println (dynamic) > 310 JUMP 2 -597c623 +587c613 < catch (Throwable) in ArrayBuffer(7, 8, 9, 10) starting at: 6 --- > catch (Throwable) in ArrayBuffer(7, 8, 9, 10, 11) starting at: 6 -600c626 +590c616 < catch (Throwable) in ArrayBuffer(4, 6, 7, 8, 9, 10) starting at: 3 --- > catch (Throwable) in ArrayBuffer(4, 6, 7, 8, 9, 10, 11, 12) starting at: 3 -632c658 +622c648 < blocks: [1,2,3,4,5,6,7,9,10] --- > blocks: [1,2,3,4,5,6,7,9,10,11,12] -656c682,683 +646c672,673 < 78 THROW(IllegalArgumentException) --- > ? STORE_LOCAL(value e) > ? JUMP 11 -657a685,689 +647a675,679 > 11: > 81 LOAD_LOCAL(value e) > ? STORE_LOCAL(variable exc1) > ? JUMP 12 > -685c717,731 +675c707,721 < 81 THROW(Exception) --- > ? STORE_LOCAL(variable exc1) @@ -119,15 +119,15 @@ > 84 STORE_LOCAL(variable result) > 84 LOAD_LOCAL(variable exc1) > 84 THROW(Throwable) -707c753 +697c743 < catch () in ArrayBuffer(4, 6, 7, 9) starting at: 3 --- > catch () in ArrayBuffer(4, 6, 7, 9, 11) starting at: 3 -733c779 +723c769 < blocks: [1,2,3,4,5,6,9,12,14,17,18,19,22,25,27,28,30,31] --- > blocks: [1,2,3,4,5,6,9,12,14,17,18,19,22,25,27,28,30,31,32,33,34] -757c803,810 +747c793,800 < 172 THROW(MyException) --- > ? STORE_LOCAL(value ex5) @@ -138,12 +138,12 @@ > 170 STORE_LOCAL(value x3) > 170 SCOPE_ENTER value x3 > 170 JUMP 18 -813c866,867 +803c856,857 < 177 THROW(MyException) --- > ? STORE_LOCAL(value ex5) > ? JUMP 33 -817c871,878 +807c861,868 < 170 THROW(Throwable) --- > ? STORE_LOCAL(value ex5) @@ -154,17 +154,17 @@ > 169 STORE_LOCAL(value x3) > 169 SCOPE_ENTER value x3 > 169 JUMP 5 -850c911,912 +840c901,902 < 182 THROW(MyException) --- > ? STORE_LOCAL(variable exc2) > ? JUMP 34 -854c916,917 +844c906,907 < 169 THROW(Throwable) --- > ? STORE_LOCAL(variable exc2) > ? JUMP 34 -855a919,931 +845a909,921 > 34: > 184 LOAD_MODULE object Predef > 184 CONSTANT("finally") @@ -178,19 +178,19 @@ > 185 LOAD_LOCAL(variable exc2) > 185 THROW(Throwable) > -876c952 +866c942 < catch (Throwable) in ArrayBuffer(17, 18, 19, 22, 25, 27, 28, 30) starting at: 4 --- > catch (Throwable) in ArrayBuffer(17, 18, 19, 22, 25, 27, 28, 30, 32) starting at: 4 -879c955 +869c945 < catch () in ArrayBuffer(4, 5, 6, 9, 12, 17, 18, 19, 22, 25, 27, 28, 30) starting at: 3 --- > catch () in ArrayBuffer(4, 5, 6, 9, 12, 17, 18, 19, 22, 25, 27, 28, 30, 32, 33) starting at: 3 -905c981 +895c971 < blocks: [1,2,3,6,7,8,11,14,16,17,19] --- > blocks: [1,2,3,6,7,8,11,14,16,17,19,20] -929c1005,1012 +919c995,1002 < 124 THROW(MyException) --- > ? STORE_LOCAL(value ex5) @@ -201,15 +201,15 @@ > 122 STORE_LOCAL(value x3) > 122 SCOPE_ENTER value x3 > 122 JUMP 7 -989c1072 +979c1062 < catch (IllegalArgumentException) in ArrayBuffer(6, 7, 8, 11, 14, 16, 17, 19) starting at: 3 --- > catch (IllegalArgumentException) in ArrayBuffer(6, 7, 8, 11, 14, 16, 17, 19, 20) starting at: 3 -1015c1098 +1005c1088 < blocks: [1,2,3,4,5,8,11,15,16,17,19] --- > blocks: [1,2,3,5,8,11,15,16,17,19,20] -1039c1122,1131 +1029c1112,1121 < 148 THROW(MyException) --- > ? STORE_LOCAL(value ex5) @@ -222,15 +222,15 @@ > 154 LOAD_LOCAL(value x3) > 154 IS_INSTANCE REF(class MyException) > 154 CZJUMP (BOOL)NE ? 5 : 11 -1060,1062d1151 +1050,1052d1141 < 145 JUMP 4 < < 4: -1295c1384 +1285c1374 < blocks: [1,2,3,4,5,7] --- > blocks: [1,2,3,4,5,7,8] -1319c1408,1415 +1309c1398,1405 < 38 THROW(IllegalArgumentException) --- > ? STORE_LOCAL(value e) @@ -241,16 +241,16 @@ > 42 CONSTANT("IllegalArgumentException") > 42 CALL_METHOD scala.Predef.println (dynamic) > 42 JUMP 2 -1368c1464 +1358c1454 < blocks: [1,2,3,4,5,8,11,13,14,16,17,19] --- > blocks: [1,2,3,5,8,11,13,14,16,17,19,20] -1392c1488,1489 +1382c1478,1479 < 203 THROW(MyException) --- > ? STORE_LOCAL(value ex5) > ? JUMP 20 -1412c1509,1518 +1402c1499,1508 < 209 THROW(MyException) --- > ? STORE_LOCAL(value ex5) @@ -263,15 +263,15 @@ > 212 LOAD_LOCAL(value x3) > 212 IS_INSTANCE REF(class MyException) > 212 CZJUMP (BOOL)NE ? 5 : 11 -1425,1427d1530 +1415,1417d1520 < 200 JUMP 4 < < 4: -1487c1590 +1477c1580 < blocks: [1,2,3,4,5,7] --- > blocks: [1,2,3,4,5,7,8] -1511c1614,1621 +1501c1604,1611 < 58 THROW(IllegalArgumentException) --- > ? STORE_LOCAL(value e) @@ -282,11 +282,11 @@ > 62 CONSTANT("RuntimeException") > 62 CALL_METHOD scala.Predef.println (dynamic) > 62 JUMP 2 -1560c1670 +1550c1660 < blocks: [1,2,3,4] --- > blocks: [1,2,3,4,5] -1580c1690,1695 +1570c1680,1685 < 229 THROW(MyException) --- > ? JUMP 5 @@ -295,19 +295,19 @@ > ? LOAD_LOCAL(variable monitor1) > 228 MONITOR_EXIT > 228 THROW(Throwable) -1586c1701 +1576c1691 < ? THROW(Throwable) --- > 228 THROW(Throwable) -1614c1729 +1604c1719 < locals: value args, variable result, variable monitor2, variable monitorResult1 --- > locals: value exception$1, value args, variable result, variable monitor2, variable monitorResult1 -1616c1731 +1606c1721 < blocks: [1,2,3,4] --- > blocks: [1,2,3,4,5] -1639c1754,1762 +1629c1744,1752 < 245 THROW(MyException) --- > ? STORE_LOCAL(value exception$1) @@ -319,7 +319,7 @@ > ? LOAD_LOCAL(variable monitor2) > 244 MONITOR_EXIT > 244 THROW(Throwable) -1645c1768 +1635c1758 < ? THROW(Throwable) --- > 244 THROW(Throwable) -- cgit v1.2.3 From ef32a8b9334307d15d9fa68d3da3f6f80b200788 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Thu, 10 May 2012 23:19:55 -0700 Subject: Removing redunant/passing tests from pending. --- test/files/pos/t1987.scala | 8 -------- test/files/pos/t1987a.scala | 8 ++++++++ test/files/run/backreferences.check | 2 ++ test/files/run/backreferences.scala | 13 +++++++++++++ test/pending/neg/t796.scala | 20 -------------------- test/pending/pos/unapplyGeneric.scala | 11 ----------- test/pending/run/t3702.scala | 10 ---------- test/pending/run/t5629.scala | 25 ------------------------- 8 files changed, 23 insertions(+), 74 deletions(-) delete mode 100644 test/files/pos/t1987.scala create mode 100644 test/files/pos/t1987a.scala create mode 100644 test/files/run/backreferences.check create mode 100644 test/files/run/backreferences.scala delete mode 100644 test/pending/neg/t796.scala delete mode 100644 test/pending/pos/unapplyGeneric.scala delete mode 100644 test/pending/run/t3702.scala delete mode 100644 test/pending/run/t5629.scala (limited to 'test/files/run') diff --git a/test/files/pos/t1987.scala b/test/files/pos/t1987.scala deleted file mode 100644 index ccab133716..0000000000 --- a/test/files/pos/t1987.scala +++ /dev/null @@ -1,8 +0,0 @@ -package object overloading { - def bar(f: (Int) => Unit): Unit = () - def bar(f: (Int, Int) => Unit): Unit = () -} - -class PackageObjectOverloadingTest { - overloading.bar( (i: Int) => () ) // doesn't compile. -} diff --git a/test/files/pos/t1987a.scala b/test/files/pos/t1987a.scala new file mode 100644 index 0000000000..ccab133716 --- /dev/null +++ b/test/files/pos/t1987a.scala @@ -0,0 +1,8 @@ +package object overloading { + def bar(f: (Int) => Unit): Unit = () + def bar(f: (Int, Int) => Unit): Unit = () +} + +class PackageObjectOverloadingTest { + overloading.bar( (i: Int) => () ) // doesn't compile. +} diff --git a/test/files/run/backreferences.check b/test/files/run/backreferences.check new file mode 100644 index 0000000000..1d474d5255 --- /dev/null +++ b/test/files/run/backreferences.check @@ -0,0 +1,2 @@ +false +true diff --git a/test/files/run/backreferences.scala b/test/files/run/backreferences.scala new file mode 100644 index 0000000000..335cd6c7de --- /dev/null +++ b/test/files/run/backreferences.scala @@ -0,0 +1,13 @@ +case class Elem[T](x: T, y: T) + +object Test { + def unrolled[T](x: Any, y: Any, z: Any) = (x, y, z) match { + case (el: Elem[_], el.x, el.y) => true + case _ => false + } + + def main(args: Array[String]): Unit = { + println(unrolled(Elem("bippy", 5), "bippy", 6)) + println(unrolled(Elem("bippy", 5), "bippy", 5)) + } +} diff --git a/test/pending/neg/t796.scala b/test/pending/neg/t796.scala deleted file mode 100644 index c013f49686..0000000000 --- a/test/pending/neg/t796.scala +++ /dev/null @@ -1,20 +0,0 @@ -case class CaseClass( value: Int ); - -object PatternMatchBug { - def matcher( a: AnyRef, b: Any ) { - (a, b) match { - case ( instance: CaseClass, instance.value ) => - System.out.println( "Match succeeded!" ); - case _ => - System.out.println( "Match failed!" ); - } - } - - def main( args : Array[String] ) { - val caseClassInstance = CaseClass( 42 ) - - matcher( caseClassInstance, 13 ) - matcher( caseClassInstance, 42 ) - } -} - diff --git a/test/pending/pos/unapplyGeneric.scala b/test/pending/pos/unapplyGeneric.scala deleted file mode 100644 index bf88816885..0000000000 --- a/test/pending/pos/unapplyGeneric.scala +++ /dev/null @@ -1,11 +0,0 @@ -object Bar { - def unapply[A,B](bar:Bar[A,B]) = Some(bar) -} - -class Bar[A,B](val _1:A, val _2:B) extends Product2[A,B] - -object Test { - new Bar(2, 'a') match { - case Bar(x,y) => - } -} diff --git a/test/pending/run/t3702.scala b/test/pending/run/t3702.scala deleted file mode 100644 index e08fc12e76..0000000000 --- a/test/pending/run/t3702.scala +++ /dev/null @@ -1,10 +0,0 @@ -object Test { - def main(args: Array[String]) { - foo(Nil, Nil) - } - - def foo(h: Any, t: List[Any]) = h match { - case 5 :: _ => () - case List(from) => List(from, from, from) - } -} diff --git a/test/pending/run/t5629.scala b/test/pending/run/t5629.scala deleted file mode 100644 index 28e74a1c94..0000000000 --- a/test/pending/run/t5629.scala +++ /dev/null @@ -1,25 +0,0 @@ -import scala.{specialized => spec} - -trait GrandParent[@spec(Int) -A] { - def foo(a:A): Unit - def bar[B <: A](b:B): Unit = println("grandparent got: %s" format b) -} - -trait Parent[@spec(Int) -A] extends GrandParent[A] { - def foo(a:A) = bar(a) -} - -class IntChild extends Parent[Int] { - override def bar[B <: Int](b:B): Unit = println("int child got: %s" format b) -} - -class AnyChild extends Parent[Any] { - override def bar[B <: Any](b:B): Unit = println("any child got: %s" format b) -} - -object Test { - def main(args:Array[String]) { - new IntChild().foo(33) - new AnyChild().foo(33) - } -} -- cgit v1.2.3 From 3a7a92bd9263a932c5a3f64307641b374923580a Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Sat, 12 May 2012 07:15:40 +0200 Subject: Test case closes SI-4124. This looks like a job for... virtpatmat! --- test/files/run/t4124.check | 4 ++++ test/files/run/t4124.scala | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 test/files/run/t4124.check create mode 100644 test/files/run/t4124.scala (limited to 'test/files/run') diff --git a/test/files/run/t4124.check b/test/files/run/t4124.check new file mode 100644 index 0000000000..66a0092d93 --- /dev/null +++ b/test/files/run/t4124.check @@ -0,0 +1,4 @@ +hi +hi +bye +bye diff --git a/test/files/run/t4124.scala b/test/files/run/t4124.scala new file mode 100644 index 0000000000..9f35b57ce3 --- /dev/null +++ b/test/files/run/t4124.scala @@ -0,0 +1,24 @@ +import xml.Node + +object Test extends App { + val body: Node = hi + println ((body: AnyRef, "foo") match { + case (node: Node, "bar") => "bye" + case (ser: Serializable, "foo") => "hi" + }) + + println ((body, "foo") match { + case (node: Node, "bar") => "bye" + case (ser: Serializable, "foo") => "hi" + }) + + println ((body: AnyRef, "foo") match { + case (node: Node, "foo") => "bye" + case (ser: Serializable, "foo") => "hi" + }) + + println ((body: AnyRef, "foo") match { + case (node: Node, "foo") => "bye" + case (ser: Serializable, "foo") => "hi" + }) +} -- cgit v1.2.3