From 5240da5073168424db50b969c1bbf7089d0a4242 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Thu, 4 Oct 2012 20:28:56 -0700 Subject: Moved a bunch of passing tests out of pending. If the test names can be believed, this covers SI-294 SI-1751 SI-1782 SI-2318 SI-3897 SI-4649 SI-4786 SI-5293 SI-5399 SI-5418 SI-5606 SI-5610 SI-5639 Most of these were moved to pending in 1729b26500 due to failures of unknown cause. It was suggested they be brought back "as soon as possible" and that was three months ago; I suppose it's now possible. If they need to be disabled again, please move them to test/disabled, not to test/pending. "disabled" should mean a formerly passing test in limbo; "pending" tests document bugs which await fixing. I also removed some dead files in test/ - the files with a "cmds" extension are from a failed experiment and do not do anything. --- test/files/pos/exhaust_2.scala | 54 +++++++++++++++++++++++++++++++++ test/files/pos/no-widen-locals.scala | 19 ++++++++++++ test/files/pos/super.cmds | 2 -- test/files/pos/t1029.cmds | 2 -- test/files/pos/t1751/A1_2.scala | 2 ++ test/files/pos/t1751/A2_1.scala | 2 ++ test/files/pos/t1751/SuiteClasses.java | 3 ++ test/files/pos/t1782/Ann.java | 3 ++ test/files/pos/t1782/Days.java | 3 ++ test/files/pos/t1782/ImplementedBy.java | 3 ++ test/files/pos/t1782/Test_1.scala | 16 ++++++++++ test/files/pos/t1942.cmds | 2 -- test/files/pos/t2464.cmds | 3 -- test/files/pos/t2726.cmds | 2 -- test/files/pos/t294/Ann.java | 3 ++ test/files/pos/t294/Ann2.java | 3 ++ test/files/pos/t294/Test_1.scala | 7 +++++ test/files/pos/t294/Test_2.scala | 1 + test/files/pos/t4649.flags | 1 + test/files/pos/t4649.scala | 6 ++++ test/files/pos/t4786.scala | 24 +++++++++++++++ test/files/pos/t5399a.scala | 19 ++++++++++++ test/files/pos/t5606.scala | 9 ++++++ test/files/pos/t5639/Bar.scala | 7 +++++ test/files/pos/t5639/Foo.scala | 7 +++++ test/files/pos/t715.cmds | 2 -- 26 files changed, 192 insertions(+), 13 deletions(-) create mode 100644 test/files/pos/exhaust_2.scala create mode 100644 test/files/pos/no-widen-locals.scala delete mode 100644 test/files/pos/super.cmds delete mode 100644 test/files/pos/t1029.cmds create mode 100644 test/files/pos/t1751/A1_2.scala create mode 100644 test/files/pos/t1751/A2_1.scala create mode 100644 test/files/pos/t1751/SuiteClasses.java create mode 100644 test/files/pos/t1782/Ann.java create mode 100644 test/files/pos/t1782/Days.java create mode 100644 test/files/pos/t1782/ImplementedBy.java create mode 100644 test/files/pos/t1782/Test_1.scala delete mode 100644 test/files/pos/t1942.cmds delete mode 100644 test/files/pos/t2464.cmds delete mode 100644 test/files/pos/t2726.cmds create mode 100644 test/files/pos/t294/Ann.java create mode 100644 test/files/pos/t294/Ann2.java create mode 100644 test/files/pos/t294/Test_1.scala create mode 100644 test/files/pos/t294/Test_2.scala create mode 100644 test/files/pos/t4649.flags create mode 100644 test/files/pos/t4649.scala create mode 100644 test/files/pos/t4786.scala create mode 100644 test/files/pos/t5399a.scala create mode 100644 test/files/pos/t5606.scala create mode 100644 test/files/pos/t5639/Bar.scala create mode 100644 test/files/pos/t5639/Foo.scala delete mode 100644 test/files/pos/t715.cmds (limited to 'test/files/pos') diff --git a/test/files/pos/exhaust_2.scala b/test/files/pos/exhaust_2.scala new file mode 100644 index 0000000000..4f4e47c43b --- /dev/null +++ b/test/files/pos/exhaust_2.scala @@ -0,0 +1,54 @@ +object ExhaustivityWarnBugReportMinimal { + //sealed is needed for the warning + sealed trait FoundNode[T]/*presence of parameters is irrelevant*/ + // This also causes a warning: + // sealed abstract class FoundNode[T]/*presence of parameters is irrelevant*/ + case class FoundFilter[T](/*presence of parameters is irrelevant*/) extends FoundNode[T] + case class FoundTypeCase[T](/*presence of parameters is irrelevant*/) extends FoundNode[T] + val f: Some[_] = ??? + f match { + case x: Some[t] => //no warning + } + //With these variants, no warnings: + //val v: (Some[Int], FoundNode[_]) = (???, ???) + //val v: (Some[AnyRef], FoundNode[_]) = (???, ???) + //val v: (Some[String], FoundNode[_]) = (???, ???) + + val v: (Some[_], FoundNode[_]) = (???, ???) + //Warning here: + v match { + case (x: Some[t], _: FoundNode[_]) => + } + v match { + case (x: Some[t], _) => + } + + v match { + case (x: Some[_], _) => + } + case class Foo[T]() + + val vp: (Foo[_], FoundNode[_]) = (???, ???) + vp match { + case (x: Foo[_], _) => + } + + //No warning here: + v match { + case (Some(y), _) => + } + + v match { + case (x, _) => + } + + val v2: (Some[_], Int) = (???, ???) + v2 match { + case (x: Some[t], _) => + } + + val v3: (Option[_], FoundNode[_]) = (???, ???) + v match { + case (x: Option[_], _) => + } +} diff --git a/test/files/pos/no-widen-locals.scala b/test/files/pos/no-widen-locals.scala new file mode 100644 index 0000000000..013e63f0a2 --- /dev/null +++ b/test/files/pos/no-widen-locals.scala @@ -0,0 +1,19 @@ +// Worked from r23262 until that was reverted somewhere +// around r25016. +import annotation.switch + +object Test { + def f(x: Int) = { + val X1 = 5 + val X2 = 10 + val X3 = 15 + val X4 = 20 + + (x: @switch) match { + case X1 => 1 + case X2 => 2 + case X3 => 3 + case X4 => 4 + } + } +} diff --git a/test/files/pos/super.cmds b/test/files/pos/super.cmds deleted file mode 100644 index 8f3f8a4172..0000000000 --- a/test/files/pos/super.cmds +++ /dev/null @@ -1,2 +0,0 @@ -javac Super_1.java -scalac Super_2.scala diff --git a/test/files/pos/t1029.cmds b/test/files/pos/t1029.cmds deleted file mode 100644 index 06b863dc03..0000000000 --- a/test/files/pos/t1029.cmds +++ /dev/null @@ -1,2 +0,0 @@ -scalac Test_1.scala -scalac Test_2.scala diff --git a/test/files/pos/t1751/A1_2.scala b/test/files/pos/t1751/A1_2.scala new file mode 100644 index 0000000000..354d5eecd0 --- /dev/null +++ b/test/files/pos/t1751/A1_2.scala @@ -0,0 +1,2 @@ +@SuiteClasses(Array(classOf[A2])) +class A1 diff --git a/test/files/pos/t1751/A2_1.scala b/test/files/pos/t1751/A2_1.scala new file mode 100644 index 0000000000..c768062e43 --- /dev/null +++ b/test/files/pos/t1751/A2_1.scala @@ -0,0 +1,2 @@ +@SuiteClasses(Array()) +class A2 diff --git a/test/files/pos/t1751/SuiteClasses.java b/test/files/pos/t1751/SuiteClasses.java new file mode 100644 index 0000000000..a415e4f572 --- /dev/null +++ b/test/files/pos/t1751/SuiteClasses.java @@ -0,0 +1,3 @@ +public @interface SuiteClasses { + public Class[] value(); +} diff --git a/test/files/pos/t1782/Ann.java b/test/files/pos/t1782/Ann.java new file mode 100644 index 0000000000..0dcfbd2ed7 --- /dev/null +++ b/test/files/pos/t1782/Ann.java @@ -0,0 +1,3 @@ +public @interface Ann { + public Days value(); +} diff --git a/test/files/pos/t1782/Days.java b/test/files/pos/t1782/Days.java new file mode 100644 index 0000000000..203a87b1c2 --- /dev/null +++ b/test/files/pos/t1782/Days.java @@ -0,0 +1,3 @@ +public enum Days { + Friday, Sunday +} diff --git a/test/files/pos/t1782/ImplementedBy.java b/test/files/pos/t1782/ImplementedBy.java new file mode 100644 index 0000000000..6aa8b4fa9e --- /dev/null +++ b/test/files/pos/t1782/ImplementedBy.java @@ -0,0 +1,3 @@ +public @interface ImplementedBy { + public Class value(); +} diff --git a/test/files/pos/t1782/Test_1.scala b/test/files/pos/t1782/Test_1.scala new file mode 100644 index 0000000000..6467a74c29 --- /dev/null +++ b/test/files/pos/t1782/Test_1.scala @@ -0,0 +1,16 @@ +@ImplementedBy(classOf[Provider]) +trait Service { + def someMethod() +} + +class Provider + extends Service +{ + // test enumeration java annotations + @Ann(Days.Friday) def someMethod() = () + + // #2103 + @scala.beans.BeanProperty + @Ann(value = Days.Sunday) + val t2103 = "test" +} diff --git a/test/files/pos/t1942.cmds b/test/files/pos/t1942.cmds deleted file mode 100644 index c14311042a..0000000000 --- a/test/files/pos/t1942.cmds +++ /dev/null @@ -1,2 +0,0 @@ -scalac A_1.scala -scalac Test_2.scala diff --git a/test/files/pos/t2464.cmds b/test/files/pos/t2464.cmds deleted file mode 100644 index ca733ef23d..0000000000 --- a/test/files/pos/t2464.cmds +++ /dev/null @@ -1,3 +0,0 @@ -javac JavaOne.java -scalac ScalaOne_1.scala -scalac t2464_2.scala diff --git a/test/files/pos/t2726.cmds b/test/files/pos/t2726.cmds deleted file mode 100644 index 5fcb18bfbb..0000000000 --- a/test/files/pos/t2726.cmds +++ /dev/null @@ -1,2 +0,0 @@ -scalac SQLBuilder_1.scala -scalac test_2.scala diff --git a/test/files/pos/t294/Ann.java b/test/files/pos/t294/Ann.java new file mode 100644 index 0000000000..934ca46297 --- /dev/null +++ b/test/files/pos/t294/Ann.java @@ -0,0 +1,3 @@ +public @interface Ann { + public Ann2[] nested(); +} diff --git a/test/files/pos/t294/Ann2.java b/test/files/pos/t294/Ann2.java new file mode 100644 index 0000000000..025b79e794 --- /dev/null +++ b/test/files/pos/t294/Ann2.java @@ -0,0 +1,3 @@ +public @interface Ann2 { + public int value(); +} diff --git a/test/files/pos/t294/Test_1.scala b/test/files/pos/t294/Test_1.scala new file mode 100644 index 0000000000..ff1f34b10e --- /dev/null +++ b/test/files/pos/t294/Test_1.scala @@ -0,0 +1,7 @@ +// also test pickling of java annotations; Test_2.scala will +// read this class file +@Ann(nested = Array(new Ann2(10))) class Test { + @Ann2(100) var ctx: Object = _ + @Ann(nested = Array()) def foo = 10 + @Ann(nested = Array(new Ann2(10), new Ann2(23))) val bam = -3 +} diff --git a/test/files/pos/t294/Test_2.scala b/test/files/pos/t294/Test_2.scala new file mode 100644 index 0000000000..9fb1c6e175 --- /dev/null +++ b/test/files/pos/t294/Test_2.scala @@ -0,0 +1 @@ +class Test2 extends Test diff --git a/test/files/pos/t4649.flags b/test/files/pos/t4649.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/pos/t4649.flags @@ -0,0 +1 @@ +-Xfatal-warnings \ No newline at end of file diff --git a/test/files/pos/t4649.scala b/test/files/pos/t4649.scala new file mode 100644 index 0000000000..0d6caa8d7a --- /dev/null +++ b/test/files/pos/t4649.scala @@ -0,0 +1,6 @@ +object Test { + // @annotation.tailrec + def lazyFilter[E](s: Stream[E], p: E => Boolean): Stream[E] = s match { + case h #:: t => if (p(h)) h #:: lazyFilter(t, p) else lazyFilter(t, p) + } +} diff --git a/test/files/pos/t4786.scala b/test/files/pos/t4786.scala new file mode 100644 index 0000000000..f0579142b8 --- /dev/null +++ b/test/files/pos/t4786.scala @@ -0,0 +1,24 @@ +trait Matrix[@specialized A, Repr[C] <: Matrix[C, Repr]] { // crash goes away if @specialize is removed + def duplicate(mb: MatrixBuilder[A, Repr]): Repr[A] = { + mb.zeros + } +} +trait DenseMatrix[@specialized A] extends Matrix[A, DenseMatrix] +trait DenseMatrixFlt extends DenseMatrix[Float] + +trait MatrixBuilder[@specialized A, Repr[C] <: Matrix[C, Repr]] { + def zeros: Repr[A] +} +object DenseFloatBuilder extends MatrixBuilder[Float, DenseMatrix] { + val zeros = new Object with DenseMatrixFlt + // Note: + // - in 2.9 crash goes away if the explicit type "DenseMatrixFlt" is assigned to "zeros" + // - in 2.9 crash goes away if DenseMatrixFlt is a class instead of a trait: + // val zeros = new DenseMatrixFlt +} + +object Test extends App { + val m1 = DenseFloatBuilder.zeros // in 2.9 crash goes away if explicit type "DenseMatrixFlt" is assigned to m1 + val m2 = m1.duplicate(DenseFloatBuilder) +} + diff --git a/test/files/pos/t5399a.scala b/test/files/pos/t5399a.scala new file mode 100644 index 0000000000..4ebd85ad03 --- /dev/null +++ b/test/files/pos/t5399a.scala @@ -0,0 +1,19 @@ +class Foo { + trait Init[T] + class ScopedKey[T] extends Init[T] + + trait Setting[T] { + val key: ScopedKey[T] + } + + case class ScopedKey1[T](val foo: Init[T]) extends ScopedKey[T] + + val scalaHome: Setting[Option[String]] = null + val scalaVersion: Setting[String] = null + + def testPatternMatch(s: Setting[_]) { + s.key match { + case ScopedKey1(scalaHome.key | scalaVersion.key) => () + } + } +} diff --git a/test/files/pos/t5606.scala b/test/files/pos/t5606.scala new file mode 100644 index 0000000000..2545271e32 --- /dev/null +++ b/test/files/pos/t5606.scala @@ -0,0 +1,9 @@ + + + + + + + + +case class CaseTest[_](someData:String) diff --git a/test/files/pos/t5639/Bar.scala b/test/files/pos/t5639/Bar.scala new file mode 100644 index 0000000000..f577500acd --- /dev/null +++ b/test/files/pos/t5639/Bar.scala @@ -0,0 +1,7 @@ +package pack.age + +import pack.age.Implicits._ + +object Quux { + def baz : Baz = 1 +} diff --git a/test/files/pos/t5639/Foo.scala b/test/files/pos/t5639/Foo.scala new file mode 100644 index 0000000000..6602150661 --- /dev/null +++ b/test/files/pos/t5639/Foo.scala @@ -0,0 +1,7 @@ +package pack.age + +class Baz + +object Implicits { + implicit def Baz(n: Int): Baz = new Baz +} diff --git a/test/files/pos/t715.cmds b/test/files/pos/t715.cmds deleted file mode 100644 index 2836967fca..0000000000 --- a/test/files/pos/t715.cmds +++ /dev/null @@ -1,2 +0,0 @@ -scalac meredith_1.scala -scalac runner_2.scala -- cgit v1.2.3