summaryrefslogtreecommitdiff
path: root/test/files/neg
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/neg')
-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
32 files changed, 203 insertions, 64 deletions
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)
-}
-}
-
-