summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAleksandar Prokopec <axel22@gmail.com>2012-04-02 13:16:09 +0200
committerAleksandar Prokopec <axel22@gmail.com>2012-04-02 13:16:09 +0200
commitde3bd754676fbed0b6c69ca3d676b72bc276e925 (patch)
tree1d18a7f8c193fda503d63d286ddcf561842d1091 /test
parentc14766c1affe968788c77fea45ae042d71038472 (diff)
parentf7535f72903f083b2444fb1d0b73363efa5482e9 (diff)
downloadscala-de3bd754676fbed0b6c69ca3d676b72bc276e925.tar.gz
scala-de3bd754676fbed0b6c69ca3d676b72bc276e925.tar.bz2
scala-de3bd754676fbed0b6c69ca3d676b72bc276e925.zip
Merge branch 'master' into feature/collection-concurrent
Conflicts: src/library/scala/collection/JavaConversions.scala src/library/scala/collection/JavaConverters.scala Add one test for concurrent map conversion.
Diffstat (limited to 'test')
-rw-r--r--test/files/jvm/scala-concurrent-tck.scala4
-rw-r--r--test/files/neg/override-object-flag.check2
-rw-r--r--test/files/neg/override-object-no.check2
-rw-r--r--test/files/neg/saferJavaConversions.check6
-rw-r--r--test/files/neg/saferJavaConversions.scala20
-rw-r--r--test/files/neg/t1364.check2
-rw-r--r--test/files/neg/t1477.check2
-rw-r--r--test/files/neg/t2070.check3
-rw-r--r--test/files/neg/t3015.check2
-rw-r--r--test/files/neg/t3481.check6
-rw-r--r--test/files/neg/t4044.check9
-rw-r--r--test/files/neg/t4515.check2
-rw-r--r--test/files/neg/t4987.check4
-rw-r--r--test/files/neg/t4987.scala2
-rw-r--r--test/files/neg/t5063.check4
-rw-r--r--test/files/neg/t5063.scala3
-rw-r--r--test/files/neg/t5152.check6
-rw-r--r--test/files/neg/t5189b.check11
-rw-r--r--test/files/neg/t5189b.scala18
-rw-r--r--test/files/neg/t5580a.check6
-rw-r--r--test/files/neg/t5580a.scala11
-rw-r--r--test/files/neg/t5589neg.check37
-rw-r--r--test/files/neg/t5589neg.scala6
-rw-r--r--test/files/neg/t5589neg2.check9
-rw-r--r--test/files/neg/t5589neg2.scala13
-rw-r--r--test/files/neg/t708.check2
-rw-r--r--test/files/neg/t742.check3
-rw-r--r--test/files/neg/t961.check2
-rw-r--r--test/files/neg/tcpoly_override.check3
-rw-r--r--test/files/neg/tcpoly_typealias.check9
-rw-r--r--test/files/neg/tcpoly_variance_enforce.check34
-rw-r--r--test/files/neg/valueclasses.check5
-rw-r--r--test/files/neg/valueclasses.scala23
-rw-r--r--test/files/pos/irrefutable.scala22
-rw-r--r--test/files/pos/lookupswitch.scala37
-rw-r--r--test/files/pos/t1336.scala10
-rw-r--r--test/files/pos/t4545.scala14
-rw-r--r--test/files/pos/t5580b.scala19
-rw-r--r--test/files/pos/t5589.scala22
-rw-r--r--test/files/pos/t5604/ReplConfig.scala53
-rw-r--r--test/files/pos/t5604/ReplReporter.scala30
-rw-r--r--test/files/pos/virtpatmat_anonfun_for.flags1
-rw-r--r--test/files/pos/virtpatmat_anonfun_for.scala8
-rw-r--r--test/files/pos/virtpatmat_exist4.scala35
-rw-r--r--test/files/pos/virtpatmat_instof_valuetype.flags1
-rw-r--r--test/files/pos/virtpatmat_instof_valuetype.scala8
-rw-r--r--test/files/presentation/callcc-interpreter.check2
-rw-r--r--test/files/presentation/shutdown-deadlock/ShutdownDeadlockTest.scala2
-rw-r--r--test/files/run/concurrent-map-conversions.scala36
-rw-r--r--test/files/run/delay-bad.check47
-rw-r--r--test/files/run/delay-bad.scala77
-rw-r--r--test/files/run/delay-good.check41
-rw-r--r--test/files/run/delay-good.scala77
-rw-r--r--test/files/run/existentials-in-compiler.check104
-rw-r--r--test/files/run/finalvar.check6
-rw-r--r--test/files/run/finalvar.flags1
-rw-r--r--test/files/run/finalvar.scala37
-rw-r--r--test/files/run/lift-and-unlift.scala6
-rw-r--r--test/files/run/reify_ann1a.check4
-rw-r--r--test/files/run/reify_ann1b.check4
-rw-r--r--test/files/run/si4750.check1
-rw-r--r--test/files/run/si4750.scala7
-rw-r--r--test/files/run/t4574.check2
-rw-r--r--test/files/run/t4574.scala13
-rw-r--r--test/files/run/valueclasses-constr.check10
-rw-r--r--test/files/run/valueclasses-constr.scala84
-rw-r--r--test/files/run/virtpatmat_extends_product.check1
-rw-r--r--test/files/run/virtpatmat_extends_product.flags1
-rw-r--r--test/files/run/virtpatmat_extends_product.scala11
-rw-r--r--test/files/run/virtpatmat_partial.check17
-rw-r--r--test/files/run/virtpatmat_partial.scala257
-rw-r--r--test/files/run/virtpatmat_tailcalls_verifyerror.check1
-rw-r--r--test/files/run/virtpatmat_tailcalls_verifyerror.flags1
-rw-r--r--test/files/run/virtpatmat_tailcalls_verifyerror.scala14
-rw-r--r--test/files/scalacheck/t2460.scala32
-rw-r--r--test/pending/pos/t1476.scala23
-rw-r--r--test/pending/pos/t5626.scala12
-rw-r--r--test/pending/run/implicit-classes.scala17
-rw-r--r--test/pending/run/t5629.check2
-rw-r--r--test/pending/run/t5629.scala25
-rw-r--r--test/pending/run/virtpatmat_anonfun_underscore.check0
-rw-r--r--test/pending/run/virtpatmat_anonfun_underscore.flags1
-rw-r--r--test/pending/run/virtpatmat_anonfun_underscore.scala4
-rw-r--r--test/scaladoc/resources/code-indent.scala37
-rw-r--r--test/scaladoc/run/SI-5373.check1
-rw-r--r--test/scaladoc/run/SI-5373.scala34
-rw-r--r--test/scaladoc/scala/html.flags1
-rw-r--r--test/scaladoc/scalacheck/CommentFactoryTest.scala (renamed from test/scaladoc/scala/model/CommentFactoryTest.scala)0
-rw-r--r--test/scaladoc/scalacheck/HtmlFactoryTest.flags (renamed from test/scaladoc/scala/html/HtmlFactoryTest.flags)0
-rw-r--r--test/scaladoc/scalacheck/HtmlFactoryTest.scala (renamed from test/scaladoc/scala/html/HtmlFactoryTest.scala)36
-rw-r--r--test/scaladoc/scalacheck/IndexScriptTest.scala (renamed from test/scaladoc/scala/IndexScriptTest.scala)2
-rw-r--r--test/scaladoc/scalacheck/IndexTest.scala (renamed from test/scaladoc/scala/IndexTest.scala)2
92 files changed, 1382 insertions, 242 deletions
diff --git a/test/files/jvm/scala-concurrent-tck.scala b/test/files/jvm/scala-concurrent-tck.scala
index ba7dffbcb0..75e2b92ff6 100644
--- a/test/files/jvm/scala-concurrent-tck.scala
+++ b/test/files/jvm/scala-concurrent-tck.scala
@@ -13,7 +13,7 @@ import scala.concurrent.promise
import scala.concurrent.blocking
import scala.util.{ Try, Success, Failure }
-import scala.util.Duration
+import scala.concurrent.util.Duration
trait TestBase {
@@ -74,7 +74,7 @@ trait FutureCallbacks extends TestBase {
done()
throw new Exception
}
- f onSuccess {
+ f onSuccess {
case _ => assert(false)
}
}
diff --git a/test/files/neg/override-object-flag.check b/test/files/neg/override-object-flag.check
index 152d31ff8a..344165138d 100644
--- a/test/files/neg/override-object-flag.check
+++ b/test/files/neg/override-object-flag.check
@@ -1,4 +1,4 @@
-override-object-flag.scala:3: error: overriding object Foo in trait A of type object B.this.Foo;
+override-object-flag.scala:3: error: overriding object Foo in trait A;
object Foo cannot override final member
trait B extends A { override object Foo }
^
diff --git a/test/files/neg/override-object-no.check b/test/files/neg/override-object-no.check
index f9fb37381b..52bad2b937 100644
--- a/test/files/neg/override-object-no.check
+++ b/test/files/neg/override-object-no.check
@@ -10,7 +10,7 @@ an overriding object must conform to the overridden object's class bound;
required: Object{def g: Int}
trait Quux2 extends Quux1 { override object Bar { def g = "abc" } } // err
^
-override-object-no.scala:25: error: overriding object Bar in trait Quux3 of type object Quux4.this.Bar;
+override-object-no.scala:25: error: overriding object Bar in trait Quux3;
object Bar cannot override final member
trait Quux4 extends Quux3 { override object Bar } // err
^
diff --git a/test/files/neg/saferJavaConversions.check b/test/files/neg/saferJavaConversions.check
new file mode 100644
index 0000000000..0e53d2c437
--- /dev/null
+++ b/test/files/neg/saferJavaConversions.check
@@ -0,0 +1,6 @@
+saferJavaConversions.scala:13: error: type mismatch;
+ found : String("a")
+ required: Foo
+ val v = map.get("a") // now this is a type error
+ ^
+one error found
diff --git a/test/files/neg/saferJavaConversions.scala b/test/files/neg/saferJavaConversions.scala
new file mode 100644
index 0000000000..f0611204e6
--- /dev/null
+++ b/test/files/neg/saferJavaConversions.scala
@@ -0,0 +1,20 @@
+
+case class Foo(s: String)
+
+object Test {
+ def f1 = {
+ import scala.collection.JavaConversions._
+ val map: Map[Foo, String] = Map(Foo("a") -> "a", Foo("b") -> "b")
+ val v = map.get("a") // should be a type error, actually returns null
+ }
+ def f2 = {
+ import scala.collection.convert.wrapAsScala._
+ val map: Map[Foo, String] = Map(Foo("a") -> "a", Foo("b") -> "b")
+ val v = map.get("a") // now this is a type error
+ }
+ def f3 = {
+ import scala.collection.convert.wrapAsJava._
+ val map: Map[Foo, String] = Map(Foo("a") -> "a", Foo("b") -> "b")
+ val v = map.get("a")
+ }
+}
diff --git a/test/files/neg/t1364.check b/test/files/neg/t1364.check
index 78375333c2..cb8803abdc 100644
--- a/test/files/neg/t1364.check
+++ b/test/files/neg/t1364.check
@@ -1,4 +1,4 @@
-t1364.scala:9: error: overriding type T in trait A with bounds >: Nothing <: AnyRef{type S[-U]};
+t1364.scala:9: error: overriding type T in trait A with bounds <: AnyRef{type S[-U]};
type T has incompatible type
type T = { type S[U] = U }
^
diff --git a/test/files/neg/t1477.check b/test/files/neg/t1477.check
index e497637857..72bffa3270 100644
--- a/test/files/neg/t1477.check
+++ b/test/files/neg/t1477.check
@@ -1,4 +1,4 @@
-t1477.scala:13: error: overriding type V in trait C with bounds >: Nothing <: Middle.this.D;
+t1477.scala:13: error: overriding type V in trait C with bounds <: Middle.this.D;
type V is a volatile type; cannot override a type with non-volatile upper bound
type V <: (D with U)
^
diff --git a/test/files/neg/t2070.check b/test/files/neg/t2070.check
index bd049409a8..ef1d08f7b7 100644
--- a/test/files/neg/t2070.check
+++ b/test/files/neg/t2070.check
@@ -1,5 +1,6 @@
t2070.scala:8: error: The kind of trait T does not conform to the expected kind of type T[X] in trait A.
-t2070.B.T's type parameters do not match type T's expected parameters: type X (in object B) has one type parameter, but type X (in trait A) has none
+t2070.B.T's type parameters do not match type T's expected parameters:
+type X (in object B) has one type parameter, but type X (in trait A) has none
trait T[X[_]]
^
one error found
diff --git a/test/files/neg/t3015.check b/test/files/neg/t3015.check
index 53221b7ca0..6948392bb0 100644
--- a/test/files/neg/t3015.check
+++ b/test/files/neg/t3015.check
@@ -1,5 +1,5 @@
t3015.scala:7: error: scrutinee is incompatible with pattern type;
- found : _$1 where type +_$1
+ found : _$1
required: String
val b(foo) = "foo"
^
diff --git a/test/files/neg/t3481.check b/test/files/neg/t3481.check
index 48e6ff357b..debe07275b 100644
--- a/test/files/neg/t3481.check
+++ b/test/files/neg/t3481.check
@@ -1,17 +1,17 @@
t3481.scala:5: error: type mismatch;
found : String("hello")
- required: _$1 where type +_$1
+ required: _$1
f[A[Int]]("hello")
^
t3481.scala:11: error: type mismatch;
- found : _$2 where type +_$2
+ found : _$2
required: b.T
(which expands to) _$2
def f[T <: B[_]](a: T#T, b: T) = b.m(a)
^
t3481.scala:12: error: type mismatch;
found : String("Hello")
- required: _$2 where type +_$2
+ required: _$2
f("Hello", new B[Int])
^
t3481.scala:18: error: type mismatch;
diff --git a/test/files/neg/t4044.check b/test/files/neg/t4044.check
index 75dcf63bfe..41a04f69b9 100644
--- a/test/files/neg/t4044.check
+++ b/test/files/neg/t4044.check
@@ -2,15 +2,18 @@ t4044.scala:9: error: AnyRef takes no type parameters, expected: one
M[AnyRef] // error, (AnyRef :: *) not kind-conformant to (N :: * -> * -> *)
^
t4044.scala:9: error: kinds of the type arguments (<error>) do not conform to the expected kinds of the type parameters (type N).
-<error>'s type parameters do not match type N's expected parameters: <none> has no type parameters, but type N has one
+<error>'s type parameters do not match type N's expected parameters:
+<none> has no type parameters, but type N has one
M[AnyRef] // error, (AnyRef :: *) not kind-conformant to (N :: * -> * -> *)
^
t4044.scala:11: error: kinds of the type arguments (Test.A) do not conform to the expected kinds of the type parameters (type N).
-Test.A's type parameters do not match type N's expected parameters: type _ has no type parameters, but type O has one
+Test.A's type parameters do not match type N's expected parameters:
+type _ has no type parameters, but type O has one
M[A] // error, (A :: (* -> *) not kind-conformant to (N :: * -> * -> *)
^
t4044.scala:15: error: kinds of the type arguments (Test.C) do not conform to the expected kinds of the type parameters (type N).
-Test.C's type parameters do not match type N's expected parameters: type _ has one type parameter, but type _ has none
+Test.C's type parameters do not match type N's expected parameters:
+type _ has one type parameter, but type _ has none
M[C] // error, (C :: (* -> * -> * -> *) not kind-conformant to (N :: * -> * -> *)
^
four errors found
diff --git a/test/files/neg/t4515.check b/test/files/neg/t4515.check
index ce5350b35f..a60d16295f 100644
--- a/test/files/neg/t4515.check
+++ b/test/files/neg/t4515.check
@@ -1,6 +1,6 @@
t4515.scala:37: error: type mismatch;
found : _0(in value $anonfun) where type _0(in value $anonfun)
- required: (some other)_0(in value $anonfun) where type +(some other)_0(in value $anonfun)
+ required: (some other)_0(in value $anonfun)
handler.onEvent(target, ctx.getEvent, node, ctx)
^
one error found
diff --git a/test/files/neg/t4987.check b/test/files/neg/t4987.check
new file mode 100644
index 0000000000..8d7344d27b
--- /dev/null
+++ b/test/files/neg/t4987.check
@@ -0,0 +1,4 @@
+t4987.scala:2: error: constructor Foo2 in class Foo2 cannot be accessed in object Bar2
+object Bar2 { new Foo2(0, 0) }
+ ^
+one error found
diff --git a/test/files/neg/t4987.scala b/test/files/neg/t4987.scala
new file mode 100644
index 0000000000..e55acd4127
--- /dev/null
+++ b/test/files/neg/t4987.scala
@@ -0,0 +1,2 @@
+class Foo2 private (a: Int, b: Int)
+object Bar2 { new Foo2(0, 0) }
diff --git a/test/files/neg/t5063.check b/test/files/neg/t5063.check
new file mode 100644
index 0000000000..84690d0a1d
--- /dev/null
+++ b/test/files/neg/t5063.check
@@ -0,0 +1,4 @@
+t5063.scala:2: error: value + is not a member of Object
+ super.+("")
+ ^
+one error found
diff --git a/test/files/neg/t5063.scala b/test/files/neg/t5063.scala
new file mode 100644
index 0000000000..5b34b53fb7
--- /dev/null
+++ b/test/files/neg/t5063.scala
@@ -0,0 +1,3 @@
+class A {
+ super.+("")
+}
diff --git a/test/files/neg/t5152.check b/test/files/neg/t5152.check
index 80e0141b64..fd510dbae0 100644
--- a/test/files/neg/t5152.check
+++ b/test/files/neg/t5152.check
@@ -1,9 +1,11 @@
t5152.scala:7: error: kinds of the type arguments (Test.B) do not conform to the expected kinds of the type parameters (type E) in class A.
-Test.B's type parameters do not match type E's expected parameters: type E has one type parameter, but type _ has none
+Test.B's type parameters do not match type E's expected parameters:
+type E has one type parameter, but type _ has none
class B[E[_]] extends A[B] { } // B is depth 2 but A requires 1
^
t5152.scala:11: error: kinds of the type arguments (Test.B1) do not conform to the expected kinds of the type parameters (type E) in class A1.
-Test.B1's type parameters do not match type E's expected parameters: type _ has no type parameters, but type G has one
+Test.B1's type parameters do not match type E's expected parameters:
+type _ has no type parameters, but type G has one
class B1[E[_]] extends A1[B1] // B1 is depth 2 but A1 requires 3
^
two errors found
diff --git a/test/files/neg/t5189b.check b/test/files/neg/t5189b.check
index 7f78cbb438..46996e96d0 100644
--- a/test/files/neg/t5189b.check
+++ b/test/files/neg/t5189b.check
@@ -1,8 +1,11 @@
-t5189b.scala:25: error: type mismatch;
- found : TestNeg.Wrapped[?T2] where type ?T2 <: T
+t5189b.scala:38: error: type mismatch;
+ found : TestNeg.Wrapped[?T7] where type ?T7 <: T (this is a GADT skolem)
required: TestNeg.Wrapped[T]
-Note: ?T2 <: T, but class Wrapped is invariant in type W.
+Note: ?T7 <: T, but class Wrapped is invariant in type W.
You may wish to define W as +W instead. (SLS 4.5)
case Wrapper/*[_ <: T ]*/(wrapped) => wrapped // : Wrapped[_ <: T], which is a subtype of Wrapped[T] if and only if Wrapped is covariant in its type parameter
^
-one error found
+t5189b.scala:51: error: value foo is not a member of type parameter T
+ case Some(xs) => xs.foo // the error message should not refer to a skolem (testing extrapolation)
+ ^
+two errors found
diff --git a/test/files/neg/t5189b.scala b/test/files/neg/t5189b.scala
index 1750f14084..7c1871dc97 100644
--- a/test/files/neg/t5189b.scala
+++ b/test/files/neg/t5189b.scala
@@ -5,8 +5,21 @@ class TestPos {
def unwrap[T](x: AbsWrapperCov[T]): T = x match {
case Wrapper/*[_ <: T ]*/(x) => x // _ <: T, which is a subtype of T
}
+
+ def unwrapOption[T](x: Option[T]): T = x match {
+ case Some(xs) => xs
+ }
+
+
+ case class Down[+T](x: T)
+ case class Up[-T](f: T => Unit)
+
+ def f1[T](x1: Down[T])(x2: Up[T]) = ((x1, x2)) match {
+ case (Down(x), Up(f)) => f(x)
+ }
}
+
object TestNeg extends App {
class AbsWrapperCov[+A]
case class Wrapper[B](x: Wrapped[B]) extends AbsWrapperCov[B]
@@ -33,6 +46,11 @@ object TestNeg extends App {
// val w = new Wrapped(new A)
// unwrap[Any](Wrapper(w)).cell = new B
// w.cell.imNotAB
+
+ def unwrapOption[T](x: Option[T]): T = x match {
+ case Some(xs) => xs.foo // the error message should not refer to a skolem (testing extrapolation)
+ }
+
}
// class TestPos1 {
diff --git a/test/files/neg/t5580a.check b/test/files/neg/t5580a.check
new file mode 100644
index 0000000000..50a31857d5
--- /dev/null
+++ b/test/files/neg/t5580a.check
@@ -0,0 +1,6 @@
+t5580a.scala:9: error: polymorphic expression cannot be instantiated to expected type;
+ found : [A]scala.collection.mutable.Set[A]
+ required: scala.collection.mutable.Map[bar,scala.collection.mutable.Set[bar]]
+ if (map.get(tmp).isEmpty) map.put(tmp,collection.mutable.Set())
+ ^
+one error found
diff --git a/test/files/neg/t5580a.scala b/test/files/neg/t5580a.scala
new file mode 100644
index 0000000000..742f0e85ea
--- /dev/null
+++ b/test/files/neg/t5580a.scala
@@ -0,0 +1,11 @@
+import scala.collection.mutable.WeakHashMap
+
+class bar{ }
+class foo{
+ val map = WeakHashMap[AnyRef, collection.mutable.Map[bar, collection.mutable.Set[bar]]]()
+
+ def test={
+ val tmp:bar=null
+ if (map.get(tmp).isEmpty) map.put(tmp,collection.mutable.Set())
+ }
+}
diff --git a/test/files/neg/t5589neg.check b/test/files/neg/t5589neg.check
new file mode 100644
index 0000000000..b3ff16d7e4
--- /dev/null
+++ b/test/files/neg/t5589neg.check
@@ -0,0 +1,37 @@
+t5589neg.scala:2: warning: `withFilter' method does not yet exist on Either.RightProjection[Int,String], using `filter' method instead
+ def f5(x: Either[Int, String]) = for ((y1, y2: String) <- x.right) yield ((y1, y2))
+ ^
+t5589neg.scala:2: error: constructor cannot be instantiated to expected type;
+ found : (T1, T2)
+ required: String
+ def f5(x: Either[Int, String]) = for ((y1, y2: String) <- x.right) yield ((y1, y2))
+ ^
+t5589neg.scala:3: warning: `withFilter' method does not yet exist on Either.RightProjection[Int,String], using `filter' method instead
+ def f6(x: Either[Int, String]) = for ((y1, y2: Any) <- x.right) yield ((y1, y2))
+ ^
+t5589neg.scala:3: error: constructor cannot be instantiated to expected type;
+ found : (T1, T2)
+ required: String
+ def f6(x: Either[Int, String]) = for ((y1, y2: Any) <- x.right) yield ((y1, y2))
+ ^
+t5589neg.scala:4: error: constructor cannot be instantiated to expected type;
+ found : (T1,)
+ required: (String, Int)
+ def f7(x: Either[Int, (String, Int)]) = for (y1 @ Tuple1(y2) <- x.right) yield ((y1, y2))
+ ^
+t5589neg.scala:4: error: not found: value y2
+ def f7(x: Either[Int, (String, Int)]) = for (y1 @ Tuple1(y2) <- x.right) yield ((y1, y2))
+ ^
+t5589neg.scala:5: error: constructor cannot be instantiated to expected type;
+ found : (T1, T2, T3)
+ required: (String, Int)
+ def f8(x: Either[Int, (String, Int)]) = for ((y1, y2, y3) <- x.right) yield ((y1, y2))
+ ^
+t5589neg.scala:5: error: not found: value y1
+ def f8(x: Either[Int, (String, Int)]) = for ((y1, y2, y3) <- x.right) yield ((y1, y2))
+ ^
+t5589neg.scala:5: error: not found: value y2
+ def f8(x: Either[Int, (String, Int)]) = for ((y1, y2, y3) <- x.right) yield ((y1, y2))
+ ^
+two warnings found
+7 errors found
diff --git a/test/files/neg/t5589neg.scala b/test/files/neg/t5589neg.scala
new file mode 100644
index 0000000000..31ff2c3693
--- /dev/null
+++ b/test/files/neg/t5589neg.scala
@@ -0,0 +1,6 @@
+class A {
+ def f5(x: Either[Int, String]) = for ((y1, y2: String) <- x.right) yield ((y1, y2))
+ def f6(x: Either[Int, String]) = for ((y1, y2: Any) <- x.right) yield ((y1, y2))
+ def f7(x: Either[Int, (String, Int)]) = for (y1 @ Tuple1(y2) <- x.right) yield ((y1, y2))
+ def f8(x: Either[Int, (String, Int)]) = for ((y1, y2, y3) <- x.right) yield ((y1, y2))
+}
diff --git a/test/files/neg/t5589neg2.check b/test/files/neg/t5589neg2.check
new file mode 100644
index 0000000000..6af4955a83
--- /dev/null
+++ b/test/files/neg/t5589neg2.check
@@ -0,0 +1,9 @@
+t5589neg2.scala:7: error: constructor cannot be instantiated to expected type;
+ found : (T1, T2)
+ required: String
+ for (((((a, (b, (c, (d1, d2)))), es), fs), gs) <- x) yield (d :: es).mkString(", ") // not ok
+ ^
+t5589neg2.scala:7: error: not found: value d
+ for (((((a, (b, (c, (d1, d2)))), es), fs), gs) <- x) yield (d :: es).mkString(", ") // not ok
+ ^
+two errors found
diff --git a/test/files/neg/t5589neg2.scala b/test/files/neg/t5589neg2.scala
new file mode 100644
index 0000000000..b7c7ab7218
--- /dev/null
+++ b/test/files/neg/t5589neg2.scala
@@ -0,0 +1,13 @@
+class A {
+ def f1(x: List[((((Int, (Double, (Float, String))), List[String]), List[Int]), List[Float])]) = {
+ for (((((a, (b, (c, d))), es), fs), gs) <- x) yield (d :: es).mkString(", ") // ok
+ }
+
+ def f2(x: List[((((Int, (Double, (Float, String))), List[String]), List[Int]), List[Float])]) = {
+ for (((((a, (b, (c, (d1, d2)))), es), fs), gs) <- x) yield (d :: es).mkString(", ") // not ok
+ }
+
+ def f3(x: List[((((Int, (Double, (Float, String))), List[String]), List[Int]), List[Float])]) = {
+ for (((((a, (b, _)), es), fs), gs) <- x) yield (es ::: fs).mkString(", ") // ok
+ }
+} \ No newline at end of file
diff --git a/test/files/neg/t708.check b/test/files/neg/t708.check
index 15a9c9ed93..4983aab613 100644
--- a/test/files/neg/t708.check
+++ b/test/files/neg/t708.check
@@ -1,4 +1,4 @@
-t708.scala:8: error: overriding type S in trait X with bounds >: Nothing <: A.this.T;
+t708.scala:8: error: overriding type S in trait X with bounds <: A.this.T;
type S has incompatible type
override private[A] type S = Any;
^
diff --git a/test/files/neg/t742.check b/test/files/neg/t742.check
index f587948ef1..d355715442 100644
--- a/test/files/neg/t742.check
+++ b/test/files/neg/t742.check
@@ -1,5 +1,6 @@
t742.scala:5: error: kinds of the type arguments (Crash._1,Crash._2,Any) do not conform to the expected kinds of the type parameters (type m,type n,type z).
-Crash._1's type parameters do not match type m's expected parameters: type s1 has one type parameter, but type n has two
+Crash._1's type parameters do not match type m's expected parameters:
+type s1 has one type parameter, but type n has two
type p = mul[_1, _2, Any] // mul[_1, _1, Any] needs -Yrecursion
^
one error found
diff --git a/test/files/neg/t961.check b/test/files/neg/t961.check
index 48273f764d..14d39b0f42 100644
--- a/test/files/neg/t961.check
+++ b/test/files/neg/t961.check
@@ -1,4 +1,4 @@
-t961.scala:11: error: object Temp.B does not take parameters
+t961.scala:11: error: Temp.B.type does not take parameters
B() match {
^
one error found
diff --git a/test/files/neg/tcpoly_override.check b/test/files/neg/tcpoly_override.check
index 95529329e8..dbc3ff9461 100644
--- a/test/files/neg/tcpoly_override.check
+++ b/test/files/neg/tcpoly_override.check
@@ -1,5 +1,6 @@
tcpoly_override.scala:9: error: The kind of type T does not conform to the expected kind of type T[_] in trait A.
-C.this.T's type parameters do not match type T's expected parameters: type T (in class C) has no type parameters, but type T (in trait A) has one
+C.this.T's type parameters do not match type T's expected parameters:
+type T (in class C) has no type parameters, but type T (in trait A) has one
type T = B // This compiles well (@M: ... but it shouldn't)
^
one error found
diff --git a/test/files/neg/tcpoly_typealias.check b/test/files/neg/tcpoly_typealias.check
index 670add2c04..4beac0e440 100644
--- a/test/files/neg/tcpoly_typealias.check
+++ b/test/files/neg/tcpoly_typealias.check
@@ -1,13 +1,16 @@
tcpoly_typealias.scala:37: error: The kind of type m does not conform to the expected kind of type m[+x] in trait A.
-BInv.this.m's type parameters do not match type m's expected parameters: type x (in trait BInv) is invariant, but type x (in trait A) is declared covariant
+BInv.this.m's type parameters do not match type m's expected parameters:
+type x (in trait BInv) is invariant, but type x (in trait A) is declared covariant
type m[x] = FooCov[x] // error: invariant x in alias def
^
tcpoly_typealias.scala:41: error: The kind of type m does not conform to the expected kind of type m[+x] in trait A.
-BCon.this.m's type parameters do not match type m's expected parameters: type x (in trait BCon) is contravariant, but type x (in trait A) is declared covariant
+BCon.this.m's type parameters do not match type m's expected parameters:
+type x (in trait BCon) is contravariant, but type x (in trait A) is declared covariant
type m[-x] = FooCon[x] // error: contravariant x
^
tcpoly_typealias.scala:45: error: The kind of type m does not conform to the expected kind of type m[+x] in trait A.
-BBound.this.m's type parameters do not match type m's expected parameters: type x (in trait BBound)'s bounds >: Nothing <: String are stricter than type x (in trait A)'s declared bounds >: Nothing <: Any
+BBound.this.m's type parameters do not match type m's expected parameters:
+type x (in trait BBound)'s bounds <: String are stricter than type x (in trait A)'s declared bounds >: Nothing <: Any
type m[+x <: String] = FooBound[x] // error: x with stricter bound
^
three errors found
diff --git a/test/files/neg/tcpoly_variance_enforce.check b/test/files/neg/tcpoly_variance_enforce.check
index 44b5b2c15c..3299cc3435 100644
--- a/test/files/neg/tcpoly_variance_enforce.check
+++ b/test/files/neg/tcpoly_variance_enforce.check
@@ -1,45 +1,57 @@
tcpoly_variance_enforce.scala:15: error: kinds of the type arguments (FooInvar) do not conform to the expected kinds of the type parameters (type m) in trait coll.
-FooInvar's type parameters do not match type m's expected parameters: type x (in class FooInvar) is invariant, but type x is declared covariant
+FooInvar's type parameters do not match type m's expected parameters:
+type x (in class FooInvar) is invariant, but type x is declared covariant
object fcollinv extends coll[FooInvar] // error
^
tcpoly_variance_enforce.scala:16: error: kinds of the type arguments (FooContra) do not conform to the expected kinds of the type parameters (type m) in trait coll.
-FooContra's type parameters do not match type m's expected parameters: type x (in class FooContra) is contravariant, but type x is declared covariant
+FooContra's type parameters do not match type m's expected parameters:
+type x (in class FooContra) is contravariant, but type x is declared covariant
object fcollcon extends coll[FooContra] // error
^
tcpoly_variance_enforce.scala:17: error: kinds of the type arguments (FooString) do not conform to the expected kinds of the type parameters (type m) in trait coll.
-FooString's type parameters do not match type m's expected parameters: type x (in class FooString)'s bounds >: Nothing <: String are stricter than type x's declared bounds >: Nothing <: Any
+FooString's type parameters do not match type m's expected parameters:
+type x (in class FooString)'s bounds <: String are stricter than type x's declared bounds >: Nothing <: Any
object fcollwb extends coll[FooString] // error
^
tcpoly_variance_enforce.scala:19: error: kinds of the type arguments (FooCov) do not conform to the expected kinds of the type parameters (type m) in trait coll2.
-FooCov's type parameters do not match type m's expected parameters: type x (in class FooCov) is covariant, but type x is declared contravariant
+FooCov's type parameters do not match type m's expected parameters:
+type x (in class FooCov) is covariant, but type x is declared contravariant
object fcoll2ok extends coll2[FooCov] // error
^
tcpoly_variance_enforce.scala:20: error: kinds of the type arguments (FooInvar) do not conform to the expected kinds of the type parameters (type m) in trait coll2.
-FooInvar's type parameters do not match type m's expected parameters: type x (in class FooInvar) is invariant, but type x is declared contravariant
+FooInvar's type parameters do not match type m's expected parameters:
+type x (in class FooInvar) is invariant, but type x is declared contravariant
object fcoll2inv extends coll2[FooInvar] // error
^
tcpoly_variance_enforce.scala:22: error: kinds of the type arguments (FooString) do not conform to the expected kinds of the type parameters (type m) in trait coll2.
-FooString's type parameters do not match type m's expected parameters: type x (in class FooString) is covariant, but type x is declared contravarianttype x (in class FooString)'s bounds >: Nothing <: String are stricter than type x's declared bounds >: Nothing <: Any
+FooString's type parameters do not match type m's expected parameters:
+type x (in class FooString) is covariant, but type x is declared contravariant
+type x (in class FooString)'s bounds <: String are stricter than type x's declared bounds >: Nothing <: Any
object fcoll2wb extends coll2[FooString] // error
^
tcpoly_variance_enforce.scala:27: error: kinds of the type arguments (FooString) do not conform to the expected kinds of the type parameters (type m) in trait coll3.
-FooString's type parameters do not match type m's expected parameters: type x (in class FooString)'s bounds >: Nothing <: String are stricter than type x's declared bounds >: Nothing <: Any
+FooString's type parameters do not match type m's expected parameters:
+type x (in class FooString)'s bounds <: String are stricter than type x's declared bounds >: Nothing <: Any
object fcoll3wb extends coll3[FooString] // error
^
tcpoly_variance_enforce.scala:30: error: kinds of the type arguments (FooString,Int) do not conform to the expected kinds of the type parameters (type m,type y) in trait coll4.
-FooString's type parameters do not match type m's expected parameters: type x (in class FooString)'s bounds >: Nothing <: String are stricter than type x's declared bounds >: Nothing <: y
+FooString's type parameters do not match type m's expected parameters:
+type x (in class FooString)'s bounds <: String are stricter than type x's declared bounds <: y
object fcoll4_1 extends coll4[FooString, Int] // error
^
tcpoly_variance_enforce.scala:31: error: kinds of the type arguments (FooString,Any) do not conform to the expected kinds of the type parameters (type m,type y) in trait coll4.
-FooString's type parameters do not match type m's expected parameters: type x (in class FooString)'s bounds >: Nothing <: String are stricter than type x's declared bounds >: Nothing <: y
+FooString's type parameters do not match type m's expected parameters:
+type x (in class FooString)'s bounds <: String are stricter than type x's declared bounds <: y
object fcoll4_2 extends coll4[FooString, Any] // error
^
tcpoly_variance_enforce.scala:37: error: kinds of the type arguments (FooInvar) do not conform to the expected kinds of the type parameters (type m) in trait coll.
-FooInvar's type parameters do not match type m's expected parameters: type x (in class FooInvar) is invariant, but type x is declared covariant
+FooInvar's type parameters do not match type m's expected parameters:
+type x (in class FooInvar) is invariant, but type x is declared covariant
def x: coll[FooInvar] = sys.error("foo") // error
^
tcpoly_variance_enforce.scala:38: error: kinds of the type arguments (FooContra) do not conform to the expected kinds of the type parameters (type m) in trait coll.
-FooContra's type parameters do not match type m's expected parameters: type x (in class FooContra) is contravariant, but type x is declared covariant
+FooContra's type parameters do not match type m's expected parameters:
+type x (in class FooContra) is contravariant, but type x is declared covariant
def y: coll[FooContra] = sys.error("foo") // error
^
11 errors found
diff --git a/test/files/neg/valueclasses.check b/test/files/neg/valueclasses.check
index 756a0474fa..4f042faded 100644
--- a/test/files/neg/valueclasses.check
+++ b/test/files/neg/valueclasses.check
@@ -40,7 +40,4 @@ class V12[@specialized T, U](val x: (T, U)) extends AnyVal // fail
valueclasses.scala:31: error: value class needs to have exactly one public val parameter
class V13(x: Int) extends AnyVal // fail
^
-valueclasses.scala:45: error: value class must have public primary constructor
-final class TOD private (val secondsOfDay: Int) extends AnyVal { // should fail with private constructor
- ^
-15 errors found
+14 errors found
diff --git a/test/files/neg/valueclasses.scala b/test/files/neg/valueclasses.scala
index e405d95489..7cac94ab11 100644
--- a/test/files/neg/valueclasses.scala
+++ b/test/files/neg/valueclasses.scala
@@ -29,26 +29,3 @@ class V11[T](val x: List[T]) extends AnyVal // ok
class V12[@specialized T, U](val x: (T, U)) extends AnyVal // fail
class V13(x: Int) extends AnyVal // fail
-
-
-package time {
-
-object TOD {
- final val SecondsPerDay = 86400
-
- def apply(seconds: Int) = {
- val n = seconds % SecondsPerDay
- new TOD(if (n >= 0) n else n + SecondsPerDay)
- }
-}
-
-final class TOD private (val secondsOfDay: Int) extends AnyVal { // should fail with private constructor
- def hours = secondsOfDay / 3600
- def minutes = (secondsOfDay / 60) % 60
- def seconds = secondsOfDay % 60
-
- override def toString = "%02d:%02d:%02d".format(hours, minutes, seconds)
-}
-}
-
-
diff --git a/test/files/pos/irrefutable.scala b/test/files/pos/irrefutable.scala
new file mode 100644
index 0000000000..0a792b644a
--- /dev/null
+++ b/test/files/pos/irrefutable.scala
@@ -0,0 +1,22 @@
+// The test which this should perform but does not
+// is that f1 is recognized as irrefutable and f2 is not
+// This can be recognized via the generated classes:
+//
+// A$$anonfun$f1$1.class
+// A$$anonfun$f2$1.class
+// A$$anonfun$f2$2.class
+//
+// The extra one in $f2$ is the filter.
+//
+// !!! Marking with exclamation points so maybe someday
+// this test will be finished.
+class A {
+ case class Foo[T](x: T)
+
+ def f1(xs: List[Foo[Int]]) = {
+ for (Foo(x: Int) <- xs) yield x
+ }
+ def f2(xs: List[Foo[Any]]) = {
+ for (Foo(x: Int) <- xs) yield x
+ }
+}
diff --git a/test/files/pos/lookupswitch.scala b/test/files/pos/lookupswitch.scala
new file mode 100644
index 0000000000..33594c0ea6
--- /dev/null
+++ b/test/files/pos/lookupswitch.scala
@@ -0,0 +1,37 @@
+// There's not a real test here, but on compilation the
+// switch should have the cases arranged in order from 1-30.
+class A {
+ def f(x: Int) = x match {
+ case 6 => "6"
+ case 18 => "18"
+ case 7 => "7"
+ case 2 => "2"
+ case 13 => "13"
+ case 11 => "11"
+ case 26 => "26"
+ case 27 => "27"
+ case 29 => "29"
+ case 25 => "25"
+ case 9 => "9"
+ case 17 => "17"
+ case 16 => "16"
+ case 1 => "1"
+ case 30 => "30"
+ case 15 => "15"
+ case 22 => "22"
+ case 19 => "19"
+ case 23 => "23"
+ case 8 => "8"
+ case 28 => "28"
+ case 5 => "5"
+ case 12 => "12"
+ case 10 => "10"
+ case 21 => "21"
+ case 24 => "24"
+ case 4 => "4"
+ case 14 => "14"
+ case 3 => "3"
+ case 20 => "20"
+ }
+}
+ \ No newline at end of file
diff --git a/test/files/pos/t1336.scala b/test/files/pos/t1336.scala
new file mode 100644
index 0000000000..63967985c7
--- /dev/null
+++ b/test/files/pos/t1336.scala
@@ -0,0 +1,10 @@
+object Foo {
+ def foreach( f : ((Int,Int)) => Unit ) {
+ println("foreach")
+ f(1,2)
+ }
+
+ for( (a,b) <- this ) {
+ println((a,b))
+ }
+}
diff --git a/test/files/pos/t4545.scala b/test/files/pos/t4545.scala
new file mode 100644
index 0000000000..8c7a3236c4
--- /dev/null
+++ b/test/files/pos/t4545.scala
@@ -0,0 +1,14 @@
+object Test {
+ def f[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T](table: Tuple20[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T])(fun: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T) => Unit) {
+ }
+ def g[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U](table: Tuple21[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U])(fun: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U) => Unit) {
+ }
+
+ def g20 = f(
+ ( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
+ ) { case ((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t)) => () }
+
+ def g21 = g(
+ (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
+ ) { case ((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u)) => () }
+}
diff --git a/test/files/pos/t5580b.scala b/test/files/pos/t5580b.scala
new file mode 100644
index 0000000000..d5a4a0a2b2
--- /dev/null
+++ b/test/files/pos/t5580b.scala
@@ -0,0 +1,19 @@
+/** It's a pos test because it does indeed compile,
+ * not so much because I'm glad it does. Testing
+ * that error messages created and discarded during
+ * implicit search don't blow it up.
+ */
+
+import scala.collection.mutable.WeakHashMap
+import scala.collection.JavaConversions._
+
+class bar { }
+
+class foo {
+ val map = WeakHashMap[AnyRef, collection.mutable.Map[bar, collection.mutable.Set[bar]]]()
+
+ def test={
+ val tmp:bar=null
+ if (map.get(tmp).isEmpty) map.put(tmp,collection.mutable.Set())
+ }
+}
diff --git a/test/files/pos/t5589.scala b/test/files/pos/t5589.scala
new file mode 100644
index 0000000000..69cbb20391
--- /dev/null
+++ b/test/files/pos/t5589.scala
@@ -0,0 +1,22 @@
+class A {
+ // First three compile.
+ def f1(x: Either[Int, String]) = x.right map (y => y)
+ def f2(x: Either[Int, String]) = for (y <- x.right) yield y
+ def f3(x: Either[Int, (String, Int)]) = x.right map { case (y1, y2) => (y1, y2) }
+ // Last one fails.
+ def f4(x: Either[Int, (String, Int)]) = for ((y1, y2) <- x.right) yield ((y1, y2))
+/**
+./a.scala:5: error: constructor cannot be instantiated to expected type;
+ found : (T1, T2)
+ required: Either[Nothing,(String, Int)]
+ def f4(x: Either[Int, (String, Int)]) = for ((y1, y2) <- x.right) yield ((y1, y2))
+ ^
+./a.scala:5: error: not found: value y1
+ def f4(x: Either[Int, (String, Int)]) = for ((y1, y2) <- x.right) yield ((y1, y2))
+ ^
+./a.scala:5: error: not found: value y2
+ def f4(x: Either[Int, (String, Int)]) = for ((y1, y2) <- x.right) yield ((y1, y2))
+ ^
+three errors found
+**/
+}
diff --git a/test/files/pos/t5604/ReplConfig.scala b/test/files/pos/t5604/ReplConfig.scala
new file mode 100644
index 0000000000..8c589eba60
--- /dev/null
+++ b/test/files/pos/t5604/ReplConfig.scala
@@ -0,0 +1,53 @@
+/* NSC -- new Scala compiler
+ * Copyright 2005-2011 LAMP/EPFL
+ * @author Paul Phillips
+ */
+
+package scala.tools.nsc
+package interpreter
+
+import util.Exceptional.unwrap
+import util.stackTraceString
+
+trait ReplConfig {
+ lazy val replProps = new ReplProps
+
+ class TapMaker[T](x: T) {
+ def tapInfo(msg: => String): T = tap(x => replinfo(parens(x)))
+ def tapDebug(msg: => String): T = tap(x => repldbg(parens(x)))
+ def tapTrace(msg: => String): T = tap(x => repltrace(parens(x)))
+ def tap[U](f: T => U): T = {
+ f(x)
+ x
+ }
+ }
+
+ private def parens(x: Any) = "(" + x + ")"
+ private def echo(msg: => String) =
+ try Console println msg
+ catch { case x: AssertionError => Console.println("Assertion error printing debugging output: " + x) }
+
+ private[nsc] def repldbg(msg: => String) = if (isReplDebug) echo(msg)
+ private[nsc] def repltrace(msg: => String) = if (isReplTrace) echo(msg)
+ private[nsc] def replinfo(msg: => String) = if (isReplInfo) echo(msg)
+
+ private[nsc] def logAndDiscard[T](label: String, alt: => T): PartialFunction[Throwable, T] = {
+ case t =>
+ repldbg(label + ": " + unwrap(t))
+ repltrace(stackTraceString(unwrap(t)))
+ alt
+ }
+ private[nsc] def substituteAndLog[T](alt: => T)(body: => T): T =
+ substituteAndLog("" + alt, alt)(body)
+ private[nsc] def substituteAndLog[T](label: String, alt: => T)(body: => T): T = {
+ try body
+ catch logAndDiscard(label, alt)
+ }
+ private[nsc] def squashAndLog(label: String)(body: => Unit): Unit =
+ substituteAndLog(label, ())(body)
+
+ def isReplTrace: Boolean = replProps.trace
+ def isReplDebug: Boolean = replProps.debug || isReplTrace
+ def isReplInfo: Boolean = replProps.info || isReplDebug
+ def isReplPower: Boolean = replProps.power
+}
diff --git a/test/files/pos/t5604/ReplReporter.scala b/test/files/pos/t5604/ReplReporter.scala
new file mode 100644
index 0000000000..130af990ad
--- /dev/null
+++ b/test/files/pos/t5604/ReplReporter.scala
@@ -0,0 +1,30 @@
+/* NSC -- new Scala compiler
+ * Copyright 2002-2011 LAMP/EPFL
+ * @author Paul Phillips
+ */
+
+package scala.tools.nsc
+package interpreter
+
+import reporters._
+import IMain._
+
+class ReplReporter(intp: IMain) extends ConsoleReporter(intp.settings, Console.in, new ReplStrippingWriter(intp)) {
+ override def printMessage(msg: String) {
+ // Avoiding deadlock if the compiler starts logging before
+ // the lazy val is complete.
+ if (intp.isInitializeComplete) {
+ if (intp.totalSilence) {
+ if (isReplTrace)
+ super.printMessage("[silent] " + msg)
+ }
+ else super.printMessage(msg)
+ }
+ else Console.println("[init] " + msg)
+ }
+
+ override def displayPrompt() {
+ if (intp.totalSilence) ()
+ else super.displayPrompt()
+ }
+}
diff --git a/test/files/pos/virtpatmat_anonfun_for.flags b/test/files/pos/virtpatmat_anonfun_for.flags
new file mode 100644
index 0000000000..23e3dc7d26
--- /dev/null
+++ b/test/files/pos/virtpatmat_anonfun_for.flags
@@ -0,0 +1 @@
+-Yvirtpatmat \ No newline at end of file
diff --git a/test/files/pos/virtpatmat_anonfun_for.scala b/test/files/pos/virtpatmat_anonfun_for.scala
new file mode 100644
index 0000000000..8623cd97ba
--- /dev/null
+++ b/test/files/pos/virtpatmat_anonfun_for.scala
@@ -0,0 +1,8 @@
+trait Foo {
+ def bla = {
+ val tvs = "tvs"
+ Nil.foreach(x => x match {
+ case _ => println(tvs)
+ })
+ }
+} \ No newline at end of file
diff --git a/test/files/pos/virtpatmat_exist4.scala b/test/files/pos/virtpatmat_exist4.scala
new file mode 100644
index 0000000000..a04d0e3229
--- /dev/null
+++ b/test/files/pos/virtpatmat_exist4.scala
@@ -0,0 +1,35 @@
+trait Global {
+ trait Tree
+ trait Symbol { def foo: Boolean }
+}
+
+trait IMain { self: MemberHandlers =>
+ val global: Global
+ def handlers: List[MemberHandler]
+}
+
+trait MemberHandlers {
+ val intp: IMain
+ import intp.global._
+ sealed abstract class MemberHandler(val member: Tree) {
+ def importedSymbols: List[Symbol]
+ }
+}
+
+object Test {
+ var intp: IMain with MemberHandlers = null
+
+ val handlers = intp.handlers
+ handlers.filterNot(_.importedSymbols.isEmpty).zipWithIndex foreach {
+ case (handler, idx) =>
+ val (types, terms) = handler.importedSymbols partition (_.foo)
+ }
+}
+
+object Test2 {
+ type JClass = java.lang.Class[_]
+
+ def tvarString(bounds: List[AnyRef]) = {
+ bounds collect { case x: JClass => x }
+ }
+} \ No newline at end of file
diff --git a/test/files/pos/virtpatmat_instof_valuetype.flags b/test/files/pos/virtpatmat_instof_valuetype.flags
new file mode 100644
index 0000000000..9769db9257
--- /dev/null
+++ b/test/files/pos/virtpatmat_instof_valuetype.flags
@@ -0,0 +1 @@
+ -Yvirtpatmat -Xexperimental
diff --git a/test/files/pos/virtpatmat_instof_valuetype.scala b/test/files/pos/virtpatmat_instof_valuetype.scala
new file mode 100644
index 0000000000..1dda9bf57c
--- /dev/null
+++ b/test/files/pos/virtpatmat_instof_valuetype.scala
@@ -0,0 +1,8 @@
+case class Data(private val t: Option[String] = None, only: Boolean = false) {
+ def add(other: Data) = {
+ other match {
+ case Data(None, b) => ()
+ case Data(Some(_), b) => ()
+ }
+ }
+} \ No newline at end of file
diff --git a/test/files/presentation/callcc-interpreter.check b/test/files/presentation/callcc-interpreter.check
index 3385ef12b7..c50e171b4e 100644
--- a/test/files/presentation/callcc-interpreter.check
+++ b/test/files/presentation/callcc-interpreter.check
@@ -52,7 +52,7 @@ retrieved 64 members
`method wait(x$1: Long, x$2: Int)Unit`
`method x=> callccInterpreter.type`
`method →[B](y: B)(callccInterpreter.type, B)`
-`object Wrongobject callccInterpreter.Wrong`
+`object WrongcallccInterpreter.Wrong.type`
`trait TermcallccInterpreter.Term`
`trait ValuecallccInterpreter.Value`
`type AnswercallccInterpreter.Answer`
diff --git a/test/files/presentation/shutdown-deadlock/ShutdownDeadlockTest.scala b/test/files/presentation/shutdown-deadlock/ShutdownDeadlockTest.scala
index 53af84541a..cef9d2a5ed 100644
--- a/test/files/presentation/shutdown-deadlock/ShutdownDeadlockTest.scala
+++ b/test/files/presentation/shutdown-deadlock/ShutdownDeadlockTest.scala
@@ -20,7 +20,7 @@ object Test extends InteractiveTest {
}
for ((j, i) <- jobs1.zipWithIndex) {
- j.get(5000) match {
+ j.get(40000) match {
case None =>
println(i + ": TIMEOUT")
exit(1) // no need to delay the test any longer
diff --git a/test/files/run/concurrent-map-conversions.scala b/test/files/run/concurrent-map-conversions.scala
new file mode 100644
index 0000000000..0350b69642
--- /dev/null
+++ b/test/files/run/concurrent-map-conversions.scala
@@ -0,0 +1,36 @@
+
+
+
+
+
+object Test {
+
+ def main(args: Array[String]) {
+ testConversions()
+ testConverters()
+ }
+
+ def needPackageConcurrentMap(map: collection.concurrent.Map[Int, Int]) {
+ }
+ def needJavaConcurrent(map: java.util.concurrent.ConcurrentMap[Int, Int]) {
+ }
+
+ def testConversions() {
+ import collection.JavaConversions._
+ val skiplist = new java.util.concurrent.ConcurrentSkipListMap[Int, Int]
+ val ctrie = new collection.concurrent.TrieMap[Int, Int]
+
+ needPackageConcurrentMap(skiplist)
+ needJavaConcurrent(ctrie)
+ }
+
+ def testConverters() {
+ import collection.JavaConverters._
+ val skiplist = new java.util.concurrent.ConcurrentSkipListMap[Int, Int]
+ val ctrie = new collection.concurrent.TrieMap[Int, Int]
+
+ needPackageConcurrentMap(skiplist.asScala)
+ needJavaConcurrent(ctrie.asJava)
+ }
+
+}
diff --git a/test/files/run/delay-bad.check b/test/files/run/delay-bad.check
new file mode 100644
index 0000000000..9d9c828a03
--- /dev/null
+++ b/test/files/run/delay-bad.check
@@ -0,0 +1,47 @@
+
+
+// new C { }
+-A -B -C
+
+// new C { 5 }
+-A -B -C
+ A+ B+ C+
+
+// new D()
+-A -B -C -D
+ A+ B+ C+ D+
+
+// new D() { }
+-A -B -C -D
+ A+ B+ C+ D+
+
+// new D() { val x = 5 }
+-A -B -C -D
+ A+ B+ C+ D+
+ A+ B+ C+ D+
+
+// new { val x = 5 } with D()
+-A -B -C -D
+ A+ B+ C+ D+
+
+// new E() { val x = 5 }
+-A -B -C -D
+ A+ B+ C+ D+ E+ -E
+ A+ B+ C+ D+ E+
+ A+ B+ C+ D+ E+
+
+// new { val x = 5 } with E()
+-A -B -C -D
+ A+ B+ C+ D+ E+ -E
+ A+ B+ C+ D+ E+
+
+// new { val x = 5 } with E() { }
+-A -B -C -D
+ A+ B+ C+ D+ E+ -E
+ A+ B+ C+ D+ E+
+
+// new { val x = 5 } with E() { 5 }
+-A -B -C -D
+ A+ B+ C+ D+ E+ -E
+ A+ B+ C+ D+ E+
+ A+ B+ C+ D+ E+
diff --git a/test/files/run/delay-bad.scala b/test/files/run/delay-bad.scala
new file mode 100644
index 0000000000..43acc1ea3d
--- /dev/null
+++ b/test/files/run/delay-bad.scala
@@ -0,0 +1,77 @@
+trait A extends DelayedInit
+{
+ print("-A")
+
+ def delayedInit(body: => Unit) = {
+ body
+ postConstructionCode
+ }
+ def postConstructionCode: Unit = {
+ print("\n A+")
+ }
+}
+trait B extends A {
+ print(" -B")
+ override def postConstructionCode: Unit = {
+ super.postConstructionCode
+ print(" B+")
+ }
+}
+
+trait C extends B {
+ print(" -C")
+ override def postConstructionCode: Unit = {
+ super.postConstructionCode
+ print(" C+")
+ }
+}
+
+class D() extends C {
+ print(" -D")
+ override def postConstructionCode: Unit = {
+ super.postConstructionCode
+ print(" D+")
+ }
+}
+class E() extends D() {
+ print(" -E")
+ override def postConstructionCode: Unit = {
+ super.postConstructionCode
+ print(" E+")
+ }
+}
+
+object Test {
+ def p(msg: String) = println("\n\n// " + msg)
+
+ def main(args: Array[String]) {
+ val f: A => Unit = _ => ()
+
+ p("new C { }")
+ f(new C { })
+ p("new C { 5 }")
+ f(new C { 5 })
+
+ p("new D()")
+ f(new D())
+ p("new D() { }")
+ f(new D() { })
+
+ p("new D() { val x = 5 }")
+ f(new D() { val x = 5 })
+ p("new { val x = 5 } with D()")
+ f(new { val x = 5 } with D())
+
+ p("new E() { val x = 5 }")
+ f(new E() { val x = 5 })
+ p("new { val x = 5 } with E()")
+ f(new { val x = 5 } with E())
+
+ p("new { val x = 5 } with E() { }")
+ f(new { val x = 5 } with E() { })
+ p("new { val x = 5 } with E() { 5 }")
+ f(new { val x = 5 } with E() { 5 })
+
+ println("")
+ }
+}
diff --git a/test/files/run/delay-good.check b/test/files/run/delay-good.check
new file mode 100644
index 0000000000..8eb04c7cff
--- /dev/null
+++ b/test/files/run/delay-good.check
@@ -0,0 +1,41 @@
+
+
+// new C { }
+-A -B -C
+ A+ B+ C+
+
+// new C { 5 }
+-A -B -C
+ A+ B+ C+
+
+// new D()
+-A -B -C -D
+ A+ B+ C+ D+
+
+// new D() { }
+-A -B -C -D
+ A+ B+ C+ D+
+
+// new D() { val x = 5 }
+-A -B -C -D
+ A+ B+ C+ D+
+
+// new { val x = 5 } with D()
+-A -B -C -D
+ A+ B+ C+ D+
+
+// new E() { val x = 5 }
+-A -B -C -D -E
+ A+ B+ C+ D+ E+
+
+// new { val x = 5 } with E()
+-A -B -C -D -E
+ A+ B+ C+ D+ E+
+
+// new { val x = 5 } with E() { }
+-A -B -C -D -E
+ A+ B+ C+ D+ E+
+
+// new { val x = 5 } with E() { 5 }
+-A -B -C -D -E
+ A+ B+ C+ D+ E+
diff --git a/test/files/run/delay-good.scala b/test/files/run/delay-good.scala
new file mode 100644
index 0000000000..2e4487b92c
--- /dev/null
+++ b/test/files/run/delay-good.scala
@@ -0,0 +1,77 @@
+trait A
+{
+ print("-A")
+
+ def delayedInit(body: => Unit) = {
+ body
+ postConstructionCode
+ }
+ def postConstructionCode: Unit = {
+ print("\n A+")
+ }
+}
+trait B extends A {
+ print(" -B")
+ override def postConstructionCode: Unit = {
+ super.postConstructionCode
+ print(" B+")
+ }
+}
+
+trait C extends B {
+ print(" -C")
+ override def postConstructionCode: Unit = {
+ super.postConstructionCode
+ print(" C+")
+ }
+}
+
+class D() extends C {
+ print(" -D")
+ override def postConstructionCode: Unit = {
+ super.postConstructionCode
+ print(" D+")
+ }
+}
+class E() extends D() {
+ print(" -E")
+ override def postConstructionCode: Unit = {
+ super.postConstructionCode
+ print(" E+")
+ }
+}
+
+object Test {
+ def p(msg: String) = println("\n\n// " + msg)
+
+ def main(args: Array[String]) {
+ val f: A => Unit = _.postConstructionCode
+
+ p("new C { }")
+ f(new C { })
+ p("new C { 5 }")
+ f(new C { 5 })
+
+ p("new D()")
+ f(new D())
+ p("new D() { }")
+ f(new D() { })
+
+ p("new D() { val x = 5 }")
+ f(new D() { val x = 5 })
+ p("new { val x = 5 } with D()")
+ f(new { val x = 5 } with D())
+
+ p("new E() { val x = 5 }")
+ f(new E() { val x = 5 })
+ p("new { val x = 5 } with E()")
+ f(new { val x = 5 } with E())
+
+ p("new { val x = 5 } with E() { }")
+ f(new { val x = 5 } with E() { })
+ p("new { val x = 5 } with E() { 5 }")
+ f(new { val x = 5 } with E() { 5 })
+
+ println("")
+ }
+}
diff --git a/test/files/run/existentials-in-compiler.check b/test/files/run/existentials-in-compiler.check
index c8040a4cb1..83e3cdf435 100644
--- a/test/files/run/existentials-in-compiler.check
+++ b/test/files/run/existentials-in-compiler.check
@@ -1,156 +1,156 @@
-abstract trait Bippy[A <: AnyRef,B] extends Object
+abstract trait Bippy[A <: AnyRef, B] extends Object
extest.Bippy[_ <: AnyRef, _]
-abstract trait BippyBud[A <: AnyRef,B,C <: List[A]] extends Object
+abstract trait BippyBud[A <: AnyRef, B, C <: List[A]] extends Object
extest.BippyBud[A,B,C] forSome { A <: AnyRef; B; C <: List[A] }
-abstract trait BippyLike[A <: AnyRef,B <: List[A],This <: extest.BippyLike[A,B,This] with extest.Bippy[A,B]] extends Object
+abstract trait BippyLike[A <: AnyRef, B <: List[A], This <: extest.BippyLike[A,B,This] with extest.Bippy[A,B]] extends Object
extest.BippyLike[A,B,This] forSome { A <: AnyRef; B <: List[A]; This <: extest.BippyLike[A,B,This] with extest.Bippy[A,B] }
-abstract trait Contra[-A >: AnyRef,-B] extends Object
+abstract trait Contra[-A >: AnyRef, -B] extends Object
extest.Contra[_ >: AnyRef, _]
-abstract trait ContraLike[-A >: AnyRef,-B >: List[A]] extends Object
+abstract trait ContraLike[-A >: AnyRef, -B >: List[A]] extends Object
extest.ContraLike[A,B] forSome { -A >: AnyRef; -B >: List[A] }
-abstract trait Cov01[+A <: AnyRef,+B] extends Object
+abstract trait Cov01[+A <: AnyRef, +B] extends Object
extest.Cov01[_ <: AnyRef, _]
-abstract trait Cov02[+A <: AnyRef,B] extends Object
+abstract trait Cov02[+A <: AnyRef, B] extends Object
extest.Cov02[_ <: AnyRef, _]
-abstract trait Cov03[+A <: AnyRef,-B] extends Object
+abstract trait Cov03[+A <: AnyRef, -B] extends Object
extest.Cov03[_ <: AnyRef, _]
-abstract trait Cov04[A <: AnyRef,+B] extends Object
+abstract trait Cov04[A <: AnyRef, +B] extends Object
extest.Cov04[_ <: AnyRef, _]
-abstract trait Cov05[A <: AnyRef,B] extends Object
+abstract trait Cov05[A <: AnyRef, B] extends Object
extest.Cov05[_ <: AnyRef, _]
-abstract trait Cov06[A <: AnyRef,-B] extends Object
+abstract trait Cov06[A <: AnyRef, -B] extends Object
extest.Cov06[_ <: AnyRef, _]
-abstract trait Cov07[-A <: AnyRef,+B] extends Object
+abstract trait Cov07[-A <: AnyRef, +B] extends Object
extest.Cov07[_ <: AnyRef, _]
-abstract trait Cov08[-A <: AnyRef,B] extends Object
+abstract trait Cov08[-A <: AnyRef, B] extends Object
extest.Cov08[_ <: AnyRef, _]
-abstract trait Cov09[-A <: AnyRef,-B] extends Object
+abstract trait Cov09[-A <: AnyRef, -B] extends Object
extest.Cov09[_ <: AnyRef, _]
-abstract trait Cov11[+A <: AnyRef,+B <: List[_]] extends Object
+abstract trait Cov11[+A <: AnyRef, +B <: List[_]] extends Object
extest.Cov11[_ <: AnyRef, _ <: List[_]]
-abstract trait Cov12[+A <: AnyRef,B <: List[_]] extends Object
+abstract trait Cov12[+A <: AnyRef, B <: List[_]] extends Object
extest.Cov12[_ <: AnyRef, _ <: List[_]]
-abstract trait Cov13[+A <: AnyRef,-B <: List[_]] extends Object
+abstract trait Cov13[+A <: AnyRef, -B <: List[_]] extends Object
extest.Cov13[_ <: AnyRef, _ <: List[_]]
-abstract trait Cov14[A <: AnyRef,+B <: List[_]] extends Object
+abstract trait Cov14[A <: AnyRef, +B <: List[_]] extends Object
extest.Cov14[_ <: AnyRef, _ <: List[_]]
-abstract trait Cov15[A <: AnyRef,B <: List[_]] extends Object
+abstract trait Cov15[A <: AnyRef, B <: List[_]] extends Object
extest.Cov15[_ <: AnyRef, _ <: List[_]]
-abstract trait Cov16[A <: AnyRef,-B <: List[_]] extends Object
+abstract trait Cov16[A <: AnyRef, -B <: List[_]] extends Object
extest.Cov16[_ <: AnyRef, _ <: List[_]]
-abstract trait Cov17[-A <: AnyRef,+B <: List[_]] extends Object
+abstract trait Cov17[-A <: AnyRef, +B <: List[_]] extends Object
extest.Cov17[_ <: AnyRef, _ <: List[_]]
-abstract trait Cov18[-A <: AnyRef,B <: List[_]] extends Object
+abstract trait Cov18[-A <: AnyRef, B <: List[_]] extends Object
extest.Cov18[_ <: AnyRef, _ <: List[_]]
-abstract trait Cov19[-A <: AnyRef,-B <: List[_]] extends Object
+abstract trait Cov19[-A <: AnyRef, -B <: List[_]] extends Object
extest.Cov19[_ <: AnyRef, _ <: List[_]]
-abstract trait Cov21[+A,+B] extends Object
+abstract trait Cov21[+A, +B] extends Object
extest.Cov21[_, _]
-abstract trait Cov22[+A,B] extends Object
+abstract trait Cov22[+A, B] extends Object
extest.Cov22[_, _]
-abstract trait Cov23[+A,-B] extends Object
+abstract trait Cov23[+A, -B] extends Object
extest.Cov23[_, _]
-abstract trait Cov24[A,+B] extends Object
+abstract trait Cov24[A, +B] extends Object
extest.Cov24[_, _]
-abstract trait Cov25[A,B] extends Object
+abstract trait Cov25[A, B] extends Object
extest.Cov25[_, _]
-abstract trait Cov26[A,-B] extends Object
+abstract trait Cov26[A, -B] extends Object
extest.Cov26[_, _]
-abstract trait Cov27[-A,+B] extends Object
+abstract trait Cov27[-A, +B] extends Object
extest.Cov27[_, _]
-abstract trait Cov28[-A,B] extends Object
+abstract trait Cov28[-A, B] extends Object
extest.Cov28[_, _]
-abstract trait Cov29[-A,-B] extends Object
+abstract trait Cov29[-A, -B] extends Object
extest.Cov29[_, _]
-abstract trait Cov31[+A,+B,C <: (A, B)] extends Object
+abstract trait Cov31[+A, +B, C <: (A, B)] extends Object
extest.Cov31[A,B,C] forSome { +A; +B; C <: (A, B) }
-abstract trait Cov32[+A,B,C <: (A, B)] extends Object
+abstract trait Cov32[+A, B, C <: (A, B)] extends Object
extest.Cov32[A,B,C] forSome { +A; B; C <: (A, B) }
-abstract trait Cov33[+A,-B,C <: (A, _$10) forSome { type _$10 }] extends Object
+abstract trait Cov33[+A, -B, C <: (A, _$10) forSome { type _$10 }] extends Object
extest.Cov33[A,B,C] forSome { +A; -B; C <: (A, _$10) forSome { type _$10 } }
-abstract trait Cov34[A,+B,C <: (A, B)] extends Object
+abstract trait Cov34[A, +B, C <: (A, B)] extends Object
extest.Cov34[A,B,C] forSome { A; +B; C <: (A, B) }
-abstract trait Cov35[A,B,C <: (A, B)] extends Object
+abstract trait Cov35[A, B, C <: (A, B)] extends Object
extest.Cov35[A,B,C] forSome { A; B; C <: (A, B) }
-abstract trait Cov36[A,-B,C <: (A, _$11) forSome { type _$11 }] extends Object
+abstract trait Cov36[A, -B, C <: (A, _$11) forSome { type _$11 }] extends Object
extest.Cov36[A,B,C] forSome { A; -B; C <: (A, _$11) forSome { type _$11 } }
-abstract trait Cov37[-A,+B,C <: (_$12, B) forSome { type _$12 }] extends Object
+abstract trait Cov37[-A, +B, C <: (_$12, B) forSome { type _$12 }] extends Object
extest.Cov37[A,B,C] forSome { -A; +B; C <: (_$12, B) forSome { type _$12 } }
-abstract trait Cov38[-A,B,C <: (_$13, B) forSome { type _$13 }] extends Object
+abstract trait Cov38[-A, B, C <: (_$13, B) forSome { type _$13 }] extends Object
extest.Cov38[A,B,C] forSome { -A; B; C <: (_$13, B) forSome { type _$13 } }
-abstract trait Cov39[-A,-B,C <: Tuple2[_, _]] extends Object
+abstract trait Cov39[-A, -B, C <: Tuple2[_, _]] extends Object
extest.Cov39[_, _, _ <: Tuple2[_, _]]
-abstract trait Cov41[+A >: Null,+B] extends Object
+abstract trait Cov41[+A >: Null, +B] extends Object
extest.Cov41[_ >: Null, _]
-abstract trait Cov42[+A >: Null,B] extends Object
+abstract trait Cov42[+A >: Null, B] extends Object
extest.Cov42[_ >: Null, _]
-abstract trait Cov43[+A >: Null,-B] extends Object
+abstract trait Cov43[+A >: Null, -B] extends Object
extest.Cov43[_ >: Null, _]
-abstract trait Cov44[A >: Null,+B] extends Object
+abstract trait Cov44[A >: Null, +B] extends Object
extest.Cov44[_ >: Null, _]
-abstract trait Cov45[A >: Null,B] extends Object
+abstract trait Cov45[A >: Null, B] extends Object
extest.Cov45[_ >: Null, _]
-abstract trait Cov46[A >: Null,-B] extends Object
+abstract trait Cov46[A >: Null, -B] extends Object
extest.Cov46[_ >: Null, _]
-abstract trait Cov47[-A >: Null,+B] extends Object
+abstract trait Cov47[-A >: Null, +B] extends Object
extest.Cov47[_ >: Null, _]
-abstract trait Cov48[-A >: Null,B] extends Object
+abstract trait Cov48[-A >: Null, B] extends Object
extest.Cov48[_ >: Null, _]
-abstract trait Cov49[-A >: Null,-B] extends Object
+abstract trait Cov49[-A >: Null, -B] extends Object
extest.Cov49[_ >: Null, _]
-abstract trait Covariant[+A <: AnyRef,+B] extends Object
+abstract trait Covariant[+A <: AnyRef, +B] extends Object
extest.Covariant[_ <: AnyRef, _]
-abstract trait CovariantLike[+A <: AnyRef,+B <: List[A],+This <: extest.CovariantLike[A,B,This] with extest.Covariant[A,B]] extends Object
+abstract trait CovariantLike[+A <: AnyRef, +B <: List[A], +This <: extest.CovariantLike[A,B,This] with extest.Covariant[A,B]] extends Object
extest.CovariantLike[A,B,This] forSome { +A <: AnyRef; +B <: List[A]; +This <: extest.CovariantLike[A,B,This] with extest.Covariant[A,B] }
diff --git a/test/files/run/finalvar.check b/test/files/run/finalvar.check
new file mode 100644
index 0000000000..2496293972
--- /dev/null
+++ b/test/files/run/finalvar.check
@@ -0,0 +1,6 @@
+(2,2,2,2,1)
+(2,2,2,2)
+(2,2,2,2,1001)
+(2,2,2,2)
+2
+10
diff --git a/test/files/run/finalvar.flags b/test/files/run/finalvar.flags
new file mode 100644
index 0000000000..aee3039bec
--- /dev/null
+++ b/test/files/run/finalvar.flags
@@ -0,0 +1 @@
+-Yoverride-vars -Yinline \ No newline at end of file
diff --git a/test/files/run/finalvar.scala b/test/files/run/finalvar.scala
new file mode 100644
index 0000000000..010813e520
--- /dev/null
+++ b/test/files/run/finalvar.scala
@@ -0,0 +1,37 @@
+object Final {
+ class X(final var x: Int) { }
+ def f = new X(0).x += 1
+}
+
+class A {
+ var x = 1
+ def y0 = x
+ def y1 = this.x
+ def y2 = (this: A).x
+}
+
+class B extends A {
+ override def x = 2
+ def z = super.x
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ Final.f
+ val a = new B
+ println((a.x, a.y0, a.y1, a.y2, a.z))
+ val a0: A = a
+ println((a0.x, a0.y0, a0.y1, a0.y2))
+ a.x = 1001
+ println((a.x, a.y0, a.y1, a.y2, a.z))
+ println((a0.x, a0.y0, a0.y1, a0.y2))
+
+ val d = new D
+ println(d.w)
+ d.ten
+ println(d.w)
+ }
+}
+
+class C { var w = 1 ; def ten = this.w = 10 }
+class D extends C { override var w = 2 } \ No newline at end of file
diff --git a/test/files/run/lift-and-unlift.scala b/test/files/run/lift-and-unlift.scala
index b944c70155..a4a5d9502e 100644
--- a/test/files/run/lift-and-unlift.scala
+++ b/test/files/run/lift-and-unlift.scala
@@ -2,7 +2,7 @@ import Function.unlift
object Test {
def evens1(x: Int) = if (x % 2 == 0) Some(x) else None
- def evens2: PartialFunction[Int, Int] = {
+ val evens2: PartialFunction[Int, Int] = {
case x if x % 2 == 0 => x
}
@@ -21,7 +21,7 @@ object Test {
})
assert(f1 eq f3.lift)
- // Hmm, why is this not true:
- // assert(f2 eq f4.lift)
+ assert(f4 eq unlift(f2))
+ assert(f4 eq evens2)
}
}
diff --git a/test/files/run/reify_ann1a.check b/test/files/run/reify_ann1a.check
index 97d4848a49..66dce778a8 100644
--- a/test/files/run/reify_ann1a.check
+++ b/test/files/run/reify_ann1a.check
@@ -1,5 +1,5 @@
{
- @new ann(immutable.this.List.apply[String]("1a")) @new ann(immutable.this.List.apply[String]("1b")) class C[@new ann(immutable.this.List.apply[String]("2a")) @new ann(immutable.this.List.apply[String]("2b")) T>: Nothing <: Any] extends scala.AnyRef {
+ @new ann(immutable.this.List.apply[String]("1a")) @new ann(immutable.this.List.apply[String]("1b")) class C[@new ann(immutable.this.List.apply[String]("2a")) @new ann(immutable.this.List.apply[String]("2b")) T] extends scala.AnyRef {
@new ann(immutable.this.List.apply[String]("3a")) @new ann(immutable.this.List.apply[String]("3b")) <paramaccessor> private[this] val x: T @ann(immutable.this.List.apply[String]("4a")) @ann(immutable.this.List.apply[String]("4b")) = _;
def <init>(@new ann(immutable.this.List.apply[String]("3a")) @new ann(immutable.this.List.apply[String]("3b")) x: T @ann(immutable.this.List.apply[String]("4a")) @ann(immutable.this.List.apply[String]("4b"))) = {
super.<init>();
@@ -14,7 +14,7 @@
()
}
{
- @ann(immutable.this.List.apply[String]("1a")) @ann(immutable.this.List.apply[String]("1b")) class C[@ann(immutable.this.List.apply[String]("2a")) @ann(immutable.this.List.apply[String]("2b")) T>: Nothing <: Any] extends scala.AnyRef {
+ @ann(immutable.this.List.apply[String]("1a")) @ann(immutable.this.List.apply[String]("1b")) class C[@ann(immutable.this.List.apply[String]("2a")) @ann(immutable.this.List.apply[String]("2b")) T] extends scala.AnyRef {
@ann(immutable.this.List.apply[String]("3a")) @ann(immutable.this.List.apply[String]("3b")) <paramaccessor> private[this] val x: T @ann(immutable.this.List.apply[String]("4b")) @ann(immutable.this.List.apply[String]("4a")) = _;
def <init>(@ann(immutable.this.List.apply[String]("3a")) @ann(immutable.this.List.apply[String]("3b")) x: T @ann(immutable.this.List.apply[String]("4b")) @ann(immutable.this.List.apply[String]("4a"))): C[T] = {
C.super.<init>();
diff --git a/test/files/run/reify_ann1b.check b/test/files/run/reify_ann1b.check
index ceebc0e2ed..9bc65a422e 100644
--- a/test/files/run/reify_ann1b.check
+++ b/test/files/run/reify_ann1b.check
@@ -1,5 +1,5 @@
{
- @new ann(bar = "1a") @new ann(bar = "1b") class C[@new ann(bar = "2a") @new ann(bar = "2b") T>: Nothing <: Any] extends scala.AnyRef {
+ @new ann(bar = "1a") @new ann(bar = "1b") class C[@new ann(bar = "2a") @new ann(bar = "2b") T] extends scala.AnyRef {
@new ann(bar = "3a") @new ann(bar = "3b") <paramaccessor> private[this] val x: T @ann(bar = "4a") @ann(bar = "4b") = _;
def <init>(@new ann(bar = "3a") @new ann(bar = "3b") x: T @ann(bar = "4a") @ann(bar = "4b")) = {
super.<init>();
@@ -14,7 +14,7 @@
()
}
{
- @ann(bar = "1a") @ann(bar = "1b") class C[@ann(bar = "2a") @ann(bar = "2b") T>: Nothing <: Any] extends scala.AnyRef {
+ @ann(bar = "1a") @ann(bar = "1b") class C[@ann(bar = "2a") @ann(bar = "2b") T] extends scala.AnyRef {
@ann(bar = "3a") @ann(bar = "3b") <paramaccessor> private[this] val x: T @ann(bar = "4b") @ann(bar = "4a") = _;
def <init>(@ann(bar = "3a") @ann(bar = "3b") x: T @ann(bar = "4b") @ann(bar = "4a")): C[T] = {
C.super.<init>();
diff --git a/test/files/run/si4750.check b/test/files/run/si4750.check
new file mode 100644
index 0000000000..bf55f70df3
--- /dev/null
+++ b/test/files/run/si4750.check
@@ -0,0 +1 @@
+US$ 5.80
diff --git a/test/files/run/si4750.scala b/test/files/run/si4750.scala
new file mode 100644
index 0000000000..96d2c4fec7
--- /dev/null
+++ b/test/files/run/si4750.scala
@@ -0,0 +1,7 @@
+import scala.util.matching.Regex
+
+object Test extends App {
+ val input = "CURRENCY 5.80"
+ println("CURRENCY".r.replaceAllIn(input, Regex quoteReplacement "US$"))
+}
+
diff --git a/test/files/run/t4574.check b/test/files/run/t4574.check
new file mode 100644
index 0000000000..a4522fff24
--- /dev/null
+++ b/test/files/run/t4574.check
@@ -0,0 +1,2 @@
+I hereby refute null!
+I denounce null as unListLike!
diff --git a/test/files/run/t4574.scala b/test/files/run/t4574.scala
new file mode 100644
index 0000000000..1dde496aca
--- /dev/null
+++ b/test/files/run/t4574.scala
@@ -0,0 +1,13 @@
+object Test {
+ val xs: List[(Int, Int)] = List((2, 2), null)
+
+ def expectMatchError[T](msg: String)(body: => T) {
+ try { body ; assert(false, "Should not succeed.") }
+ catch { case _: MatchError => println(msg) }
+ }
+
+ def main(args: Array[String]): Unit = {
+ expectMatchError("I hereby refute null!")( for ((x, y) <- xs) yield x )
+ expectMatchError("I denounce null as unListLike!")( (null: Any) match { case List(_*) => true } )
+ }
+}
diff --git a/test/files/run/valueclasses-constr.check b/test/files/run/valueclasses-constr.check
index df37fbc723..785e6fa25b 100644
--- a/test/files/run/valueclasses-constr.check
+++ b/test/files/run/valueclasses-constr.check
@@ -1,2 +1,10 @@
-0
+16
+00:16:40
+16
+00:16:40
+16
+00:16:40
+16
+00:16:40
+16
00:16:40
diff --git a/test/files/run/valueclasses-constr.scala b/test/files/run/valueclasses-constr.scala
index 7a10299386..652d8d8d22 100644
--- a/test/files/run/valueclasses-constr.scala
+++ b/test/files/run/valueclasses-constr.scala
@@ -1,25 +1,79 @@
-object TOD {
- final val SecondsPerDay = 86400
+package test1 {
+ object TOD {
+ final val SecondsPerDay = 86400
- def apply(seconds: Int) = {
- val n = seconds % SecondsPerDay
- new TOD(if (n >= 0) n else n + SecondsPerDay)
- }
+ def apply(seconds: Int) = {
+ val n = seconds % SecondsPerDay
+ new TOD(if (n >= 0) n else n + SecondsPerDay)
+ }
+ }
+
+ final class TOD (val secondsOfDay: Int) extends AnyVal {
+ def hours = secondsOfDay / 3600
+ def minutes = (secondsOfDay / 60) % 60
+ def seconds = secondsOfDay % 60
+
+ override def toString = "%02d:%02d:%02d".format(hours, minutes, seconds)
+ }
}
+package test2 {
+ object TOD {
+ final val SecondsPerDay = 86400
+
+ def apply(seconds: Int) = {
+ val n = seconds % SecondsPerDay
+ new TOD(if (n >= 0) n else n + SecondsPerDay)
+ }
+ }
+
+ final class TOD private[test2] (val secondsOfDay: Int) extends AnyVal {
+ def hours = secondsOfDay / 3600
+ def minutes = (secondsOfDay / 60) % 60
+ def seconds = secondsOfDay % 60
+
+ override def toString = "%02d:%02d:%02d".format(hours, minutes, seconds)
+ }
+
+ object Client {
+ def newTOD(x: Int) = new TOD(x)
+ }
+}
+
+package test3 {
+ object TOD {
+ final val SecondsPerDay = 86400
+
+ def apply(seconds: Int) = {
+ val n = seconds % SecondsPerDay
+ new TOD(if (n >= 0) n else n + SecondsPerDay)
+ }
+ }
-final class TOD (val secondsOfDay: Int) extends AnyVal {
- def hours = secondsOfDay / 3600
- def minutes = (secondsOfDay / 60) % 60
- def seconds = secondsOfDay % 60
+ final class TOD private (val secondsOfDay: Int) extends AnyVal {
+ def hours = secondsOfDay / 3600
+ def minutes = (secondsOfDay / 60) % 60
+ def seconds = secondsOfDay % 60
- override def toString = "%02d:%02d:%02d".format(hours, minutes, seconds)
+ override def toString = "%02d:%02d:%02d".format(hours, minutes, seconds)
+ }
}
object Test extends App {
- val y: TOD = new TOD(1000)
- val x: TOD = TOD(1000)
- println(x.hours)
- println(x)
+ val y1: test1.TOD = new test1.TOD(1000)
+ val y2: test2.TOD = test2.Client.newTOD(1000)
+ val x1: test1.TOD = test1.TOD(1000)
+ val x2: test2.TOD = test2.TOD(1000)
+ val x3: test3.TOD = test3.TOD(1000)
+ println(y1.minutes)
+ println(y1)
+ println(y2.minutes)
+ println(y2)
+ println(x1.minutes)
+ println(x1)
+ println(x2.minutes)
+ println(x2)
+ println(x3.minutes)
+ println(x3)
}
diff --git a/test/files/run/virtpatmat_extends_product.check b/test/files/run/virtpatmat_extends_product.check
new file mode 100644
index 0000000000..c07e8385a7
--- /dev/null
+++ b/test/files/run/virtpatmat_extends_product.check
@@ -0,0 +1 @@
+AnnotationInfo(a,1)
diff --git a/test/files/run/virtpatmat_extends_product.flags b/test/files/run/virtpatmat_extends_product.flags
new file mode 100644
index 0000000000..ac6b805bd0
--- /dev/null
+++ b/test/files/run/virtpatmat_extends_product.flags
@@ -0,0 +1 @@
+-Yvirtpatmat
diff --git a/test/files/run/virtpatmat_extends_product.scala b/test/files/run/virtpatmat_extends_product.scala
new file mode 100644
index 0000000000..e564f4430b
--- /dev/null
+++ b/test/files/run/virtpatmat_extends_product.scala
@@ -0,0 +1,11 @@
+object Test extends App {
+ case class AnnotationInfo(a: String, b: Int) extends Product2[String, Int]
+
+ // if we're not careful in unapplyTypeListFromReturnType, the generated unapply is
+ // thought to return two components instead of one, since AnnotationInfo (the result of the unapply) is a Product2
+ case class NestedAnnotArg(ai: AnnotationInfo)
+
+ NestedAnnotArg(AnnotationInfo("a", 1)) match {
+ case NestedAnnotArg(x) => println(x)
+ }
+} \ No newline at end of file
diff --git a/test/files/run/virtpatmat_partial.check b/test/files/run/virtpatmat_partial.check
index 1555eca82b..137d16da79 100644
--- a/test/files/run/virtpatmat_partial.check
+++ b/test/files/run/virtpatmat_partial.check
@@ -1,4 +1,17 @@
Map(a -> Some(1), b -> None)
-79
-undefined
Map(a -> 1)
+a
+undefined
+a
+undefined
+a
+undefined
+a
+undefined
+hai!
+hai!
+2
+hai!
+undefined
+1
+undefined
diff --git a/test/files/run/virtpatmat_partial.scala b/test/files/run/virtpatmat_partial.scala
index 6597f2f5ae..a235314610 100644
--- a/test/files/run/virtpatmat_partial.scala
+++ b/test/files/run/virtpatmat_partial.scala
@@ -2,95 +2,180 @@ object Test extends App {
val a = Map("a" -> Some(1), "b" -> None)
println(a)
+// inferred type should be Map[String, Int]
val res = a collect {case (p, Some(a)) => (p, a)}
- final val GT = 79
- final val GTGT = 93
- final val GTGTGT = 94
- final val GTEQ = 81
- final val GTGTEQ = 113
- final val GTGTGTEQ = 114
- final val ASSIGN = 75
-
- def acceptClosingAngle(in: Int) {
- val closers: PartialFunction[Int, Int] = {
- case GTGTGTEQ => GTGTEQ
- case GTGTGT => GTGT
- case GTGTEQ => GTEQ
- case GTGT => GT
- case GTEQ => ASSIGN
+// variations: const target -> switch, non-const -> normal match, char target --> scrut needs toInt,
+// eta-expanded --> work is done by typedFunction, non-eta-expanded --> typedMatch
+
+ object nonConstCharEta {
+ final val GT : Char = 'a'
+ final val GTGT : Char = 'b'
+ final val GTGTGT : Char = 'c'
+ final val GTEQ : Char = 'd'
+ final val GTGTEQ : Char = 'e'
+ final val GTGTGTEQ: Char = 'f'
+ final val ASSIGN : Char = 'g'
+
+ def acceptClosingAngle(in: Char) {
+ val closers: PartialFunction[Char, Char] = {
+ case GTGTGTEQ => GTGTEQ
+ case GTGTGT => GTGT
+ case GTGTEQ => GTEQ
+ case GTGT => GT
+ case GTEQ => ASSIGN
+ }
+ if (closers isDefinedAt in) println(closers(in))
+ else println("undefined")
+ }
+
+ def test() = {
+ acceptClosingAngle(GTGT)
+ acceptClosingAngle(ASSIGN)
+ }
+ }
+
+ object nonConstChar {
+ final val GT : Char = 'a'
+ final val GTGT : Char = 'b'
+ final val GTGTGT : Char = 'c'
+ final val GTEQ : Char = 'd'
+ final val GTGTEQ : Char = 'e'
+ final val GTGTGTEQ: Char = 'f'
+ final val ASSIGN : Char = 'g'
+
+ def acceptClosingAngle(in: Char) {
+ val closers: PartialFunction[Char, Char] = x => x match {
+ case GTGTGTEQ => GTGTEQ
+ case GTGTGT => GTGT
+ case GTGTEQ => GTEQ
+ case GTGT => GT
+ case GTEQ => ASSIGN
+ }
+ if (closers isDefinedAt in) println(closers(in))
+ else println("undefined")
+ }
+
+ def test() = {
+ acceptClosingAngle(GTGT)
+ acceptClosingAngle(ASSIGN)
}
- if (closers isDefinedAt in) println(closers(in))
- else println("undefined")
}
- acceptClosingAngle(GTGT)
- acceptClosingAngle(ASSIGN)
-
- // should uncurry to:
- // val res: Map[String,Int] = a.collect[(String, Int), Map[String,Int]](
- // new PartialFunction[(String, Option[Int]),(String, Int)] {
- // def apply(x0_1: (String, Option[Int])): (String, Int) = MatchingStrategy.OptionMatchingStrategy.runOrElse[(String, Option[Int]), (String, Int)](x0_1)(
- // (x1: (String, Option[Int])) => {
- // val o9: Option[(String, Int)] = ({
- // val o8: Option[(String, Option[Int])] = Tuple2.unapply[String, Option[Int]](x1);
- // if (o8.isEmpty)
- // MatchingStrategy.OptionMatchingStrategy.zero
- // else
- // {
- // val o7: Option[Some[Int]] = if (o8.get._2.isInstanceOf[Some[Int]])
- // MatchingStrategy.OptionMatchingStrategy.one[Some[Int]](o8.get._2.asInstanceOf[Some[Int]])
- // else
- // MatchingStrategy.OptionMatchingStrategy.zero;
- // if (o7.isEmpty)
- // MatchingStrategy.OptionMatchingStrategy.zero
- // else
- // {
- // val o6: Option[Int] = Some.unapply[Int](o7.get);
- // if (o6.isEmpty)
- // MatchingStrategy.OptionMatchingStrategy.zero
- // else
- // MatchingStrategy.OptionMatchingStrategy.one[(String, Int)]((o8.get._1, o6.get).asInstanceOf[(String, Int)])
- // }
- // }
- // }: Option[(String, Int)]);
- // if (o9.isEmpty)
- // (MatchingStrategy.OptionMatchingStrategy.zero: Option[(String, Int)])
- // else
- // o9
- // })
- //
- // def isDefinedAt(x_1: (String, Option[Int])): Boolean = MatchingStrategy.OptionMatchingStrategy.isSuccess[(String, Option[Int]), (String, Int)](x_1)(
- // (x1: (String, Option[Int])) => {
- // val o9: Option[(String, Int)] = ({
- // val o8: Option[(String, Option[Int])] = scala.Tuple2.unapply[String, Option[Int]](x1);
- // if (o8.isEmpty)
- // MatchingStrategy.OptionMatchingStrategy.zero
- // else
- // {
- // val o7: Option[Some[Int]] = if (o8.get._2.isInstanceOf[Some[Int]])
- // MatchingStrategy.OptionMatchingStrategy.one[Some[Int]](o8.get._2.asInstanceOf[Some[Int]]) // XXX
- // else
- // MatchingStrategy.OptionMatchingStrategy.zero;
- // if (o7.isEmpty)
- // MatchingStrategy.OptionMatchingStrategy.zero
- // else
- // {
- // val o6: Option[Int] = scala.Some.unapply[Int](o7.get);
- // if (o6.isEmpty)
- // MatchingStrategy.OptionMatchingStrategy.zero
- // else
- // MatchingStrategy.OptionMatchingStrategy.one[(String, Int)](null.asInstanceOf[(String, Int)])
- // }
- // }
- // }: Option[(String, Int)]);
- // if (o9.isEmpty)
- // (MatchingStrategy.OptionMatchingStrategy.zero: Option[(String, Int)])
- // else
- // o9
- // })
- // }
- // )
-
- println(res)
+ object constCharEta {
+ final val GT = 'a'
+ final val GTGT = 'b'
+ final val GTGTGT = 'c'
+ final val GTEQ = 'd'
+ final val GTGTEQ = 'e'
+ final val GTGTGTEQ= 'f'
+ final val ASSIGN = 'g'
+
+ def acceptClosingAngle(in: Char) {
+ val closers: PartialFunction[Char, Char] = x => x match {
+ case GTGTGTEQ => GTGTEQ
+ case GTGTGT => GTGT
+ case GTGTEQ => GTEQ
+ case GTGT => GT
+ case GTEQ => ASSIGN
+ }
+ if (closers isDefinedAt in) println(closers(in))
+ else println("undefined")
+ }
+
+ def test() = {
+ acceptClosingAngle(GTGT)
+ acceptClosingAngle(ASSIGN)
+ }
+ }
+
+ object constChar {
+ final val GT = 'a'
+ final val GTGT = 'b'
+ final val GTGTGT = 'c'
+ final val GTEQ = 'd'
+ final val GTGTEQ = 'e'
+ final val GTGTGTEQ= 'f'
+ final val ASSIGN = 'g'
+
+ def acceptClosingAngle(in: Char) {
+ val closers: PartialFunction[Char, Char] = {
+ case GTGTGTEQ => GTGTEQ
+ case GTGTGT => GTGT
+ case GTGTEQ => GTEQ
+ case GTGT => GT
+ case GTEQ => ASSIGN
+ }
+ if (closers isDefinedAt in) println(closers(in))
+ else println("undefined")
+ }
+
+ def test() = {
+ acceptClosingAngle(GTGT)
+ acceptClosingAngle(ASSIGN)
+ }
+ }
+
+ object constIntEta {
+ final val GT = 1
+ final val GTGT = 2
+ final val GTGTGT = 3
+ final val GTEQ = 4
+ final val GTGTEQ = 5
+ final val GTGTGTEQ = 6
+ final val ASSIGN = 7
+
+ def acceptClosingAngle(in: Int) {
+ val closers: PartialFunction[Int, Int] = x => {println("hai!"); (x + 1)} match {
+ case GTGTGTEQ => GTGTEQ
+ case GTGTGT => GTGT
+ case GTGTEQ => GTEQ
+ case GTGT => GT
+ case GTEQ => ASSIGN
+ }
+ if (closers isDefinedAt in) println(closers(in))
+ else println("undefined")
+ }
+
+ def test() = {
+ acceptClosingAngle(GTGT)
+ acceptClosingAngle(ASSIGN)
+ }
+ }
+
+ object constInt {
+ final val GT = 1
+ final val GTGT = 2
+ final val GTGTGT = 3
+ final val GTEQ = 4
+ final val GTGTEQ = 5
+ final val GTGTGTEQ = 6
+ final val ASSIGN = 7
+
+ def acceptClosingAngle(in: Int) {
+ val closers: PartialFunction[Int, Int] = {
+ case GTGTGTEQ => GTGTEQ
+ case GTGTGT => GTGT
+ case GTGTEQ => GTEQ
+ case GTGT => GT
+ case GTEQ => ASSIGN
+ }
+ if (closers isDefinedAt in) println(closers(in))
+ else println("undefined")
+ }
+
+ def test() = {
+ acceptClosingAngle(GTGT)
+ acceptClosingAngle(ASSIGN)
+ }
+ }
+
+ println(res) // prints "Map(a -> 1)"
+
+ nonConstCharEta.test()
+ nonConstChar.test()
+ constCharEta.test()
+ constChar.test()
+ constIntEta.test()
+ constInt.test()
}
diff --git a/test/files/run/virtpatmat_tailcalls_verifyerror.check b/test/files/run/virtpatmat_tailcalls_verifyerror.check
new file mode 100644
index 0000000000..c508d5366f
--- /dev/null
+++ b/test/files/run/virtpatmat_tailcalls_verifyerror.check
@@ -0,0 +1 @@
+false
diff --git a/test/files/run/virtpatmat_tailcalls_verifyerror.flags b/test/files/run/virtpatmat_tailcalls_verifyerror.flags
new file mode 100644
index 0000000000..9769db9257
--- /dev/null
+++ b/test/files/run/virtpatmat_tailcalls_verifyerror.flags
@@ -0,0 +1 @@
+ -Yvirtpatmat -Xexperimental
diff --git a/test/files/run/virtpatmat_tailcalls_verifyerror.scala b/test/files/run/virtpatmat_tailcalls_verifyerror.scala
new file mode 100644
index 0000000000..5ce91e8dce
--- /dev/null
+++ b/test/files/run/virtpatmat_tailcalls_verifyerror.scala
@@ -0,0 +1,14 @@
+// shouldn't result in a verify error when run...
+object Test extends App {
+ @annotation.tailrec
+ final def test(meh: Boolean): Boolean = {
+ Some("a") match {
+ case x =>
+ x match {
+ case Some(_) => if(meh) test(false) else false
+ case _ => test(false)
+ }
+ }
+ }
+ println(test(true))
+} \ No newline at end of file
diff --git a/test/files/scalacheck/t2460.scala b/test/files/scalacheck/t2460.scala
new file mode 100644
index 0000000000..196b43789f
--- /dev/null
+++ b/test/files/scalacheck/t2460.scala
@@ -0,0 +1,32 @@
+import org.scalacheck.Prop.forAll
+import org.scalacheck.Properties
+import org.scalacheck.ConsoleReporter.testStatsEx
+import org.scalacheck.{Test => SCTest}
+import org.scalacheck.Gen
+
+object Test extends Properties("Regex : Ticket 2460") {
+
+ val vowel = Gen.oneOf("a", "z")
+
+ val numberOfMatch = forAll(vowel) {
+ (s: String) => "\\s*([a-z])\\s*".r("data").findAllMatchIn((1 to 20).map(_ => s).mkString).size == 20
+ }
+
+ val numberOfGroup = forAll(vowel) {
+ (s: String) => "\\s*([a-z])\\s*([a-z])\\s*".r("data").findAllMatchIn((1 to 20).map(_ => s).mkString).next.groupCount == 2
+ }
+
+ val nameOfGroup = forAll(vowel) {
+ (s: String) => "([a-z])".r("data").findAllMatchIn(s).next.group("data") == s
+ }
+
+ val tests = List(
+ ("numberOfMatch", numberOfMatch),
+ ("numberOfGroup", numberOfGroup),
+ ("nameOfGroup", nameOfGroup)
+ )
+
+ /*tests foreach {
+ case (name, p) => testStatsEx(name, SCTest.check(p))
+ }*/
+}
diff --git a/test/pending/pos/t1476.scala b/test/pending/pos/t1476.scala
new file mode 100644
index 0000000000..1f8e95c28f
--- /dev/null
+++ b/test/pending/pos/t1476.scala
@@ -0,0 +1,23 @@
+abstract class Module {
+ def moduleDemands(): List[Module]
+}
+
+object Test {
+ new Module { owner: Module =>
+ def moduleDemands() = Nil
+
+ val a = new Module { def moduleDemands(): List[Module] = Nil }
+ val b = new Module { def moduleDemands(): List[Module] = owner :: c :: Nil }
+ val c = new Module { def moduleDemands(): List[Module] = owner :: a :: Nil }
+ }
+}
+
+object Test2 {
+ new Module { owner =>
+ def moduleDemands() = Nil
+
+ val a = new Module { def moduleDemands(): List[Module] = Nil }
+ val b = new Module { def moduleDemands(): List[Module] = owner :: c :: Nil }
+ val c = new Module { def moduleDemands(): List[Module] = owner :: a :: Nil }
+ }
+}
diff --git a/test/pending/pos/t5626.scala b/test/pending/pos/t5626.scala
new file mode 100644
index 0000000000..7ab3881827
--- /dev/null
+++ b/test/pending/pos/t5626.scala
@@ -0,0 +1,12 @@
+object Test {
+ val blob0 = new {
+ case class Foo(i : Int)
+ }
+ val foo0 = blob0.Foo(22)
+
+ val blob1 = new {
+ class Foo(i: Int)
+ object Foo { def apply(i: Int): Foo = new Foo(i) }
+ }
+ val foo1 = blob1.Foo(22)
+}
diff --git a/test/pending/run/implicit-classes.scala b/test/pending/run/implicit-classes.scala
new file mode 100644
index 0000000000..02b74de2b0
--- /dev/null
+++ b/test/pending/run/implicit-classes.scala
@@ -0,0 +1,17 @@
+object O {
+ implicit class C(s: String) {
+ def twice = s + s
+ }
+}
+
+/**
+//
+// We'd like to augment object O in Namers so that it also has an implicit method
+object O {
+ implicit class C(s: String) {
+ def twice = s + s
+ }
+ implicit def C(s: String): C = new C(s)
+}
+
+**/
diff --git a/test/pending/run/t5629.check b/test/pending/run/t5629.check
new file mode 100644
index 0000000000..6a2d630f4e
--- /dev/null
+++ b/test/pending/run/t5629.check
@@ -0,0 +1,2 @@
+int child got: 33
+any child got: 33
diff --git a/test/pending/run/t5629.scala b/test/pending/run/t5629.scala
new file mode 100644
index 0000000000..28e74a1c94
--- /dev/null
+++ b/test/pending/run/t5629.scala
@@ -0,0 +1,25 @@
+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)
+ }
+}
diff --git a/test/pending/run/virtpatmat_anonfun_underscore.check b/test/pending/run/virtpatmat_anonfun_underscore.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/pending/run/virtpatmat_anonfun_underscore.check
diff --git a/test/pending/run/virtpatmat_anonfun_underscore.flags b/test/pending/run/virtpatmat_anonfun_underscore.flags
new file mode 100644
index 0000000000..23e3dc7d26
--- /dev/null
+++ b/test/pending/run/virtpatmat_anonfun_underscore.flags
@@ -0,0 +1 @@
+-Yvirtpatmat \ No newline at end of file
diff --git a/test/pending/run/virtpatmat_anonfun_underscore.scala b/test/pending/run/virtpatmat_anonfun_underscore.scala
new file mode 100644
index 0000000000..db6705d025
--- /dev/null
+++ b/test/pending/run/virtpatmat_anonfun_underscore.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ List(1,2,3) map (_ match { case x => x + 1} ) // `_ match` is redundant but shouldn't crash the compiler
+ List((1,2)) map (_ match { case (x, z) => x + z})
+} \ No newline at end of file
diff --git a/test/scaladoc/resources/code-indent.scala b/test/scaladoc/resources/code-indent.scala
new file mode 100644
index 0000000000..88946ffc7f
--- /dev/null
+++ b/test/scaladoc/resources/code-indent.scala
@@ -0,0 +1,37 @@
+/**
+ * This is an example of indented comments:
+ * {{{
+ * a typicial indented
+ * comment on multiple
+ * comment lines
+ * }}}
+ * {{{ one liner }}}
+ * {{{ two lines, one useful
+ * }}}
+ * {{{
+ * line1
+ * line2
+ * line3
+ * line4}}}
+ * {{{
+ * a ragged example
+ * a (condition)
+ * the t h e n branch
+ * an alternative
+ * the e l s e branch
+ * }}}
+ * NB: Trailing spaces are necessary for this test!
+ * {{{
+ * l1
+ *
+ * l2
+ *
+ * l3
+ *
+ * l4
+ *
+ * l5
+ * }}}
+
+ */
+class C
diff --git a/test/scaladoc/run/SI-5373.check b/test/scaladoc/run/SI-5373.check
new file mode 100644
index 0000000000..c55eb001cf
--- /dev/null
+++ b/test/scaladoc/run/SI-5373.check
@@ -0,0 +1 @@
+model contains 6 documentable templates
diff --git a/test/scaladoc/run/SI-5373.scala b/test/scaladoc/run/SI-5373.scala
new file mode 100644
index 0000000000..af433a1844
--- /dev/null
+++ b/test/scaladoc/run/SI-5373.scala
@@ -0,0 +1,34 @@
+import scala.tools.nsc.doc.model._
+import scala.tools.partest.ScaladocModelTest
+
+object Test extends ScaladocModelTest {
+
+ def code = """
+ import scala.annotation.bridge
+
+ package scala.test {
+
+ trait A {
+ def foo = ()
+ }
+
+ trait B {
+ @bridge()
+ def foo = ()
+ }
+
+ class C extends A with B
+ }
+ """
+
+ // no need for special settings
+ def scaladocSettings = ""
+
+ def testModel(rootPackage: Package) = {
+ // get the quick access implicit defs in scope (_package(s), _class(es), _trait(s), object(s) _method(s), _value(s))
+ import access._
+
+ // just need to check the member exists, access methods will throw an error if there's a problem
+ rootPackage._package("scala")._package("test")._class("C")._method("foo")
+ }
+} \ No newline at end of file
diff --git a/test/scaladoc/scala/html.flags b/test/scaladoc/scala/html.flags
deleted file mode 100644
index b2264ec4f4..0000000000
--- a/test/scaladoc/scala/html.flags
+++ /dev/null
@@ -1 +0,0 @@
--encoding UTF-8 \ No newline at end of file
diff --git a/test/scaladoc/scala/model/CommentFactoryTest.scala b/test/scaladoc/scalacheck/CommentFactoryTest.scala
index 69c314a64c..69c314a64c 100644
--- a/test/scaladoc/scala/model/CommentFactoryTest.scala
+++ b/test/scaladoc/scalacheck/CommentFactoryTest.scala
diff --git a/test/scaladoc/scala/html/HtmlFactoryTest.flags b/test/scaladoc/scalacheck/HtmlFactoryTest.flags
index b2264ec4f4..b2264ec4f4 100644
--- a/test/scaladoc/scala/html/HtmlFactoryTest.flags
+++ b/test/scaladoc/scalacheck/HtmlFactoryTest.flags
diff --git a/test/scaladoc/scala/html/HtmlFactoryTest.scala b/test/scaladoc/scalacheck/HtmlFactoryTest.scala
index 67358e6e70..5b6f75426e 100644
--- a/test/scaladoc/scala/html/HtmlFactoryTest.scala
+++ b/test/scaladoc/scalacheck/HtmlFactoryTest.scala
@@ -50,7 +50,7 @@ object Test extends Properties("HtmlFactory") {
def createTemplates(basename: String) = {
val result = scala.collection.mutable.Map[String, scala.xml.NodeSeq]()
- createFactory.makeUniverse(List(RESOURCES+basename)) match {
+ createFactory.makeUniverse(Left(List(RESOURCES+basename))) match {
case Some(universe) => {
val index = IndexModelFactory.makeIndex(universe)
(new HtmlFactory(universe, index)).writeTemplates((page) => {
@@ -64,7 +64,7 @@ object Test extends Properties("HtmlFactory") {
}
def createReferenceIndex(basename: String) = {
- createFactory.makeUniverse(List(RESOURCES+basename)) match {
+ createFactory.makeUniverse(Left(List(RESOURCES+basename))) match {
case Some(universe) => {
val index = IndexModelFactory.makeIndex(universe)
val pages = index.firstLetterIndex.map({
@@ -442,8 +442,9 @@ object Test extends Properties("HtmlFactory") {
property("Use cases should override their original members") =
checkText("SI_5054_q1.scala")(
- (None,"""def test(): Int""", true),
- (None,"""def test(implicit lost: Int): Int""", false)
+ (None,"""def test(): Int""", true)
+ //Disabled because the full signature is now displayed
+ //(None,"""def test(implicit lost: Int): Int""", false)
)
property("Use cases should keep their flags - final should not be lost") =
@@ -599,8 +600,9 @@ object Test extends Properties("HtmlFactory") {
T StartT the type of the first argument EndT
arg1 Start1 The T term comment End1
arg2 Start2 The string comment End2
- returns StartRet The return comment EndRet
- Definition Classes InheritDocDerived → InheritDocBase
+ returns StartRet The return comment EndRet""", true),
+ (Some("InheritDocDerived"),
+ """Definition Classes InheritDocDerived → InheritDocBase
Example: StartExample function[Int](3, "something") EndExample
Version StartVer 0.0.2 EndVer
Since StartSince 0.0.1 EndSince
@@ -624,8 +626,9 @@ object Test extends Properties("HtmlFactory") {
T StartT the type of the first argument EndT
arg1 Start1 The T term comment End1
arg2 Start2 The string comment End2
- returns StartRet The return comment EndRet
- Example: StartExample function[Int](3,"something") EndExample
+ returns StartRet The return comment EndRet""", true),
+ (Some("UseCaseInheritDoc"),
+ """Example: StartExample function[Int](3,"something") EndExample
Version StartVer 0.0.2 EndVer
Since StartSince 0.0.1 EndSince
Exceptions thrown
@@ -671,6 +674,23 @@ object Test extends Properties("HtmlFactory") {
// traits E, F and H shouldn't crash scaladoc but we don't need to check the output
)
+ property("Indentation normalization for code blocks") = {
+ val files = createTemplates("code-indent.scala")
+
+ files("C.html") match {
+ case node: scala.xml.Node => {
+ val s = node.toString
+ s.contains("<pre>a typicial indented\ncomment on multiple\ncomment lines</pre>") &&
+ s.contains("<pre>one liner</pre>") &&
+ s.contains("<pre>two lines, one useful</pre>") &&
+ s.contains("<pre>line1\nline2\nline3\nline4</pre>") &&
+ s.contains("<pre>a ragged example\na (condition)\n the t h e n branch\nan alternative\n the e l s e branch</pre>") &&
+ s.contains("<pre>l1\n\nl2\n\nl3\n\nl4\n\nl5</pre>")
+ }
+ case _ => false
+ }
+ }
+
{
val files = createTemplates("basic.scala")
//println(files)
diff --git a/test/scaladoc/scala/IndexScriptTest.scala b/test/scaladoc/scalacheck/IndexScriptTest.scala
index e0372020fd..5aef38e00a 100644
--- a/test/scaladoc/scala/IndexScriptTest.scala
+++ b/test/scaladoc/scalacheck/IndexScriptTest.scala
@@ -24,7 +24,7 @@ object Test extends Properties("IndexScript") {
val indexModelFactory = doc.model.IndexModelFactory
def createIndexScript(path: String) =
- docFactory.makeUniverse(List(path)) match {
+ docFactory.makeUniverse(Left(List(path))) match {
case Some(universe) => {
val index = new IndexScript(universe,
indexModelFactory.makeIndex(universe))
diff --git a/test/scaladoc/scala/IndexTest.scala b/test/scaladoc/scalacheck/IndexTest.scala
index c14fd98297..29e337da2b 100644
--- a/test/scaladoc/scala/IndexTest.scala
+++ b/test/scaladoc/scalacheck/IndexTest.scala
@@ -37,7 +37,7 @@ object Test extends Properties("Index") {
//val original = Console.out
//Console.setOut(stream)
- val result = docFactory.makeUniverse(List(path))
+ val result = docFactory.makeUniverse(Left(List(path)))
// assert(stream.toString == "model contains 2 documentable templates\n")
//Console.setOut(original)