aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorvsalvis <salvisbergvera@gmail.com>2015-07-10 17:01:35 +0200
committerVladimirNik <vladimir.nikolaev9@gmail.com>2016-02-18 17:54:45 +0100
commit1ed38673d4c88d573363459d316fdfe275d05025 (patch)
tree6ae87391dab765853b97c81dfa4f05bbba2e527b /tests
parent4be70a5a8469c1355c84bef70936a81f899a9678 (diff)
downloaddotty-1ed38673d4c88d573363459d316fdfe275d05025.tar.gz
dotty-1ed38673d4c88d573363459d316fdfe275d05025.tar.bz2
dotty-1ed38673d4c88d573363459d316fdfe275d05025.zip
Negtests with // error comments
Diffstat (limited to 'tests')
-rw-r--r--tests/neg/arrayclone-new.scala4
-rw-r--r--tests/neg/assignments.scala4
-rw-r--r--tests/neg/autoTuplingTest.scala4
-rw-r--r--tests/neg/blockescapesNeg.scala2
-rw-r--r--tests/neg/boundspropagation.scala8
-rw-r--r--tests/neg/companions.scala2
-rw-r--r--tests/neg/cycles.scala8
-rw-r--r--tests/neg/escapingRefs.scala4
-rw-r--r--tests/neg/i0091-infpaths.scala6
-rw-r--r--tests/neg/i0248-inherit-refined.scala8
-rw-r--r--tests/neg/i0281-null-primitive-conforms.scala6
-rw-r--r--tests/neg/i0583-skolemize.scala4
-rw-r--r--tests/neg/i39.scala4
-rw-r--r--tests/neg/i50-volatile.scala10
-rw-r--r--tests/neg/instantiateAbstract.scala4
-rw-r--r--tests/neg/over.scala6
-rw-r--r--tests/neg/privates.scala4
-rw-r--r--tests/neg/subtyping.scala6
-rw-r--r--tests/neg/t1569-failedAvoid.scala2
-rw-r--r--tests/neg/t1843-variances.scala2
-rw-r--r--tests/neg/t2660.scala4
-rw-r--r--tests/neg/t2994.scala7
-rw-r--r--tests/neg/tailcall/t1672b.scala12
-rw-r--r--tests/neg/tailcall/t3275.scala2
-rw-r--r--tests/neg/tailcall/t6574.scala4
-rw-r--r--tests/neg/tailcall/tailrec-2.scala2
-rw-r--r--tests/neg/tailcall/tailrec-3.scala4
-rw-r--r--tests/neg/tailcall/tailrec.scala12
-rw-r--r--tests/neg/traitParamsTyper.scala2
-rw-r--r--tests/neg/typedIdents/typedIdents.scala4
-rw-r--r--tests/neg/typers.scala8
-rw-r--r--tests/neg/typetest.scala2
-rw-r--r--tests/neg/variances.scala4
-rw-r--r--tests/neg/zoo.scala24
-rw-r--r--tests/pos/autoTuplingTest.scala4
-rw-r--r--tests/pos/t0273.scala2
-rw-r--r--tests/pos/t1279a.scala4
37 files changed, 100 insertions, 99 deletions
diff --git a/tests/neg/arrayclone-new.scala b/tests/neg/arrayclone-new.scala
index 4e33a7d8c..0e42545f8 100644
--- a/tests/neg/arrayclone-new.scala
+++ b/tests/neg/arrayclone-new.scala
@@ -7,7 +7,7 @@ object Test extends dotty.runtime.LegacyApp{
}
object ObjectArrayClone{
- val it : Array[String] = Array("1", "0");
+ val it : Array[String] = Array("1", "0"); // error
val cloned = it.clone();
assert(cloned.sameElements(it));
cloned(0) = "0";
@@ -22,7 +22,7 @@ object PolymorphicArrayClone{
assert(it(0) == one)
}
- testIt(Array("one", "two"), "one", "two");
+ testIt(Array("one", "two"), "one", "two"); // error
class Mangler[T: ClassTag](ts : T*){
// this will always be a BoxedAnyArray even after we've unboxed its contents.
diff --git a/tests/neg/assignments.scala b/tests/neg/assignments.scala
index 2314783fe..5be107717 100644
--- a/tests/neg/assignments.scala
+++ b/tests/neg/assignments.scala
@@ -13,11 +13,11 @@ object assignments {
x = x + 1
x *= 2
- x_= = 2 // should give missing arguments + reassignment to val
+ x_= = 2 // error should give missing arguments + // error reassignment to val
}
var c = new C
- import c._ // should give: prefix is not stable
+ import c._ // error should give: prefix is not stable
x = x + 1
x *= 2
}
diff --git a/tests/neg/autoTuplingTest.scala b/tests/neg/autoTuplingTest.scala
index d4a698271..f72dfb635 100644
--- a/tests/neg/autoTuplingTest.scala
+++ b/tests/neg/autoTuplingTest.scala
@@ -2,10 +2,10 @@ import dotty.language.noAutoTupling
object autoTuplingNeg {
- val x = Some(1, 2)
+ val x = Some(1, 2) // error
x match {
- case Some(a, b) => a + b
+ case Some(a, b) => a + b // error // error // error
case None =>
}
}
diff --git a/tests/neg/blockescapesNeg.scala b/tests/neg/blockescapesNeg.scala
index 7b448ad23..9a0c43b13 100644
--- a/tests/neg/blockescapesNeg.scala
+++ b/tests/neg/blockescapesNeg.scala
@@ -1,6 +1,6 @@
object blockescapesNeg {
def m0 = { object Foo { class Bar { val field = 2 }} ; new Foo.Bar }
- m0.field
+ m0.field // error
class A[T]
def m1 = { val x = 1; new A[x.type]}
}
diff --git a/tests/neg/boundspropagation.scala b/tests/neg/boundspropagation.scala
index 42cf67dba..b545b09da 100644
--- a/tests/neg/boundspropagation.scala
+++ b/tests/neg/boundspropagation.scala
@@ -13,7 +13,7 @@ object test2 {
def f(x: Any): Tree[Null] = x match {
- case y: Tree[_] => y
+ case y: Tree[_] => y // error
}
}
object test3 {
@@ -21,7 +21,7 @@ object test3 {
def f(x: Any): Tree[Null] = x match {
- case y: Tree[_] => y
+ case y: Tree[_] => y // error
}
}
@@ -34,11 +34,11 @@ object test4 {
class Tree[-S, -T >: Option[S]]
def g(x: Any): Tree[_, _ <: Option[N]] = x match {
- case y: Tree[_, _] => y
+ case y: Tree[_, _] => y // error
}
}
}
class Test5 {
-"": ({ type U = this.type })#U
+"": ({ type U = this.type })#U // error // error
}
diff --git a/tests/neg/companions.scala b/tests/neg/companions.scala
index 96b6b4bb6..4b2cf78df 100644
--- a/tests/neg/companions.scala
+++ b/tests/neg/companions.scala
@@ -8,7 +8,7 @@ object companionsNeg {
{ object C {
private val p = 1
- println(new C().q)
+ println(new C().q) // error
}}
}
diff --git a/tests/neg/cycles.scala b/tests/neg/cycles.scala
index ced6f56b5..11efea625 100644
--- a/tests/neg/cycles.scala
+++ b/tests/neg/cycles.scala
@@ -22,8 +22,8 @@ class C {
class E {
class F {
- type T <: x.type // error: not stable
- val z: x.type = ??? // error: not stable
+ type T <: x.type // old-error: not stable
+ val z: x.type = ??? // old-error: not stable
}
lazy val x: F#T = ???
}
@@ -37,6 +37,6 @@ class T2 {
type U = X | Int
}
object T12 {
- ??? : (T1 {})#U // error: conflicting bounds
- ??? : (T2 {})#U // error: conflicting bounds
+ ??? : (T1 {})#U // old-error: conflicting bounds
+ ??? : (T2 {})#U // old-error: conflicting bounds
}
diff --git a/tests/neg/escapingRefs.scala b/tests/neg/escapingRefs.scala
index 9a76eb414..9e7dfe1e3 100644
--- a/tests/neg/escapingRefs.scala
+++ b/tests/neg/escapingRefs.scala
@@ -3,8 +3,8 @@ object O {
class B
def f[T](x: T, y: T): T = y
- val x: A = f(new A { }, new B { })
+ val x: A = f(new A { }, new B { }) // error
val y = f({ class C { def member: Int = 1 }; new C }, { class C { def member: Int = 1 }; new C })
- val z = y.member
+ val z = y.member // error
}
diff --git a/tests/neg/i0091-infpaths.scala b/tests/neg/i0091-infpaths.scala
index 917ea49a2..e3b15933e 100644
--- a/tests/neg/i0091-infpaths.scala
+++ b/tests/neg/i0091-infpaths.scala
@@ -2,7 +2,7 @@ object infpaths {
object a {
trait T { t =>
- type M <: t.b.M
+ type M <: t.b.M // error
type T <: a.T
val b: t.T
}
@@ -10,7 +10,7 @@ object infpaths {
}
val m1: a.x.M = ???
- val m2: a.x.b.M = m1
- val m3: a.x.b.b.M = m2
+ val m2: a.x.b.M = m1 // error
+ val m3: a.x.b.b.M = m2 // error
}
diff --git a/tests/neg/i0248-inherit-refined.scala b/tests/neg/i0248-inherit-refined.scala
index bafcf372b..97b6f5cda 100644
--- a/tests/neg/i0248-inherit-refined.scala
+++ b/tests/neg/i0248-inherit-refined.scala
@@ -1,10 +1,10 @@
object test {
class A { type T }
type X = A { type T = Int }
- class B extends X
+ class B extends X // error
type Y = A & B
- class C extends Y
+ class C extends Y // error
type Z = A | B
- class D extends Z
- abstract class E extends ({ val x: Int })
+ class D extends Z // error
+ abstract class E extends ({ val x: Int }) // error
}
diff --git a/tests/neg/i0281-null-primitive-conforms.scala b/tests/neg/i0281-null-primitive-conforms.scala
index 469e72324..618a0d854 100644
--- a/tests/neg/i0281-null-primitive-conforms.scala
+++ b/tests/neg/i0281-null-primitive-conforms.scala
@@ -1,6 +1,6 @@
object test {
- val b: scala.Boolean = null
+ val b: scala.Boolean = null // error
val c: Unit = null
- val d: Float = null
- val e: AnyVal = null
+ val d: Float = null // error
+ val e: AnyVal = null // error
}
diff --git a/tests/neg/i0583-skolemize.scala b/tests/neg/i0583-skolemize.scala
index e0bb99e5d..c36a4486a 100644
--- a/tests/neg/i0583-skolemize.scala
+++ b/tests/neg/i0583-skolemize.scala
@@ -12,7 +12,7 @@ object Test1 {
val xs: List[C[_]] = List(c, d)
- xs(0).x = xs(1).x
+ xs(0).x = xs(1).x // error
}
object Test {
@@ -20,7 +20,7 @@ object Test {
val f: ListBuffer[Int] = ListBuffer(1,2)
val g: ListBuffer[Double] = ListBuffer(3.0,4.0)
val lb: ListBuffer[ListBuffer[_]] = ListBuffer(f, g)
- lb(0)(0) = lb(1)(0)
+ lb(0)(0) = lb(1)(0) // error
val x: Int = f(0)
}
}
diff --git a/tests/neg/i39.scala b/tests/neg/i39.scala
index 250947df9..df53d9816 100644
--- a/tests/neg/i39.scala
+++ b/tests/neg/i39.scala
@@ -1,7 +1,7 @@
object i39neg {
trait B {
- type D <: { type T }
+ type D <: { type T } // error
def d: D
}
@@ -11,7 +11,7 @@ object i39neg {
}
val d: bc.D = bc.d
- val pd: bc.D = bc.pd
+ val pd: bc.D = bc.pd // error
// infinite loop in Typer
val asT: d.T = ???
diff --git a/tests/neg/i50-volatile.scala b/tests/neg/i50-volatile.scala
index 9098b47d6..434dbf48c 100644
--- a/tests/neg/i50-volatile.scala
+++ b/tests/neg/i50-volatile.scala
@@ -3,22 +3,22 @@ class Test {
class Inner
}
type A <: Base {
- type X = String
+ type X = String // error
}
type B <: {
- type X = Int
+ type X = Int // error
}
lazy val o: A & B = ???
- class Client extends o.Inner
+ class Client extends o.Inner // error // error
- def xToString(x: o.X): String = x
+ def xToString(x: o.X): String = x // error
def intToString(i: Int): String = xToString(i)
}
object Test2 {
- import Test.o._
+ import Test.o._ // error
def xToString(x: X): String = x
diff --git a/tests/neg/instantiateAbstract.scala b/tests/neg/instantiateAbstract.scala
index 1e119a8b5..10eeac64d 100644
--- a/tests/neg/instantiateAbstract.scala
+++ b/tests/neg/instantiateAbstract.scala
@@ -24,7 +24,7 @@ object Test {
new TT // error
- new A // error
+ new A
// the following are OK in Typer but would be caught later in RefChecks
@@ -36,3 +36,5 @@ object Test {
object OO extends AA
}
+
+// nopos-error: "A does not conform to its self type B; cannot be instantiated"
diff --git a/tests/neg/over.scala b/tests/neg/over.scala
index 80ce7d09f..1644dff24 100644
--- a/tests/neg/over.scala
+++ b/tests/neg/over.scala
@@ -4,14 +4,14 @@ trait T {
class C extends T {
- val x = 2
- override val y = 2
+ val x = 2 // error
+ override val y = 2 // error
}
class D extends T {
- def x(): String = ""
+ def x(): String = "" // error
}
diff --git a/tests/neg/privates.scala b/tests/neg/privates.scala
index 404e5c2d8..9209f0cdc 100644
--- a/tests/neg/privates.scala
+++ b/tests/neg/privates.scala
@@ -5,7 +5,7 @@ trait T {
}
class C { self: T =>
- foo
- bar
+ foo // error
+ bar // error
}
diff --git a/tests/neg/subtyping.scala b/tests/neg/subtyping.scala
index a4a5a3d19..03ff39be4 100644
--- a/tests/neg/subtyping.scala
+++ b/tests/neg/subtyping.scala
@@ -5,10 +5,10 @@ class A extends B
object Test {
def test1(): Unit = {
- implicitly[B#X <:< A#X]
+ implicitly[B#X <:< A#X] // error
}
def test2(): Unit = {
- val a : { type T; type U } = ???
- implicitly[a.T <:< a.U]
+ val a : { type T; type U } = ??? // error // error
+ implicitly[a.T <:< a.U] // error
}
}
diff --git a/tests/neg/t1569-failedAvoid.scala b/tests/neg/t1569-failedAvoid.scala
index 9d0fbb37a..45bb96f36 100644
--- a/tests/neg/t1569-failedAvoid.scala
+++ b/tests/neg/t1569-failedAvoid.scala
@@ -5,5 +5,5 @@
object Bug {
class C { type T }
def foo(x: Int)(y: C)(z: y.T): Unit = {}
- foo(3)(new C { type T = String })("hello")
+ foo(3)(new C { type T = String })("hello") // error
}
diff --git a/tests/neg/t1843-variances.scala b/tests/neg/t1843-variances.scala
index e9b5c5d2d..a6bdd686f 100644
--- a/tests/neg/t1843-variances.scala
+++ b/tests/neg/t1843-variances.scala
@@ -6,7 +6,7 @@
object Crash {
trait UpdateType[A]
- case class StateUpdate[+A](updateType : UpdateType[A], value : A)
+ case class StateUpdate[+A](updateType : UpdateType[A], value : A) // error
case object IntegerUpdateType extends UpdateType[Integer]
//However this method will cause a crash
diff --git a/tests/neg/t2660.scala b/tests/neg/t2660.scala
index 85e318915..17fe26258 100644
--- a/tests/neg/t2660.scala
+++ b/tests/neg/t2660.scala
@@ -22,7 +22,7 @@ class A[T](x: T) {
object T {
def main(args: Array[String]): Unit = {
implicit def g2h(g: G): H = new H
- new A[Int](new H, 23)
+ new A[Int](new H, 23) // error
// in the context here, either secondary constructor is applicable
// to the other, due to the implicit in scope. So the call is ambiguous.
}
@@ -40,7 +40,7 @@ object X {
object T2 {
def main(args: Array[String]): Unit = {
implicit def g2h(g: G): H = new H
- X.f(new H, 23)
+ X.f(new H, 23) // error
}
}
diff --git a/tests/neg/t2994.scala b/tests/neg/t2994.scala
index 9827b1989..23a3b6a8b 100644
--- a/tests/neg/t2994.scala
+++ b/tests/neg/t2994.scala
@@ -7,7 +7,7 @@ object Naturals {
type a[s[_ <: NAT] <: NAT, z <: NAT] = z
}
final class SUCC[n <: NAT] extends NAT {
- type a[s[_ <: NAT] <: NAT, z <: NAT] = s[n#a[s, z]] // error: not a legal path
+ type a[s[_ <: NAT] <: NAT, z <: NAT] = s[n#a[s, z]] // old-error: not a legal path
}
type _0 = ZERO
type _1 = SUCC[_0]
@@ -20,9 +20,8 @@ object Naturals {
// crashes scala-2.8.0 beta1
trait MUL[n <: NAT, m <: NAT] extends NAT {
- trait curry[n[_[_], _], s[_]] { type f[z <: NAT] = n[s, z] } // can't do double param lists:
- // error: `]' expected but `[` found. // error: wrong number of type arguments
- type a[s[_ <: NAT] <: NAT, z <: NAT] = n#a[curry[m#a, s]#f, z] // error: not a legal path // error: not a legal path
+ trait curry[n[_[_], _], s[_]] { type f[z <: NAT] = n[s, z] } // can't do double param lists: // error: `]' expected but `[` found. // error: wrong number of type arguments
+ type a[s[_ <: NAT] <: NAT, z <: NAT] = n#a[curry[m#a, s]#f, z] // old-error: not a legal path // old-error: not a legal path
}
}
diff --git a/tests/neg/tailcall/t1672b.scala b/tests/neg/tailcall/t1672b.scala
index f05d05c34..2c2ec9b41 100644
--- a/tests/neg/tailcall/t1672b.scala
+++ b/tests/neg/tailcall/t1672b.scala
@@ -1,6 +1,6 @@
object Test1772B {
@annotation.tailrec
- def bar : Nothing = {
+ def bar : Nothing = { // error
try {
throw new RuntimeException
} catch {
@@ -11,7 +11,7 @@ object Test1772B {
}
@annotation.tailrec
- def baz : Nothing = {
+ def baz : Nothing = { // error
try {
throw new RuntimeException
} catch {
@@ -22,7 +22,7 @@ object Test1772B {
}
@annotation.tailrec
- def boz : Nothing = {
+ def boz : Nothing = { // error
try {
throw new RuntimeException
} catch {
@@ -31,7 +31,7 @@ object Test1772B {
}
@annotation.tailrec
- def bez : Nothing = {
+ def bez : Nothing = { // error
try {
bez
} finally {
@@ -41,12 +41,12 @@ object Test1772B {
// the `liftedTree` local method will prevent a tail call here.
@annotation.tailrec
- def bar(i : Int) : Int = {
+ def bar(i : Int) : Int = { // error
if (i == 0) 0
else 1 + (try {
throw new RuntimeException
} catch {
- case _: Throwable => bar(i - 1)
+ case _: Throwable => bar(i - 1) // error
})
}
}
diff --git a/tests/neg/tailcall/t3275.scala b/tests/neg/tailcall/t3275.scala
index 18e38a1a9..df6155035 100644
--- a/tests/neg/tailcall/t3275.scala
+++ b/tests/neg/tailcall/t3275.scala
@@ -1,3 +1,3 @@
object Test {
- @annotation.tailrec def foo() = 5
+ @annotation.tailrec def foo() = 5 // error
}
diff --git a/tests/neg/tailcall/t6574.scala b/tests/neg/tailcall/t6574.scala
index e81c8cd07..7030b3b4a 100644
--- a/tests/neg/tailcall/t6574.scala
+++ b/tests/neg/tailcall/t6574.scala
@@ -1,6 +1,6 @@
class Bad[X, Y](val v: Int) extends AnyVal {
- @annotation.tailrec final def notTailPos[Z](a: Int)(b: String): Unit = {
- this.notTailPos[Z](a)(b)
+ @annotation.tailrec final def notTailPos[Z](a: Int)(b: String): Unit = { // error
+ this.notTailPos[Z](a)(b) // error
println("tail")
}
diff --git a/tests/neg/tailcall/tailrec-2.scala b/tests/neg/tailcall/tailrec-2.scala
index bc594293d..b5edab4c7 100644
--- a/tests/neg/tailcall/tailrec-2.scala
+++ b/tests/neg/tailcall/tailrec-2.scala
@@ -13,7 +13,7 @@ class Bop2[+A](val element: A) extends Super[A] {
@annotation.tailrec final def f[B >: A](mem: List[B]): List[B] = (null: Bop2[A]).f(mem)
}
object Bop3 extends Super[Nothing] {
- @annotation.tailrec final def f[B](mem: List[B]): List[B] = (???: Bop3.type).f(mem)
+ @annotation.tailrec final def f[B](mem: List[B]): List[B] = (???: Bop3.type).f(mem) // error // error
}
class Bop4[+A](val element: A) extends Super[A] {
@annotation.tailrec final def f[B >: A](mem: List[B]): List[B] = Other.f[A].f(mem)
diff --git a/tests/neg/tailcall/tailrec-3.scala b/tests/neg/tailcall/tailrec-3.scala
index 20361658e..b0c560615 100644
--- a/tests/neg/tailcall/tailrec-3.scala
+++ b/tests/neg/tailcall/tailrec-3.scala
@@ -1,9 +1,9 @@
import annotation.tailrec
object Test {
- @tailrec private def quux(xs: List[String]): List[String] = quux(quux(xs))
+ @tailrec private def quux(xs: List[String]): List[String] = quux(quux(xs)) // error
@tailrec private def quux2(xs: List[String]): List[String] = xs match {
- case x1 :: x2 :: rest => quux2(x1 :: quux2(rest))
+ case x1 :: x2 :: rest => quux2(x1 :: quux2(rest)) // error
case _ => Nil
}
@tailrec private def quux3(xs: List[String]): Boolean = xs match {
diff --git a/tests/neg/tailcall/tailrec.scala b/tests/neg/tailcall/tailrec.scala
index 83a0c1a9e..49d71ce13 100644
--- a/tests/neg/tailcall/tailrec.scala
+++ b/tests/neg/tailcall/tailrec.scala
@@ -40,19 +40,19 @@ class Winners {
object Failures {
@tailrec
- def facfail(n: Int): Int =
+ def facfail(n: Int): Int = // error
if (n == 0) 1
- else n * facfail(n - 1)
+ else n * facfail(n - 1) // error
}
class Failures {
// not private, not final
- @tailrec def fail1(x: Int): Int = fail1(x)
+ @tailrec def fail1(x: Int): Int = fail1(x) // error
// a typical between-chair-and-keyboard error
- @tailrec final def fail2[T](xs: List[T]): List[T] = xs match {
+ @tailrec final def fail2[T](xs: List[T]): List[T] = xs match { // error
case Nil => Nil
- case x :: xs => x :: fail2[T](xs)
+ case x :: xs => x :: fail2[T](xs) // error
}
// unsafe
@@ -60,6 +60,6 @@ class Failures {
// unsafe
class Tom[T](x: Int) {
- @tailrec final def fail4[U](other: Tom[U], x: Int): Int = other.fail4[U](other, x - 1)
+ @tailrec final def fail4[U](other: Tom[U], x: Int): Int = other.fail4[U](other, x - 1) // error // error
}
}
diff --git a/tests/neg/traitParamsTyper.scala b/tests/neg/traitParamsTyper.scala
index f87ba3691..e97906b50 100644
--- a/tests/neg/traitParamsTyper.scala
+++ b/tests/neg/traitParamsTyper.scala
@@ -6,7 +6,7 @@ class C(x: Int) extends T() // error
trait U extends C with T
-trait V extends C(1) with T(2) // two errors
+trait V extends C(1) with T(2) // error // error
trait W extends T(3) // error
diff --git a/tests/neg/typedIdents/typedIdents.scala b/tests/neg/typedIdents/typedIdents.scala
index 4937edfe3..56acfc231 100644
--- a/tests/neg/typedIdents/typedIdents.scala
+++ b/tests/neg/typedIdents/typedIdents.scala
@@ -12,13 +12,13 @@ package P { // `X' bound by package clause
println("L12: " + x) // `x' refers to constant `3' here
locally {
import Q.X._ // `x' and `y' bound by wildcard import
- println("L14: " + x) // reference to `x' is ambiguous here
+ println("L14: " + x) // error: reference to `x' is ambiguous here
import X.y // `y' bound by explicit import
println("L16: " + y) // `y' refers to `Q.X.y' here
locally {
import P.X._ // `x' and `y' bound by wildcard import
val x = "abc" // `x' bound by local definition
- println("L19: " + y) // reference to `y' is ambiguous here
+ println("L19: " + y) // error: reference to `y' is ambiguous here
println("L20: " + x) // `x' refers to string ``abc'' here
}
}
diff --git a/tests/neg/typers.scala b/tests/neg/typers.scala
index 537c4cdb0..49742ebbd 100644
--- a/tests/neg/typers.scala
+++ b/tests/neg/typers.scala
@@ -40,8 +40,8 @@ object typers {
object returns {
- def foo(x: Int) = { // error: has return; needs result type
- return 3
+ def foo(x: Int) = {
+ return 3 // error: has return; needs result type
}
return 4 // error: return outside method definition
@@ -52,8 +52,8 @@ object typers {
if (n == 0) acc
else factorial(acc * n, n - 1) // error: cyclic reference
- def foo(x: Int) = x // error: cyclic reference
- def foo() = foo(1)
+ def foo(x: Int) = x
+ def foo() = foo(1) // error: cyclic reference
}
diff --git a/tests/neg/typetest.scala b/tests/neg/typetest.scala
index 27ecd25b2..a49e30054 100644
--- a/tests/neg/typetest.scala
+++ b/tests/neg/typetest.scala
@@ -2,6 +2,6 @@ object Test {
val i: Int = 1
- println(i.isInstanceOf[Object])
+ println(i.isInstanceOf[Object]) // error
}
diff --git a/tests/neg/variances.scala b/tests/neg/variances.scala
index 30390ad22..71ee504bc 100644
--- a/tests/neg/variances.scala
+++ b/tests/neg/variances.scala
@@ -5,7 +5,7 @@ class Foo[+A: ClassTag](x: A) {
private[this] val elems: Array[A] = Array(x)
- def f[B](x: Array[B] = elems): Array[B] = x // (1) should give a variance error here or ...
+ def f[B](x: Array[B] = elems): Array[B] = x // error (1) should give a variance error here or ...
}
@@ -25,7 +25,7 @@ class Outer[+A](x: A) {
def getElem: A = elem
- class Inner(constrParam: A) { // (2) should give a variance error here or ...
+ class Inner(constrParam: A) { // error (2) should give a variance error here or ...
elem = constrParam
}
diff --git a/tests/neg/zoo.scala b/tests/neg/zoo.scala
index 6a3e4ca0b..3d9b77b72 100644
--- a/tests/neg/zoo.scala
+++ b/tests/neg/zoo.scala
@@ -1,25 +1,25 @@
object Test {
type Meat = {
- type IsMeat = Any
+ type IsMeat = Any // error
}
type Grass = {
- type IsGrass = Any
+ type IsGrass = Any // error
}
type Animal = {
- type Food
- def eats(food: Food): Unit
- def gets: Food
+ type Food // error
+ def eats(food: Food): Unit // error
+ def gets: Food // error
}
type Cow = {
- type IsMeat = Any
- type Food <: Grass
- def eats(food: Grass): Unit
- def gets: Grass
+ type IsMeat = Any // error
+ type Food <: Grass // error
+ def eats(food: Grass): Unit // error
+ def gets: Grass // error
}
type Lion = {
- type Food = Meat
- def eats(food: Meat): Unit
- def gets: Meat
+ type Food = Meat // error
+ def eats(food: Meat): Unit // error
+ def gets: Meat // error
}
def newMeat: Meat = new {
type IsMeat = Any
diff --git a/tests/pos/autoTuplingTest.scala b/tests/pos/autoTuplingTest.scala
index 523411a1a..c5bb84e95 100644
--- a/tests/pos/autoTuplingTest.scala
+++ b/tests/pos/autoTuplingTest.scala
@@ -1,9 +1,9 @@
object autoTupling {
- val x = Some(1, 2)
+ val x = Some(1, 2) // error when running with -language:noAutoTupling
x match {
- case Some(a, b) => a + b
+ case Some(a, b) => a + b // error // error // error when running with -language:noAutoTupling
case None =>
}
}
diff --git a/tests/pos/t0273.scala b/tests/pos/t0273.scala
index 10f426828..0fba8a8a4 100644
--- a/tests/pos/t0273.scala
+++ b/tests/pos/t0273.scala
@@ -2,6 +2,6 @@ class A
object Test {
def a = () => ()
-def a[T] = (p:A) => ()
+def a[T] = (p:A) => () // error
def main(args: Array[String]) = ()
}
diff --git a/tests/pos/t1279a.scala b/tests/pos/t1279a.scala
index 6d768d435..78633ec3c 100644
--- a/tests/pos/t1279a.scala
+++ b/tests/pos/t1279a.scala
@@ -4,12 +4,12 @@ abstract class M {
type T
final type selfType = M {type T <: self.T}
- type actualSelfType >: self.type <: selfType // this no longer compiles because self.type is not a subtype of selfType
+ type actualSelfType >: self.type <: selfType // error: this no longer compiles because self.type is not a subtype of selfType
def next: selfType
// I don't understand why this doesn't compile, but that's a separate matter
- // error: method all2 cannot be accessed in M.this.selfType
+ // Error: method all2 cannot be accessed in M.this.selfType
// because its instance type => Stream[M{type T <: M.this.selfType#T}]
// contains a malformed type: M.this.selfType#T
def all2: Stream[M {type T <: self.T}] = Stream.cons(self: actualSelfType, next.all2)