summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
Diffstat (limited to 'test/files')
-rw-r--r--test/files/jvm/deprecation/Defs.java12
-rw-r--r--test/files/jvm/deprecation/Test_1.scala17
-rw-r--r--test/files/jvm/deprecation/Use_2.java10
-rw-r--r--test/files/jvm/serialization.check6
-rw-r--r--test/files/jvm/t1600.scala76
-rw-r--r--test/files/jvm/t1801.check6
-rw-r--r--test/files/jvm/t1801.scala31
-rw-r--r--test/files/jvm/t2515.check10
-rw-r--r--test/files/jvm/t2515.scala40
-rw-r--r--test/files/jvm/t2570.check0
-rw-r--r--test/files/jvm/t2570/Test.scala3
-rw-r--r--test/files/jvm/t2570/Test1.java2
-rw-r--r--test/files/jvm/t2570/Test3.java2
-rw-r--r--test/files/neg/bug1275.scala2
-rw-r--r--test/files/neg/bug608.check8
-rw-r--r--test/files/neg/bug608.scala24
-rw-r--r--test/files/neg/bug987.scala2
-rw-r--r--test/files/neg/t2139.check6
-rw-r--r--test/files/neg/t2139.scala15
-rw-r--r--test/files/pos/spec-Function1.scala2
-rw-r--r--test/files/pos/spec-List.scala2
-rw-r--r--test/files/pos/t2464/JavaOne.java5
-rw-r--r--test/files/pos/t2464/ScalaOne_1.scala6
-rw-r--r--test/files/pos/t2464/t2464_2.scala3
-rw-r--r--test/files/pos/t2624.scala4
-rw-r--r--test/files/pos/t2673.scala4
-rwxr-xr-xtest/files/pos/t2683.scala7
-rw-r--r--test/files/pos/t2708.scala1
-rw-r--r--test/files/pos/t2726/SQLBuilder_1.scala7
-rw-r--r--test/files/pos/t2726/test_2.scala3
-rw-r--r--test/files/pos/t2794.scala9
-rw-r--r--test/files/run/bug2378.scala9
-rw-r--r--test/files/run/bug2552.check1
-rw-r--r--test/files/run/bug2721.check2
-rw-r--r--test/files/run/bug2721.scala12
-rw-r--r--test/files/run/colltest1.scala8
-rw-r--r--test/files/run/docgenerator.check177
-rw-r--r--test/files/run/docgenerator.scala295
-rw-r--r--test/files/run/manifests.scala147
-rw-r--r--test/files/run/names-defaults.scala15
-rw-r--r--test/files/run/sequenceComparisons.scala10
-rw-r--r--test/files/run/t1167.check3
-rw-r--r--test/files/run/t1167.scala25
-rw-r--r--test/files/run/t1323.scala36
-rw-r--r--test/files/run/t2754.scala39
-rw-r--r--test/files/scalap/caseClass/result.test4
46 files changed, 496 insertions, 612 deletions
diff --git a/test/files/jvm/deprecation/Defs.java b/test/files/jvm/deprecation/Defs.java
new file mode 100644
index 0000000000..52101c342a
--- /dev/null
+++ b/test/files/jvm/deprecation/Defs.java
@@ -0,0 +1,12 @@
+public class Defs {
+ /** @deprecated */
+ public int i = 1;
+
+ /** @deprecated */
+ public int bar() { return 0; }
+
+ /** @deprecated */
+ public class Inner {
+ public int buz() { return 0; }
+ }
+}
diff --git a/test/files/jvm/deprecation/Test_1.scala b/test/files/jvm/deprecation/Test_1.scala
new file mode 100644
index 0000000000..92173f94e2
--- /dev/null
+++ b/test/files/jvm/deprecation/Test_1.scala
@@ -0,0 +1,17 @@
+class Test {
+ def test {
+ val d = new Defs
+ val u = d.i + 1
+ d.i = 2
+ val v = d.bar()
+ val i = new d.Inner
+ val w = i.buz()
+ }
+
+ @deprecated("no longer!") class Inner {
+ @deprecated("uncool") def f: Int = 1
+ @deprecated("this one as well!") var g = -1
+ }
+}
+
+object Test { def main(args: Array[String]) { } }
diff --git a/test/files/jvm/deprecation/Use_2.java b/test/files/jvm/deprecation/Use_2.java
new file mode 100644
index 0000000000..65da8a8fac
--- /dev/null
+++ b/test/files/jvm/deprecation/Use_2.java
@@ -0,0 +1,10 @@
+class Use_2 {
+ public int test() {
+ Test u = new Test();
+ Test.Inner a = u.new Inner();
+ int i = a.f();
+ int j = a.g();
+ a.g_$eq(5);
+ return i + j;
+ }
+} \ No newline at end of file
diff --git a/test/files/jvm/serialization.check b/test/files/jvm/serialization.check
index f1b5b10ec6..2b0ad3888b 100644
--- a/test/files/jvm/serialization.check
+++ b/test/files/jvm/serialization.check
@@ -78,11 +78,11 @@ y = BitSet(2, 3)
x equals y: true, y equals x: true
x = Map(2 -> B, 1 -> A, 3 -> C)
-y = Map(2 -> B, 1 -> A, 3 -> C)
+y = Map(1 -> A, 2 -> B, 3 -> C)
x equals y: true, y equals x: true
x = Set(1, 2)
-y = Set(1, 2)
+y = Set(2, 1)
x equals y: true, y equals x: true
x = List((buffers,20), (layers,2), (title,3))
@@ -158,7 +158,7 @@ y = BitSet(0, 8, 9)
x equals y: true, y equals x: true
x = Map(A -> 1, C -> 3, B -> 2)
-y = Map(A -> 1, C -> 3, B -> 2)
+y = Map(B -> 2, C -> 3, A -> 1)
x equals y: true, y equals x: true
x = Set(layers, buffers, title)
diff --git a/test/files/jvm/t1600.scala b/test/files/jvm/t1600.scala
new file mode 100644
index 0000000000..1cdcee8547
--- /dev/null
+++ b/test/files/jvm/t1600.scala
@@ -0,0 +1,76 @@
+
+/**
+ * Checks that serialization of hash-based collections works correctly if the hashCode
+ * changes on deserialization.
+ */
+object Test {
+
+ import collection._
+ def main(args: Array[String]) {
+ for (i <- Seq(0, 1, 2, 10, 100)) {
+ def entries = (0 until i).map(i => (new Foo, i)).toList
+ def elements = entries.map(_._1)
+
+ val maps = Seq[Map[Foo, Int]](new mutable.HashMap, new mutable.LinkedHashMap,
+ new immutable.HashMap).map(_ ++ entries)
+ test[Map[Foo, Int]](maps, entries.size, assertMap _)
+
+ val sets = Seq[Set[Foo]](new mutable.HashSet, new mutable.LinkedHashSet,
+ new immutable.HashSet).map(_ ++ elements)
+ test[Set[Foo]](sets, entries.size, assertSet _)
+ }
+ }
+
+ private def test[A <: AnyRef](collections: Seq[A], expectedSize: Int, assertFunction: (A, Int) => Unit) {
+ for (collection <- collections) {
+ assertFunction(collection, expectedSize)
+
+ val bytes = toBytes(collection)
+ Foo.hashCodeModifier = 1
+ val deserializedCollection = toObject[A](bytes)
+
+ assertFunction(deserializedCollection, expectedSize)
+ assert(deserializedCollection.getClass == collection.getClass,
+ "collection class should remain the same after deserialization")
+ Foo.hashCodeModifier = 0
+ }
+ }
+
+ private def toObject[A](bytes: Array[Byte]): A = {
+ val in = new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(bytes))
+ in.readObject.asInstanceOf[A]
+ }
+
+ private def toBytes(o: AnyRef): Array[Byte] = {
+ val bos = new java.io.ByteArrayOutputStream
+ val out = new java.io.ObjectOutputStream(bos)
+ out.writeObject(o)
+ out.close
+ bos.toByteArray
+ }
+
+ private def assertMap[A, B](map: Map[A, B], expectedSize: Int) {
+ assert(expectedSize == map.size, "expected map size: " + expectedSize + ", actual size: " + map.size)
+ map.foreach { case (k, v) =>
+ assert(map.contains(k), "contains should return true for key in the map, key: " + k)
+ assert(map(k) == v)
+ }
+ }
+
+ private def assertSet[A](set: Set[A], expectedSize: Int) {
+ assert(expectedSize == set.size, "expected set size: " + expectedSize + ", actual size: " + set.size)
+ set.foreach { e => assert(set.contains(e), "contains should return true for element in the set, element: " + e) }
+ }
+
+ object Foo {
+ /* Used to simulate a hashCode change caused by deserializing an instance with an
+ * identity-based hashCode in another JVM.
+ */
+ var hashCodeModifier = 0
+ }
+
+ @serializable
+ class Foo {
+ override def hashCode = System.identityHashCode(this) + Foo.hashCodeModifier
+ }
+}
diff --git a/test/files/jvm/t1801.check b/test/files/jvm/t1801.check
deleted file mode 100644
index bf78a99db9..0000000000
--- a/test/files/jvm/t1801.check
+++ /dev/null
@@ -1,6 +0,0 @@
-0
-100
-200
-300
-400
-done!
diff --git a/test/files/jvm/t1801.scala b/test/files/jvm/t1801.scala
deleted file mode 100644
index 6ed7c56336..0000000000
--- a/test/files/jvm/t1801.scala
+++ /dev/null
@@ -1,31 +0,0 @@
-import scala.actors.Actor._
-
-object Test {
- val rt = Runtime.getRuntime()
- val sender = actor {
- var cnt = 0
- while(cnt < 500) {
- if ((cnt % 100) == 0) println(cnt)
- receiver ! new Array[Int] (148576)
- cnt += 1
- //println ("Used Mem: " + (((rt.totalMemory() - rt.freeMemory()) / 1048576.) formatted "%.2f") + " Mb")
- }
- receiver ! 'exit
- }
-
- val receiver = actor {
- loop {
- react {
- case x: Array[Int] => ()//println ("received " + x.length)
- case 'exit => {
- println("done!")
- exit()
- }
- }
- }
- }
-
- def main (args: Array[String]) {
- sender
- }
-}
diff --git a/test/files/jvm/t2515.check b/test/files/jvm/t2515.check
deleted file mode 100644
index 8cb8bde11e..0000000000
--- a/test/files/jvm/t2515.check
+++ /dev/null
@@ -1,10 +0,0 @@
-Iteration 1 succeeded
-Iteration 2 succeeded
-Iteration 3 succeeded
-Iteration 4 succeeded
-Iteration 5 succeeded
-Iteration 6 succeeded
-Iteration 7 succeeded
-Iteration 8 succeeded
-Iteration 9 succeeded
-Iteration 10 succeeded
diff --git a/test/files/jvm/t2515.scala b/test/files/jvm/t2515.scala
deleted file mode 100644
index 83cb058168..0000000000
--- a/test/files/jvm/t2515.scala
+++ /dev/null
@@ -1,40 +0,0 @@
-import scala.actors.{Futures, TIMEOUT}
-import scala.actors.Actor._
-
-object Test {
-
- def compute(): Option[Boolean] = {
- val fts = for (j <- 0 until 5) yield Futures.future {
- receiveWithin (100) {
- case TIMEOUT => true
- case other => false
- }
- }
- val done = Futures.awaitAll(2000, fts.toArray: _*) // list to array, as varargs
- if (done.contains(None))
- None
- else
- Some(true)
- }
-
- def main(args:Array[String]) : Unit = {
- val format = new java.text.DecimalFormat("000.00'ms'")
- var iter = 1
- val done = 11
- while (iter < done) {
- val start = System.nanoTime()
- val result = compute()
- val time = System.nanoTime() - start
- result match {
- case Some(result) =>
- //printf("Iteration %2d succeeded after %s %n", iter, format.format(time / 1e6))
- printf("Iteration %2d succeeded%n", iter)
- iter += 1
- case None =>
- printf(">>>> Iteration %2d failed after %s <<<<< %n", iter, format.format(time / 1e6))
- iter = done
- }
- }
- }
-
-}
diff --git a/test/files/jvm/t2570.check b/test/files/jvm/t2570.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/jvm/t2570.check
diff --git a/test/files/jvm/t2570/Test.scala b/test/files/jvm/t2570/Test.scala
new file mode 100644
index 0000000000..d7b7632e22
--- /dev/null
+++ b/test/files/jvm/t2570/Test.scala
@@ -0,0 +1,3 @@
+class Test2 extends Test1[Test3[Test4]]
+class Test4
+object Test extends Application {} \ No newline at end of file
diff --git a/test/files/jvm/t2570/Test1.java b/test/files/jvm/t2570/Test1.java
new file mode 100644
index 0000000000..f305736581
--- /dev/null
+++ b/test/files/jvm/t2570/Test1.java
@@ -0,0 +1,2 @@
+public class Test1<T extends Test3> {
+} \ No newline at end of file
diff --git a/test/files/jvm/t2570/Test3.java b/test/files/jvm/t2570/Test3.java
new file mode 100644
index 0000000000..97603b5ca6
--- /dev/null
+++ b/test/files/jvm/t2570/Test3.java
@@ -0,0 +1,2 @@
+public class Test3<T> {
+} \ No newline at end of file
diff --git a/test/files/neg/bug1275.scala b/test/files/neg/bug1275.scala
index 7b9b044346..e9be13c763 100644
--- a/test/files/neg/bug1275.scala
+++ b/test/files/neg/bug1275.scala
@@ -1,4 +1,4 @@
-// tested using Scala compiler version 2.6.0-RC1 -- (c) 2002-2009 LAMP/EPFL
+// tested using Scala compiler version 2.6.0-RC1 -- (c) 2002-2010 LAMP/EPFL
// prompted by "Covariant return types" mailing list question
object TestCovariance {
diff --git a/test/files/neg/bug608.check b/test/files/neg/bug608.check
index 4e8eb4d709..a8e32e4c10 100644
--- a/test/files/neg/bug608.check
+++ b/test/files/neg/bug608.check
@@ -1,6 +1,6 @@
bug608.scala:16: error: type mismatch;
- found : (a) => a
- required: (ha) => ?
- = g(f(x).bimap(id))
- ^
+ found : hs{type a = ha}
+ required: hs{type s = hs; type a = ha}
+ = g(f(x).bimap(id))
+ ^
one error found
diff --git a/test/files/neg/bug608.scala b/test/files/neg/bug608.scala
index 24f515651a..34dc4c0352 100644
--- a/test/files/neg/bug608.scala
+++ b/test/files/neg/bug608.scala
@@ -1,17 +1,17 @@
trait CrashDueToTypeError {
- def id[a](x :a) :a = x
+ def id[a](x :a) :a = x
- trait Bifunctor {
- type a; // content
- type s <: Bifunctor
+ trait Bifunctor {
+ type a; // content
+ type s <: Bifunctor
- // uncomment this-vvvvvvvvvvvvvvvvvvvvvvvvvvvv, and it compiles
- def bimap[c](f :a=>c) :s{/*type s=Bifunctor.this.s;*/type a=c; }
- }
+ // uncomment this-vvvvvvvvvvvvvvvvvvvvvvvvvvvv, and it compiles
+ def bimap[c](f :a=>c) :s{/*type s=Bifunctor.this.s;*/type a=c; }
+ }
- def hylo[hs <: Bifunctor,ha,hb,hc]
- (f :hb=>hs{type s=hs; type a=ha},
- g :hs{type s=hs; type a=ha}=>hc)(x :hb)
- :hc
- = g(f(x).bimap(id))
+ def hylo[hs <: Bifunctor,ha,hb,hc]
+ (f :hb=>hs{type s=hs; type a=ha},
+ g :hs{type s=hs; type a=ha}=>hc)(x :hb)
+ :hc
+ = g(f(x).bimap(id))
}
diff --git a/test/files/neg/bug987.scala b/test/files/neg/bug987.scala
index 0c65b98049..5b2addf5ef 100644
--- a/test/files/neg/bug987.scala
+++ b/test/files/neg/bug987.scala
@@ -1,4 +1,4 @@
-// tested using Scala compiler version 2.4.0-RC1 -- (c) 2002-2009 LAMP/EPFL
+// tested using Scala compiler version 2.4.0-RC1 -- (c) 2002-2010 LAMP/EPFL
// Many thanks to all at LAMP for the work that goes into Scala.
diff --git a/test/files/neg/t2139.check b/test/files/neg/t2139.check
new file mode 100644
index 0000000000..e26f290761
--- /dev/null
+++ b/test/files/neg/t2139.check
@@ -0,0 +1,6 @@
+t2139.scala:13: error: type mismatch;
+ found : Int(4)
+ required: Nothing
+ val z:Int=(u.f _)(4)
+ ^
+one error found
diff --git a/test/files/neg/t2139.scala b/test/files/neg/t2139.scala
new file mode 100644
index 0000000000..4f09b5a5d1
--- /dev/null
+++ b/test/files/neg/t2139.scala
@@ -0,0 +1,15 @@
+/*
+ NOTE: if inference is changed so that
+ T is inferred to be Int, rather than Nothing,
+ the piece of code below will start to compile OK.
+ In that case, see ticket #2139, and make sure that
+ the generated code will no longer crash!
+*/
+class U {
+ def f[T](x:T):T=x
+}
+object H extends Application {
+ val u=new U
+ val z:Int=(u.f _)(4)
+ println("done")
+}
diff --git a/test/files/pos/spec-Function1.scala b/test/files/pos/spec-Function1.scala
index 2baa22f269..62789ed12a 100644
--- a/test/files/pos/spec-Function1.scala
+++ b/test/files/pos/spec-Function1.scala
@@ -1,7 +1,7 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2009, LAMP/EPFL **
+** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
diff --git a/test/files/pos/spec-List.scala b/test/files/pos/spec-List.scala
index 17291fae56..ad864abd7c 100644
--- a/test/files/pos/spec-List.scala
+++ b/test/files/pos/spec-List.scala
@@ -1,6 +1,6 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL **
+** / __/ __// _ | / / / _ | (c) 2003-2010, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
diff --git a/test/files/pos/t2464/JavaOne.java b/test/files/pos/t2464/JavaOne.java
new file mode 100644
index 0000000000..ff36868a0e
--- /dev/null
+++ b/test/files/pos/t2464/JavaOne.java
@@ -0,0 +1,5 @@
+class ClassTwo {
+ public static class Child {
+ public void func2() {return ;}
+ }
+}
diff --git a/test/files/pos/t2464/ScalaOne_1.scala b/test/files/pos/t2464/ScalaOne_1.scala
new file mode 100644
index 0000000000..1caf8ecae4
--- /dev/null
+++ b/test/files/pos/t2464/ScalaOne_1.scala
@@ -0,0 +1,6 @@
+class ScalaClassOne extends ClassTwo.Child {
+ def func4() = {
+ func2
+ }
+}
+
diff --git a/test/files/pos/t2464/t2464_2.scala b/test/files/pos/t2464/t2464_2.scala
new file mode 100644
index 0000000000..13a52c952b
--- /dev/null
+++ b/test/files/pos/t2464/t2464_2.scala
@@ -0,0 +1,3 @@
+object Test {
+ val c1 = new ScalaClassOne
+}
diff --git a/test/files/pos/t2624.scala b/test/files/pos/t2624.scala
new file mode 100644
index 0000000000..76f0e30369
--- /dev/null
+++ b/test/files/pos/t2624.scala
@@ -0,0 +1,4 @@
+object Test {
+ List(1).map(identity(_))
+ List(1).map(identity) // this didn't typecheck before the fix
+}
diff --git a/test/files/pos/t2673.scala b/test/files/pos/t2673.scala
new file mode 100644
index 0000000000..7f232df3f5
--- /dev/null
+++ b/test/files/pos/t2673.scala
@@ -0,0 +1,4 @@
+object Test {
+ val xs = Array(1, 2, 3)
+ (xs, xs).zipped map (_ + _)
+} \ No newline at end of file
diff --git a/test/files/pos/t2683.scala b/test/files/pos/t2683.scala
new file mode 100755
index 0000000000..4ba34b554a
--- /dev/null
+++ b/test/files/pos/t2683.scala
@@ -0,0 +1,7 @@
+class A
+class B extends A
+
+object Test {
+ val c: Class[_ <: A] = Class.forName("B").asSubclass(classOf[A])
+ val x: Option[Class[_ <: A]] = Some(3).map { case _ => c }
+}
diff --git a/test/files/pos/t2708.scala b/test/files/pos/t2708.scala
new file mode 100644
index 0000000000..19485bf4ce
--- /dev/null
+++ b/test/files/pos/t2708.scala
@@ -0,0 +1 @@
+class Foo(@volatile var v: Int)
diff --git a/test/files/pos/t2726/SQLBuilder_1.scala b/test/files/pos/t2726/SQLBuilder_1.scala
new file mode 100644
index 0000000000..8d07a88265
--- /dev/null
+++ b/test/files/pos/t2726/SQLBuilder_1.scala
@@ -0,0 +1,7 @@
+class SQLBuilder extends SQLBuilder.Segment
+
+object SQLBuilder {
+ trait Segment
+}
+
+
diff --git a/test/files/pos/t2726/test_2.scala b/test/files/pos/t2726/test_2.scala
new file mode 100644
index 0000000000..e738143aeb
--- /dev/null
+++ b/test/files/pos/t2726/test_2.scala
@@ -0,0 +1,3 @@
+object SQuery2Test {
+ new SQLBuilder
+}
diff --git a/test/files/pos/t2794.scala b/test/files/pos/t2794.scala
new file mode 100644
index 0000000000..caefea4fbb
--- /dev/null
+++ b/test/files/pos/t2794.scala
@@ -0,0 +1,9 @@
+class Key[T]
+
+class Entry[T](val k: Key[T], val v: T)
+
+object Entry {
+
+ def makeDefault[T <: AnyRef] = new Entry[T](new Key[T], null: T)
+
+}
diff --git a/test/files/run/bug2378.scala b/test/files/run/bug2378.scala
new file mode 100644
index 0000000000..f696a78b4c
--- /dev/null
+++ b/test/files/run/bug2378.scala
@@ -0,0 +1,9 @@
+object Test
+{
+ val f1 = -0.0
+ val f2 = -(0.0)
+ def main(args: Array[String]): Unit = {
+ assert(f1.toString startsWith "-")
+ assert(f2.toString startsWith "-")
+ }
+}
diff --git a/test/files/run/bug2552.check b/test/files/run/bug2552.check
index 774e360d13..1deeae772f 100644
--- a/test/files/run/bug2552.check
+++ b/test/files/run/bug2552.check
@@ -28,7 +28,6 @@ true
1
p(2)
false
-p(2)
false
p(0)
true
diff --git a/test/files/run/bug2721.check b/test/files/run/bug2721.check
new file mode 100644
index 0000000000..2bd7656b36
--- /dev/null
+++ b/test/files/run/bug2721.check
@@ -0,0 +1,2 @@
+root:-rootVal-sub:-subVal-
+root:-rootVal-sub:-subVal-
diff --git a/test/files/run/bug2721.scala b/test/files/run/bug2721.scala
new file mode 100644
index 0000000000..8bd03bc838
--- /dev/null
+++ b/test/files/run/bug2721.scala
@@ -0,0 +1,12 @@
+object Test
+{
+ val xml1 = <root xmlns:ns="nsUri" ns:at="rootVal"><sub ns:at="subVal"/></root>
+ val xml2= scala.xml.XML.loadString("""<root xmlns:ns="nsUri" ns:at="rootVal"><sub ns:at="subVal"/></root>""")
+
+ def backslashSearch(x: xml.Elem) = "root:-"+(x \ "@{nsUri}at") +"-sub:-"+(x \ "sub" \ "@{nsUri}at") +"-"
+
+ def main(args: Array[String]): Unit = {
+ println(backslashSearch(xml1))
+ println(backslashSearch(xml2))
+ }
+}
diff --git a/test/files/run/colltest1.scala b/test/files/run/colltest1.scala
index 081522d3f6..f12c234f74 100644
--- a/test/files/run/colltest1.scala
+++ b/test/files/run/colltest1.scala
@@ -25,7 +25,7 @@ object Test extends Application {
val secondFive = empty ++ (6 to 10)
assert(firstFive ++ secondFive == ten, firstFive ++ secondFive)
val odds = ten filter (_ % 2 != 0)
- val evens = ten remove (_ % 2 != 0)
+ val evens = ten filterNot (_ % 2 != 0)
assert(odds.size == evens.size)
val (o, e) = ten.partition(_ % 2 == 0)
assert(o.size == e.size)
@@ -112,14 +112,14 @@ object Test extends Application {
assert(ten.startsWith(List(3, 4), 2))
assert(ten.endsWith(List(9, 10)))
assert(ten.endsWith(List()))
- assert(ten.indexOfSeq(List(3, 4, 5)) == 2, ten.indexOfSeq(List(3, 4, 5)))
+ assert(ten.indexOfSlice(List(3, 4, 5)) == 2, ten.indexOfSlice(List(3, 4, 5)))
assert(ten contains 1)
assert(ten contains 10)
assert(!(ten contains 0))
assert((empty ++ (1 to 7) union empty ++ (3 to 10)) == List(1, 2, 3, 4, 5, 6, 7, 3, 4, 5, 6, 7, 8, 9, 10))
assert((ten diff ten).isEmpty)
assert((ten diff List()) == ten)
- assert((ten diff (ten filter (_ % 2 == 0))) == (ten remove (_ % 2 == 0)))
+ assert((ten diff (ten filter (_ % 2 == 0))) == (ten filterNot (_ % 2 == 0)))
assert((ten intersect ten) == ten)
assert((ten intersect List(5)) == List(5))
assert((ten ++ ten).removeDuplicates == ten)
@@ -186,7 +186,7 @@ object Test extends Application {
def m3 = empty ++ m1
assert(m1 == m3)
println(m3)
- val m4 = m3.remove { case (k, v) => k != "A" }
+ val m4 = m3 filterNot { case (k, v) => k != "A" }
assert(m4.size == 1, m4)
}
diff --git a/test/files/run/docgenerator.check b/test/files/run/docgenerator.check
deleted file mode 100644
index dbb7eeed28..0000000000
--- a/test/files/run/docgenerator.check
+++ /dev/null
@@ -1,177 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
- <head><title>List of all classes and objects</title>
- <meta http-equiv="content-type" content="text/html; charset=UTF8"></meta><meta content="scaladoc" name="generator"></meta><link href="style.css" type="text/css" rel="stylesheet"></link><script type="text/javascript" src="script.js"></script>
- </head>
- <body onload="init()"><div><div class="kinds" id="Classes">Classes</div><ul class="list">
- <li id="Classes_C"><a href="examples/C0.html" target="contentFrame">C0</a></li>
-<li><a href="examples/C0.C1_Protected.html" target="contentFrame">C0.C1_Protected</a></li>
-<li><a href="examples/C0.C1_Public.html" target="contentFrame">C0.C1_Public</a></li>
-<li><a href="examples/C0_Protected.html" target="contentFrame">C0_Protected</a></li>
-<li><a href="examples/C0_Protected.C1_Protected.html" target="contentFrame">C0_Protected.C1_Protected</a></li>
-<li><a href="examples/C0_Protected.C1_Public.html" target="contentFrame">C0_Protected.C1_Public</a></li>
- </ul>
-<div class="kinds" id="Objects">Objects</div><ul class="list">
- <li id="Objects_o"><a href="examples/obj0$object.html" target="contentFrame">obj0</a></li>
-<li><a href="examples/obj0$object.obj1_Protected$object.html" target="contentFrame">obj0.obj1_Protected</a></li>
-<li><a href="examples/obj0$object.obj1_Public$object.html" target="contentFrame">obj0.obj1_Public</a></li>
-<li><a href="examples/obj0_Protected$object.html" target="contentFrame">obj0_Protected</a></li>
-<li><a href="examples/obj0_Protected$object.obj1_Protected$object.html" target="contentFrame">obj0_Protected.obj1_Protected</a></li>
-<li><a href="examples/obj0_Protected$object.obj1_Public$object.html" target="contentFrame">obj0_Protected.obj1_Public</a></li>
- </ul></div></body>
- </html>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
- <head><title>Scala 2</title>
- <meta http-equiv="content-type" content="text/html; charset=UTF8"></meta><meta content="scaladoc" name="generator"></meta><link href="style.css" type="text/css" rel="stylesheet"></link><script type="text/javascript" src="script.js"></script>
- </head>
- <frameset cols="25%, 75%">
- <frameset rows="50%, 28, 50%">
- <frame src="modules.html" name="modulesFrame"></frame>
- <frame src="nav-classes.html" name="navigationFrame"></frame>
- <frame src="all-classes.html" name="classesFrame"></frame>
- </frameset>
- <frame src="root-content.html" name="contentFrame"></frame>
- </frameset>
- </html>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
- <head><title>List of all classes and objects</title>
- <meta http-equiv="content-type" content="text/html; charset=UTF8"></meta><meta content="scaladoc" name="generator"></meta><link href="style.css" type="text/css" rel="stylesheet"></link><script type="text/javascript" src="script.js"></script>
- </head>
- <body onload="init()"><div><div class="kinds" id="Classes">Classes</div><ul class="list">
- <li id="Classes_C"><a href="examples/C0.html" target="contentFrame">C0</a></li>
-<li><a href="examples/C0.C1_Public.html" target="contentFrame">C0.C1_Public</a></li>
- </ul>
-<div class="kinds" id="Objects">Objects</div><ul class="list">
- <li id="Objects_o"><a href="examples/obj0$object.html" target="contentFrame">obj0</a></li>
-<li><a href="examples/obj0$object.obj1_Public$object.html" target="contentFrame">obj0.obj1_Public</a></li>
- </ul></div></body>
- </html>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
- <head><title>Scala 2</title>
- <meta http-equiv="content-type" content="text/html; charset=UTF8"></meta><meta content="scaladoc" name="generator"></meta><link href="style.css" type="text/css" rel="stylesheet"></link><script type="text/javascript" src="script.js"></script>
- </head>
- <frameset cols="25%, 75%">
- <frameset rows="50%, 28, 50%">
- <frame src="modules.html" name="modulesFrame"></frame>
- <frame src="nav-classes.html" name="navigationFrame"></frame>
- <frame src="all-classes.html" name="classesFrame"></frame>
- </frameset>
- <frame src="root-content.html" name="contentFrame"></frame>
- </frameset>
- </html>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
- <head><title>List of all classes and objects</title>
- <meta http-equiv="content-type" content="text/html; charset=UTF8"></meta><meta content="scaladoc" name="generator"></meta><link href="style.css" type="text/css" rel="stylesheet"></link><script type="text/javascript" src="script.js"></script>
- </head>
- <body onload="init()"><div><div class="kinds" id="Classes">Classes</div><ul class="list">
- <li id="Classes_C"><a href="examples/C0.html" target="contentFrame">C0</a></li>
-<li><a href="examples/C0.C1_Protected.html" target="contentFrame">C0.C1_Protected</a></li>
-<li><a href="examples/C0.C1_Public.html" target="contentFrame">C0.C1_Public</a></li>
-<li><a href="examples/C0_Protected.html" target="contentFrame">C0_Protected</a></li>
-<li><a href="examples/C0_Protected.C1_Protected.html" target="contentFrame">C0_Protected.C1_Protected</a></li>
-<li><a href="examples/C0_Protected.C1_Public.html" target="contentFrame">C0_Protected.C1_Public</a></li>
- </ul>
-<div class="kinds" id="Objects">Objects</div><ul class="list">
- <li id="Objects_o"><a href="examples/obj0$object.html" target="contentFrame">obj0</a></li>
-<li><a href="examples/obj0$object.obj1_Protected$object.html" target="contentFrame">obj0.obj1_Protected</a></li>
-<li><a href="examples/obj0$object.obj1_Public$object.html" target="contentFrame">obj0.obj1_Public</a></li>
-<li><a href="examples/obj0_Protected$object.html" target="contentFrame">obj0_Protected</a></li>
-<li><a href="examples/obj0_Protected$object.obj1_Protected$object.html" target="contentFrame">obj0_Protected.obj1_Protected</a></li>
-<li><a href="examples/obj0_Protected$object.obj1_Public$object.html" target="contentFrame">obj0_Protected.obj1_Public</a></li>
- </ul></div></body>
- </html>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
- <head><title>Scala 2</title>
- <meta http-equiv="content-type" content="text/html; charset=UTF8"></meta><meta content="scaladoc" name="generator"></meta><link href="style.css" type="text/css" rel="stylesheet"></link><script type="text/javascript" src="script.js"></script>
- </head>
- <frameset cols="25%, 75%">
- <frameset rows="50%, 28, 50%">
- <frame src="modules.html" name="modulesFrame"></frame>
- <frame src="nav-classes.html" name="navigationFrame"></frame>
- <frame src="all-classes.html" name="classesFrame"></frame>
- </frameset>
- <frame src="root-content.html" name="contentFrame"></frame>
- </frameset>
- </html>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
- <head><title>List of all classes and objects</title>
- <meta http-equiv="content-type" content="text/html; charset=UTF8"></meta><meta content="scaladoc" name="generator"></meta><link href="style.css" type="text/css" rel="stylesheet"></link><script type="text/javascript" src="script.js"></script>
- </head>
- <body onload="init()"><div><div class="kinds" id="Classes">Classes</div><ul class="list">
- <li id="Classes_C"><a href="examples/C0.html" target="contentFrame">C0</a></li>
-<li><a href="examples/C0.C1_Private.html" target="contentFrame">C0.C1_Private</a></li>
-<li><a href="examples/C0.C1_Protected.html" target="contentFrame">C0.C1_Protected</a></li>
-<li><a href="examples/C0.C1_Public.html" target="contentFrame">C0.C1_Public</a></li>
-<li><a href="examples/C0_Protected.html" target="contentFrame">C0_Protected</a></li>
-<li><a href="examples/C0_Protected.C1_Private.html" target="contentFrame">C0_Protected.C1_Private</a></li>
-<li><a href="examples/C0_Protected.C1_Protected.html" target="contentFrame">C0_Protected.C1_Protected</a></li>
-<li><a href="examples/C0_Protected.C1_Public.html" target="contentFrame">C0_Protected.C1_Public</a></li>
- </ul>
-<div class="kinds" id="Objects">Objects</div><ul class="list">
- <li id="Objects_o"><a href="examples/obj0$object.html" target="contentFrame">obj0</a></li>
-<li><a href="examples/obj0$object.obj1_Private$object.html" target="contentFrame">obj0.obj1_Private</a></li>
-<li><a href="examples/obj0$object.obj1_Protected$object.html" target="contentFrame">obj0.obj1_Protected</a></li>
-<li><a href="examples/obj0$object.obj1_Public$object.html" target="contentFrame">obj0.obj1_Public</a></li>
-<li><a href="examples/obj0_Protected$object.html" target="contentFrame">obj0_Protected</a></li>
-<li><a href="examples/obj0_Protected$object.obj1_Private$object.html" target="contentFrame">obj0_Protected.obj1_Private</a></li>
-<li><a href="examples/obj0_Protected$object.obj1_Protected$object.html" target="contentFrame">obj0_Protected.obj1_Protected</a></li>
-<li><a href="examples/obj0_Protected$object.obj1_Public$object.html" target="contentFrame">obj0_Protected.obj1_Public</a></li>
- </ul></div></body>
- </html>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
- <head><title>Scala 2</title>
- <meta http-equiv="content-type" content="text/html; charset=UTF8"></meta><meta content="scaladoc" name="generator"></meta><link href="style.css" type="text/css" rel="stylesheet"></link><script type="text/javascript" src="script.js"></script>
- </head>
- <frameset cols="25%, 75%">
- <frameset rows="50%, 28, 50%">
- <frame src="modules.html" name="modulesFrame"></frame>
- <frame src="nav-classes.html" name="navigationFrame"></frame>
- <frame src="all-classes.html" name="classesFrame"></frame>
- </frameset>
- <frame src="root-content.html" name="contentFrame"></frame>
- </frameset>
- </html>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
- <head><title>List of all classes and objects</title>
- <meta http-equiv="content-type" content="text/html; charset=UTF8"></meta><meta content="scaladoc" name="generator"></meta><link href="style.css" type="text/css" rel="stylesheet"></link><script type="text/javascript" src="script.js"></script>
- </head>
- <body onload="init()"><div><div class="kinds" id="Classes">Classes</div><ul class="list">
- <li id="Classes_B"><a href="annots/Bar.html" target="contentFrame">Bar</a></li>
-<li><a href="annots/Bar1.html" target="contentFrame">Bar1</a></li>
-<li><a href="annots/Bar2.html" target="contentFrame">Bar2</a></li>
- </ul>
-<div class="kinds" id="Objects">Objects</div><ul class="list">
- <li id="Objects_B"><a href="annots/Bar1.Foo11$object.html" target="contentFrame">Bar1.Foo11</a></li>
-<li id="Objects_F"><a href="annots/Foo$object.html" target="contentFrame">Foo</a></li>
-<li><a href="annots/Foo1$object.html" target="contentFrame">Foo1</a></li>
-<li><a href="annots/Foo1$object.Foo11$object.html" target="contentFrame">Foo1.Foo11</a></li>
-<li><a href="annots/Foo2$object.html" target="contentFrame">Foo2</a></li>
- </ul></div></body>
- </html>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
- <head><title>Scala 2</title>
- <meta http-equiv="content-type" content="text/html; charset=UTF8"></meta><meta content="scaladoc" name="generator"></meta><link href="style.css" type="text/css" rel="stylesheet"></link><script type="text/javascript" src="script.js"></script>
- </head>
- <frameset cols="25%, 75%">
- <frameset rows="50%, 28, 50%">
- <frame src="modules.html" name="modulesFrame"></frame>
- <frame src="nav-classes.html" name="navigationFrame"></frame>
- <frame src="all-classes.html" name="classesFrame"></frame>
- </frameset>
- <frame src="root-content.html" name="contentFrame"></frame>
- </frameset>
- </html>
-
diff --git a/test/files/run/docgenerator.scala b/test/files/run/docgenerator.scala
deleted file mode 100644
index 59f90ba415..0000000000
--- a/test/files/run/docgenerator.scala
+++ /dev/null
@@ -1,295 +0,0 @@
-object Test {
- import java.io.{File, FileReader, FileWriter}
-
- /** Tests the generation of the HTML documentation for some Scala
- * code samples (see value 'code' below) with different scaladoc
- * options (currently -access:<value>).
- *
- * @author Stephane Micheloud
- */
- def main(args: Array[String]) {
- // overwrites value of UrlContext.generator in file DocUtil.scala
- System.setProperty("doc.generator", "scaladoc")
- var dirname = System.getProperty("scalatest.output")
- if (dirname eq null) dirname = System.getProperty("java.io.tmpdir")
- val tmpDir = new File(dirname)
- tmpDir.mkdirs()
- test1(tmpDir)
- test2(tmpDir)
- }
-
- private def test1(tmpDir: File) {
- def testOptions(inFile: File, outDirName: String, opts: String*) {
- val outDir = createDir(tmpDir, outDirName)
- val args = Array.concat(Array("-d", outDir.getPath, inFile.getPath), opts.toArray:Array[String])
- if (MainDoc.main0(args)) {
- for (name <- List("all-classes.html", "index.html")) {
- val outFile = new File(outDir, name)
- val n = outFile.length.toInt
- val in = new FileReader(outFile)
- val cbuf = new Array[Char](n)
- in.read(cbuf, 0, n)
- println(new String(cbuf))
- }
- println
- }
- }
- val inFile = {
- val f = new File(tmpDir.getPath, "docgenerator1.scala")
- val writer = new FileWriter(f)
- writer.write(code1, 0, code1.length)
- writer.close
- f
- }
- testOptions(inFile, "test1", "") // none (default is -access:protected)
- testOptions(inFile, "test2", "-access:public")
- testOptions(inFile, "test3", "-access:protected")
- testOptions(inFile, "test4", "-access:private")
- }
-
- private def test2(tmpDir: File) {
- val code ="""
-package annots
-
-@deprecated("msg")
-object Foo { val x = 0 }
-
-@deprecated("msg")
-class Bar { val x = 1 }
-
-object Foo1 {
- @deprecated("msg")
- object Foo11 { val x = 3 }
-}
-
-class Bar1 {
- @deprecated("msg")
- object Foo11 { val x = 2 }
-}
-
-class Bar2 {
- def bar {
- @deprecated("msg")
- object Foo21 { val x = 4 }
- ()
- }
-}
-
-object Foo2 {
- def foo {
- @deprecated("msg")
- object Foo21 { val x = 5 }
- ()
- }
-}
-"""
- val inFile = {
- val f = new File(tmpDir.getPath, "docgenerator2.scala")
- val writer = new FileWriter(f)
- writer.write(code, 0, code.length)
- writer.close
- f
- }
- val outDir = createDir(tmpDir, "annots1")
- val args = Array.concat(Array("-d", outDir.getPath, inFile.getPath))
- if (MainDoc.main0(args)) {
- for (name <- List("all-classes.html", "index.html")) {
- val outFile = new File(outDir, name)
- val n = outFile.length.toInt
- val in = new FileReader(outFile)
- val cbuf = new Array[Char](n)
- in.read(cbuf, 0, n)
- println(new String(cbuf))
- }
- println
- }
- }
-
- object MainDoc {
- import scala.tools.nsc._
- import scala.tools.nsc.doc.DefaultDocDriver
- import scala.tools.nsc.reporters.ConsoleReporter
- def error(msg: String) { Console.err.println(msg) }
- var reporter: ConsoleReporter = _
- def process(args: Array[String]) {
- val docSettings = new scala.tools.nsc.doc.Settings(error)
- // when running that compiler, give it a scala-library to the classpath
- docSettings.classpath.value = System.getProperty("java.class.path")
- reporter = new ConsoleReporter(docSettings)
- val command = new CompilerCommand(args.toList, docSettings, error, false)
- try {
- object compiler extends Global(command.settings, reporter) {
- override protected def computeInternalPhases() : Unit = {
- phasesSet += syntaxAnalyzer
- phasesSet += analyzer.namerFactory
- phasesSet += analyzer.typerFactory
- }
- override def onlyPresentation = true
- }
- if (reporter.hasErrors) {
- reporter.flush()
- return
- }
- val run = new compiler.Run
- run compile command.files
- object generator extends DefaultDocDriver {
- lazy val global: compiler.type = compiler
- lazy val settings = docSettings
- }
- generator process run.units
- reporter.printSummary()
- } catch {
- case ex @ FatalError(msg) =>
- if (command.settings.debug.value)
- ex.printStackTrace();
- reporter.error(null, "fatal error: " + msg)
- }
- }
- def main(args: Array[String]) {
- process(args)
- exit(if (reporter.hasErrors) 1 else 0)
- }
- // main returning a status (no exit code)
- def main0(args: Array[String]): Boolean = {
- process(args)
- !reporter.hasErrors
- }
- }
-
- private def createDir(parent: File, dirname: String): File = {
- val outDir = new File(parent, dirname)
- outDir.mkdir
- outDir
- }
-
- private val code1 = """
-package examples
-
-abstract class C0 {
- def foo_public
- protected def foo_protected
- private def foo_private {}
- class C1_Public {
- val x_public = ()
- protected val x_protected = ()
- private val x_private = ()
- }
- protected class C1_Protected {
- val x_public = ()
- protected val x_protected = ()
- private val x_private = ()
- }
- private class C1_Private {
- val x_public = ()
- protected val x_protected = ()
- private val x_private = ()
- }
-}
-
-protected abstract class C0_Protected {
- def foo_public
- protected def foo_protected
- private def foo_private {}
- class C1_Public {
- val x_public = ()
- protected val x_protected = ()
- private val x_private = ()
- }
- protected class C1_Protected {
- val x_public = ()
- protected val x_protected = ()
- private val x_private = ()
- }
- private class C1_Private {
- val x_public = ()
- protected val x_protected = ()
- private val x_private = ()
- }
-}
-
-private abstract class C0_Private {
- def foo_public
- protected def foo_protected
- private def foo_private {}
- class C1_Public {
- val x_public = ()
- protected val x_protected = ()
- private val x_private = ()
- }
- protected class C1_Protected {
- val x_public = ()
- protected val x_protected = ()
- private val x_private = ()
- }
- private class C1_Private {
- val x_public = ()
- protected val x_protected = ()
- private val x_private = ()
- }
-}
-
-
-object obj0 {
- def bar_public {}
- protected def bar_protected {}
- private def bar_private {}
- object obj1_Public {
- val x_public = ()
- protected val x_protected = ()
- private val x_private = ()
- }
- protected object obj1_Protected {
- val x_public = ()
- protected val x_protected = ()
- private val x_private = ()
- }
- private object obj1_Private {
- val x_public = ()
- protected val x_protected = ()
- private val x_private = ()
- }
-}
-
-protected object obj0_Protected {
- def bar_public {}
- protected def bar_protected {}
- private def bar_private {}
- object obj1_Public {
- val x_public = ()
- protected val x_protected = ()
- private val x_private = ()
- }
- protected object obj1_Protected {
- val x_public = ()
- protected val x_protected = ()
- private val x_private = ()
- }
- private object obj1_Private {
- val x_public = ()
- protected val x_protected = ()
- private val x_private = ()
- }
-}
-
-private object obj0_Private {
- def bar_public {}
- protected def bar_protected {}
- private def bar_private {}
- object obj1_Public {
- val x_public = ()
- protected val x_protected = ()
- private val x_private = ()
- }
- protected object obj1_Protected {
- val x_public = ()
- protected val x_protected = ()
- private val x_private = ()
- }
- private object obj1_Private {
- val x_public = ()
- protected val x_protected = ()
- private val x_private = ()
- }
-}
-"""
-}
diff --git a/test/files/run/manifests.scala b/test/files/run/manifests.scala
new file mode 100644
index 0000000000..ed6efab70d
--- /dev/null
+++ b/test/files/run/manifests.scala
@@ -0,0 +1,147 @@
+object Test
+{
+ object Variances extends Enumeration {
+ val CO, IN, CONTRA = Value
+ }
+ import Variances.{ CO, IN, CONTRA }
+
+ object SubtypeRelationship extends Enumeration {
+ val NONE, SAME, SUB, SUPER = Value
+ }
+ import SubtypeRelationship.{ NONE, SAME, SUB, SUPER }
+
+ class VarianceTester[T, U, CC[_]](expected: Variances.Value)(
+ implicit ev1: Manifest[T], ev2: Manifest[U], ev3: Manifest[CC[T]], ev4: Manifest[CC[U]]) {
+
+ def elements = List(ev1 <:< ev2, ev2 <:< ev1)
+ def containers = List(ev3 <:< ev4, ev4 <:< ev3)
+
+ def isUnrelated = typeCompare[T, U] == NONE
+ def isSame = typeCompare[T, U] == SAME
+ def isSub = typeCompare[T, U] == SUB
+ def isSuper = typeCompare[T, U] == SUPER
+
+ def showsCovariance = (elements == containers)
+ def showsContravariance = (elements == containers.reverse)
+ def showsInvariance = containers forall (_ == isSame)
+
+ def allContainerVariances = List(showsCovariance, showsInvariance, showsContravariance)
+
+ def showsExpectedVariance =
+ if (isUnrelated) allContainerVariances forall (_ == false)
+ else if (isSame) allContainerVariances forall (_ == true)
+ else expected match {
+ case CO => showsCovariance && !showsContravariance && !showsInvariance
+ case IN => showsInvariance && !showsCovariance && !showsContravariance
+ case CONTRA => showsContravariance && !showsCovariance && !showsInvariance
+ }
+ }
+
+ def showsCovariance[T, U, CC[_]](implicit ev1: Manifest[T], ev2: Manifest[U], ev3: Manifest[CC[T]], ev4: Manifest[CC[U]]) =
+ new VarianceTester[T, U, CC](CO) showsExpectedVariance
+
+ def showsInvariance[T, U, CC[_]](implicit ev1: Manifest[T], ev2: Manifest[U], ev3: Manifest[CC[T]], ev4: Manifest[CC[U]]) =
+ new VarianceTester[T, U, CC](IN) showsExpectedVariance
+
+ def showsContravariance[T, U, CC[_]](implicit ev1: Manifest[T], ev2: Manifest[U], ev3: Manifest[CC[T]], ev4: Manifest[CC[U]]) =
+ new VarianceTester[T, U, CC](CONTRA) showsExpectedVariance
+
+ def typeCompare[T, U](implicit ev1: Manifest[T], ev2: Manifest[U]) = (ev1 <:< ev2, ev2 <:< ev1) match {
+ case (true, true) => SAME
+ case (true, false) => SUB
+ case (false, true) => SUPER
+ case (false, false) => NONE
+ }
+
+ def assertAnyRef[T: Manifest] = List(
+ manifest[T] <:< manifest[Any],
+ manifest[T] <:< manifest[AnyRef],
+ !(manifest[T] <:< manifest[AnyVal])
+ ) foreach (assert(_, "assertAnyRef"))
+
+ def assertAnyVal[T: Manifest] = List(
+ manifest[T] <:< manifest[Any],
+ !(manifest[T] <:< manifest[AnyRef]),
+ manifest[T] <:< manifest[AnyVal]
+ ) foreach (assert(_, "assertAnyVal"))
+
+ def assertSameType[T: Manifest, U: Manifest] = assert(typeCompare[T, U] == SAME, "assertSameType")
+ def assertSuperType[T: Manifest, U: Manifest] = assert(typeCompare[T, U] == SUPER, "assertSuperType")
+ def assertSubType[T: Manifest, U: Manifest] = assert(typeCompare[T, U] == SUB, "assertSubType")
+ def assertNoRelationship[T: Manifest, U: Manifest] = assert(typeCompare[T, U] == NONE, "assertNoRelationship")
+
+ def testVariancesVia[T: Manifest, U: Manifest] = assert(
+ typeCompare[T, U] == SUB &&
+ showsCovariance[T, U, List] &&
+ showsInvariance[T, U, Set],
+ "testVariancesVia"
+ )
+
+ def runAllTests = {
+ assertAnyVal[AnyVal]
+ assertAnyVal[Unit]
+ assertAnyVal[Int]
+ assertAnyVal[Double]
+ assertAnyVal[Boolean]
+ assertAnyVal[Char]
+
+ assertAnyRef[AnyRef]
+ assertAnyRef[java.lang.Object]
+ assertAnyRef[java.lang.Integer]
+ assertAnyRef[java.lang.Double]
+ assertAnyRef[java.lang.Boolean]
+ assertAnyRef[java.lang.Character]
+ assertAnyRef[String]
+ assertAnyRef[scala.List[String]]
+ assertAnyRef[scala.List[_]]
+
+ // variance doesn't work yet
+ // testVariancesVia[String, Any]
+ // testVariancesVia[String, AnyRef]
+
+ assertSubType[List[String], List[Any]]
+ assertSubType[List[String], List[AnyRef]]
+ assertNoRelationship[List[String], List[AnyVal]]
+
+ assertSubType[List[Int], List[Any]]
+ assertSubType[List[Int], List[AnyVal]]
+ assertNoRelationship[List[Int], List[AnyRef]]
+
+ // Nothing
+ assertSubType[Nothing, Any]
+ assertSubType[Nothing, AnyVal]
+ assertSubType[Nothing, AnyRef]
+ assertSubType[Nothing, String]
+ assertSubType[Nothing, List[String]]
+ assertSubType[Nothing, Null]
+ assertSameType[Nothing, Nothing]
+
+ // Null
+ assertSubType[Null, Any]
+ assertNoRelationship[Null, AnyVal]
+ assertSubType[Null, AnyRef]
+ assertSubType[Null, String]
+ assertSubType[Null, List[String]]
+ assertSameType[Null, Null]
+ assertSuperType[Null, Nothing]
+
+ // Any
+ assertSameType[Any, Any]
+ assertSuperType[Any, AnyVal]
+ assertSuperType[Any, AnyRef]
+ assertSuperType[Any, String]
+ assertSuperType[Any, List[String]]
+ assertSuperType[Any, Null]
+ assertSuperType[Any, Nothing]
+
+ // Misc unrelated types
+ assertNoRelationship[Unit, AnyRef]
+ assertNoRelationship[Unit, Int]
+ assertNoRelationship[Int, Long]
+ assertNoRelationship[Boolean, String]
+ assertNoRelationship[List[Boolean], List[String]]
+ assertNoRelationship[Set[Boolean], Set[String]]
+ }
+
+ def main(args: Array[String]): Unit = runAllTests
+}
diff --git a/test/files/run/names-defaults.scala b/test/files/run/names-defaults.scala
index 0d4f3df42e..12176105cd 100644
--- a/test/files/run/names-defaults.scala
+++ b/test/files/run/names-defaults.scala
@@ -268,6 +268,21 @@ object Test extends Application {
// #2489
class A2489 { def foo { def bar(a: Int = 1) = a; bar(); val u = 0 } }
+ // a bug reported on the mailing lists, related to #2489
+ class Test2489 {
+ def foo(): Int = {
+ val i = 10
+ case class Foo(j: Int)
+ i
+ }
+ }
+
+ // #2784
+ class Test2784 {
+ object t { def f(x: Int) = x }
+ val one = t f (x = 1)
+ }
+
// DEFINITIONS
def test1(a: Int, b: String) = println(a +": "+ b)
def test2(u: Int, v: Int)(k: String, l: Int) = println(l +": "+ k +", "+ (u + v))
diff --git a/test/files/run/sequenceComparisons.scala b/test/files/run/sequenceComparisons.scala
index 30192096db..e674d55bf7 100644
--- a/test/files/run/sequenceComparisons.scala
+++ b/test/files/run/sequenceComparisons.scala
@@ -52,14 +52,14 @@ object Test {
val endsWithInputs: Inputs
lazy val endsWith = Method(_ endsWith _, endsWithInputs, "%s endsWith %s")
- val indexOfSeqInputs: Inputs
- private def subseqTest(s1: Seq[T], s2: Seq[T]) = (s1 indexOfSeq s2) != -1
- lazy val indexOfSeq = Method(subseqTest _, indexOfSeqInputs, "(%s indexOfSeq %s) != -1")
+ val indexOfSliceInputs: Inputs
+ private def subseqTest(s1: Seq[T], s2: Seq[T]) = (s1 indexOfSlice s2) != -1
+ lazy val indexOfSlice = Method(subseqTest _, indexOfSliceInputs, "(%s indexOfSlice %s) != -1")
val sameElementsInputs: Inputs
lazy val sameElements = Method(_ sameElements _, sameElementsInputs, "%s sameElements %s")
- def methodList = List(eqeq, startsWith, endsWith, indexOfSeq, sameElements)
+ def methodList = List(eqeq, startsWith, endsWith, indexOfSlice, sameElements)
}
object test1 extends Data[Int] {
@@ -75,7 +75,7 @@ object Test {
List(0 :: seq, List(5,2,3,4,5), List(3,4), List(5,6))
)
- val indexOfSeqInputs = (
+ val indexOfSliceInputs = (
List(Nil, List(1), List(3), List(5), List(1,2), List(2,3,4), List(4,5), seq),
List(List(1,2,3,5), List(6), List(5,4,3,2,1), List(2,1))
)
diff --git a/test/files/run/t1167.check b/test/files/run/t1167.check
new file mode 100644
index 0000000000..885d4c9e26
--- /dev/null
+++ b/test/files/run/t1167.check
@@ -0,0 +1,3 @@
+$anon$1
+$anon$2
+$anonfun$testFunc$1
diff --git a/test/files/run/t1167.scala b/test/files/run/t1167.scala
new file mode 100644
index 0000000000..25e42ffd4d
--- /dev/null
+++ b/test/files/run/t1167.scala
@@ -0,0 +1,25 @@
+/** Tests for compatible InnerClasses attribute between trait and
+ * impl classes, as well as anonymous classes.
+ */
+
+trait Test1 {
+ def testFunc(i:Int): Unit = {
+ (i:Int) => i + 5
+ }
+}
+
+abstract class Foo {
+ override def toString = getClass.getSimpleName
+
+ abstract class Bar {
+ override def toString = getClass.getSimpleName
+ }
+}
+
+object Test extends Application {
+ val foo = new Foo {}
+ val bar = new foo.Bar {}
+ println(foo)
+ println(bar)
+ println(Class.forName("Test1$$anonfun$testFunc$1").getSimpleName)
+}
diff --git a/test/files/run/t1323.scala b/test/files/run/t1323.scala
index d84239a12c..89676c888b 100644
--- a/test/files/run/t1323.scala
+++ b/test/files/run/t1323.scala
@@ -1,25 +1,25 @@
object Test extends Application {
- println(" 1:" + List(1,2,3,4).indexOfSeq(List(0,1))) // -1
- println(" 2:" + List(1,2,3,4).indexOfSeq(List(1,2))) // 0
- println(" 3:" + List(1,2,3,4).indexOfSeq(List(2,3))) // 1
- println(" 4:" + List(1,2,3,4).indexOfSeq(List(3,4))) // 2
- println(" 5:" + List(1,2,3,4).indexOfSeq(List(4,5))) // -1
- println(" 6:" + List(1,2,3,4).indexOfSeq(List(2,4))) // -1
- println(" 7:" + List(1,2,3,4).indexOfSeq(List(4,3))) // -1
- println(" 8:" + List(1,2,3,4).indexOfSeq(List(1,3))) // -1
- println(" 9:" + List(1,2,3,4).indexOfSeq(List(1,3))) // -1
- println("10:" + List(1,2,3,4).indexOfSeq(List(1,2,3,4))) // 0
- println("11:" + List(1,2,3,4).indexOfSeq(List(4,3,2,1))) // -1
- println("12:" + List(1,2,3,4).indexOfSeq(List(1,2,3,4,5))) // -1
- println("13:" + List(1,2,3,4).indexOfSeq(List(5,4,3,2,1))) // -1
- println("14:" + List(1,2,3,4).indexOfSeq(List())) // 0
- println("15:" + List().indexOfSeq(List())) // 0
- println("16:" + List().indexOfSeq(List(1,2,3,4))) // -1
+ println(" 1:" + List(1,2,3,4).indexOfSlice(List(0,1))) // -1
+ println(" 2:" + List(1,2,3,4).indexOfSlice(List(1,2))) // 0
+ println(" 3:" + List(1,2,3,4).indexOfSlice(List(2,3))) // 1
+ println(" 4:" + List(1,2,3,4).indexOfSlice(List(3,4))) // 2
+ println(" 5:" + List(1,2,3,4).indexOfSlice(List(4,5))) // -1
+ println(" 6:" + List(1,2,3,4).indexOfSlice(List(2,4))) // -1
+ println(" 7:" + List(1,2,3,4).indexOfSlice(List(4,3))) // -1
+ println(" 8:" + List(1,2,3,4).indexOfSlice(List(1,3))) // -1
+ println(" 9:" + List(1,2,3,4).indexOfSlice(List(1,3))) // -1
+ println("10:" + List(1,2,3,4).indexOfSlice(List(1,2,3,4))) // 0
+ println("11:" + List(1,2,3,4).indexOfSlice(List(4,3,2,1))) // -1
+ println("12:" + List(1,2,3,4).indexOfSlice(List(1,2,3,4,5))) // -1
+ println("13:" + List(1,2,3,4).indexOfSlice(List(5,4,3,2,1))) // -1
+ println("14:" + List(1,2,3,4).indexOfSlice(List())) // 0
+ println("15:" + List().indexOfSlice(List())) // 0
+ println("16:" + List().indexOfSlice(List(1,2,3,4))) // -1
// Do some testing with infinite sequences
def from(n: Int): Stream[Int] = Stream.cons(n, from(n + 1))
- println("17:" + List(1,2,3,4).indexOfSeq(from(1))) // -1
- println("18:" + from(1).indexOfSeq(List(4,5,6))) // 3
+ println("17:" + List(1,2,3,4).indexOfSlice(from(1))) // -1
+ println("18:" + from(1).indexOfSlice(List(4,5,6))) // 3
}
diff --git a/test/files/run/t2754.scala b/test/files/run/t2754.scala
new file mode 100644
index 0000000000..aeb5259dab
--- /dev/null
+++ b/test/files/run/t2754.scala
@@ -0,0 +1,39 @@
+object Test {
+ def main(args: Array[String]) {
+ val v: FooBarPlus[Int] = new FooBarPlusImpl()
+ v.foo += 10
+ }
+}
+
+trait Foo[P] {
+ def foo: P
+}
+
+trait FooBar[P] extends Foo[P] {
+ def bar: P
+}
+
+trait FooBarPlus[P] extends FooBar[P] {
+ override def foo: P
+ override def bar: P
+
+ def foo_=(x: P)
+ def bar_=(x: P)
+}
+
+class FooImpl extends Foo[Int] {
+ def foo = 1
+}
+
+class FooBarImpl extends FooImpl with FooBar[Int] {
+ protected var f = 0
+ protected var b = 0
+
+ override def foo = f
+ def bar = b
+}
+
+class FooBarPlusImpl extends FooBarImpl with FooBarPlus[Int] {
+ def foo_=(x: Int) { f = x }
+ def bar_=(x: Int) { b = x }
+}
diff --git a/test/files/scalap/caseClass/result.test b/test/files/scalap/caseClass/result.test
index 9ea19f7e9d..cabf321a07 100644
--- a/test/files/scalap/caseClass/result.test
+++ b/test/files/scalap/caseClass/result.test
@@ -1,4 +1,4 @@
-case class CaseClass[A >: scala.Nothing <: scala.Seq[scala.Int]] extends java.lang.Object with scala.ScalaObject with scala.Product {
+case class CaseClass[A >: scala.Nothing <: scala.Seq[scala.Int]](i : A, s : scala.Predef.String) extends java.lang.Object with scala.ScalaObject with scala.Product {
val i : A = { /* compiled code */ }
val s : scala.Predef.String = { /* compiled code */ }
def foo : scala.Int = { /* compiled code */ }
@@ -12,4 +12,4 @@ case class CaseClass[A >: scala.Nothing <: scala.Seq[scala.Int]] extends java.la
override def productArity : scala.Int = { /* compiled code */ }
override def productElement(x$1 : scala.Int) : scala.Any = { /* compiled code */ }
override def canEqual(x$1 : scala.Any) : scala.Boolean = { /* compiled code */ }
-}
+} \ No newline at end of file