summaryrefslogtreecommitdiff
path: root/test/files/neg
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/neg')
-rw-r--r--test/files/neg/bug2206.check5
-rw-r--r--test/files/neg/bug2206.scala15
-rw-r--r--test/files/neg/bug278.check5
-rw-r--r--test/files/neg/illegal-stmt-start.check4
-rw-r--r--test/files/neg/illegal-stmt-start.scala5
-rw-r--r--test/files/neg/migration28.flags2
-rw-r--r--test/files/neg/names-defaults-neg.check4
-rw-r--r--test/files/neg/overload-msg.check13
-rw-r--r--test/files/neg/overload-msg.scala4
-rw-r--r--test/files/neg/t3115.flags2
-rw-r--r--test/files/neg/tailrec.check18
-rw-r--r--test/files/neg/tailrec.scala44
-rw-r--r--test/files/neg/typeerror.check2
13 files changed, 95 insertions, 28 deletions
diff --git a/test/files/neg/bug2206.check b/test/files/neg/bug2206.check
new file mode 100644
index 0000000000..3deb4d99ef
--- /dev/null
+++ b/test/files/neg/bug2206.check
@@ -0,0 +1,5 @@
+bug2206.scala:10: error: value f is not a member of o.A
+ Note: implicit method ax is not applicable here because it comes after the application point and it lacks an explicit result type
+ a.f()
+ ^
+one error found
diff --git a/test/files/neg/bug2206.scala b/test/files/neg/bug2206.scala
new file mode 100644
index 0000000000..cd2ec225e9
--- /dev/null
+++ b/test/files/neg/bug2206.scala
@@ -0,0 +1,15 @@
+object o {
+ class A
+
+ class AX {
+ def f() { }
+ }
+
+ import Implicits._
+ val a = new A
+ a.f()
+
+ object Implicits {
+ implicit def ax(a: A) = new AX
+ }
+} \ No newline at end of file
diff --git a/test/files/neg/bug278.check b/test/files/neg/bug278.check
index a3d44f6508..ad0a97371e 100644
--- a/test/files/neg/bug278.check
+++ b/test/files/neg/bug278.check
@@ -1,4 +1,7 @@
-bug278.scala:5: error: overloaded method value a with alternatives => (C.this.A) => Unit <and> => () => Unit does not take type parameters
+bug278.scala:5: error: overloaded method value a with alternatives:
+ => (C.this.A) => Unit <and>
+ => () => Unit
+ does not take type parameters
a[A]
^
bug278.scala:4: error: method a is defined twice
diff --git a/test/files/neg/illegal-stmt-start.check b/test/files/neg/illegal-stmt-start.check
new file mode 100644
index 0000000000..01747524f8
--- /dev/null
+++ b/test/files/neg/illegal-stmt-start.check
@@ -0,0 +1,4 @@
+illegal-stmt-start.scala:3: error: illegal start of statement (no modifiers allowed here)
+ private def bar {}
+ ^
+one error found
diff --git a/test/files/neg/illegal-stmt-start.scala b/test/files/neg/illegal-stmt-start.scala
new file mode 100644
index 0000000000..48ae0a8b0a
--- /dev/null
+++ b/test/files/neg/illegal-stmt-start.scala
@@ -0,0 +1,5 @@
+class Test {
+ def foo {
+ private def bar {}
+ }
+} \ No newline at end of file
diff --git a/test/files/neg/migration28.flags b/test/files/neg/migration28.flags
index f7025d0226..197b3198c8 100644
--- a/test/files/neg/migration28.flags
+++ b/test/files/neg/migration28.flags
@@ -1 +1 @@
--Yfatal-warnings -Xmigration
+-Xfatal-warnings -Xmigration
diff --git a/test/files/neg/names-defaults-neg.check b/test/files/neg/names-defaults-neg.check
index 39347cd5db..644aad4a89 100644
--- a/test/files/neg/names-defaults-neg.check
+++ b/test/files/neg/names-defaults-neg.check
@@ -90,7 +90,7 @@ names-defaults-neg.scala:76: error: no type parameters for method test4: (x: T[T
argument expression's type is not compatible with formal parameter type;
found : List[Int]
required: ?T[ ?T[ scala.List[?T[ X forSome { type X } ]] ] ]
-Error occured in an application involving default arguments.
+Error occurred in an application involving default arguments.
test4()
^
names-defaults-neg.scala:79: error: type mismatch;
@@ -101,7 +101,7 @@ names-defaults-neg.scala:79: error: type mismatch;
names-defaults-neg.scala:82: error: type mismatch;
found : Int
required: String
-Error occured in an application involving default arguments.
+Error occurred in an application involving default arguments.
new A2[String]()
^
24 errors found
diff --git a/test/files/neg/overload-msg.check b/test/files/neg/overload-msg.check
new file mode 100644
index 0000000000..780830bff9
--- /dev/null
+++ b/test/files/neg/overload-msg.check
@@ -0,0 +1,13 @@
+overload-msg.scala:3: error: overloaded method value + with alternatives:
+ (Double)Double <and>
+ (Float)Float <and>
+ (Long)Long <and>
+ (scala.Int)scala.Int <and>
+ (Char)scala.Int <and>
+ (Short)scala.Int <and>
+ (Byte)scala.Int <and>
+ (java.lang.String)java.lang.String
+ cannot be applied to (Int(in method f))
+ def f[Int](y: Int) = x + y
+ ^
+one error found
diff --git a/test/files/neg/overload-msg.scala b/test/files/neg/overload-msg.scala
new file mode 100644
index 0000000000..8715c156a2
--- /dev/null
+++ b/test/files/neg/overload-msg.scala
@@ -0,0 +1,4 @@
+// type parameter shadows actual type, massive overload error confuses.
+class A(x: Int) {
+ def f[Int](y: Int) = x + y
+}
diff --git a/test/files/neg/t3115.flags b/test/files/neg/t3115.flags
index bf8f88334b..d1b831ea87 100644
--- a/test/files/neg/t3115.flags
+++ b/test/files/neg/t3115.flags
@@ -1 +1 @@
--deprecation -Yfatal-warnings \ No newline at end of file
+-deprecation -Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/tailrec.check b/test/files/neg/tailrec.check
index 22d70e82a0..27d99f632e 100644
--- a/test/files/neg/tailrec.check
+++ b/test/files/neg/tailrec.check
@@ -1,10 +1,16 @@
-tailrec.scala:6: error: could not optimize @tailrec annotated method
+tailrec.scala:43: error: could not optimize @tailrec annotated method: it contains a recursive call not in tail position
def facfail(n: Int): Int =
^
-tailrec.scala:42: error: could not optimize @tailrec annotated method
+tailrec.scala:50: error: could not optimize @tailrec annotated method: it is neither private nor final so can be overridden
@tailrec def fail1(x: Int): Int = fail1(x)
^
-tailrec.scala:45: error: could not optimize @tailrec annotated method
- @tailrec def fail2[T](xs: List[T]): List[T] = xs match {
- ^
-three errors found
+tailrec.scala:53: error: could not optimize @tailrec annotated method: it contains a recursive call not in tail position
+ @tailrec final def fail2[T](xs: List[T]): List[T] = xs match {
+ ^
+tailrec.scala:59: error: could not optimize @tailrec annotated method: it is called recursively with different type arguments
+ @tailrec final def fail3[T](x: Int): Int = fail3(x - 1)
+ ^
+tailrec.scala:63: error: could not optimize @tailrec annotated method: it changes type of 'this' on a polymorphic recursive call
+ @tailrec final def fail4[U](other: Tom[U], x: Int): Int = other.fail4[U](other, x - 1)
+ ^
+5 errors found
diff --git a/test/files/neg/tailrec.scala b/test/files/neg/tailrec.scala
index 4c45672f93..a77f439cfe 100644
--- a/test/files/neg/tailrec.scala
+++ b/test/files/neg/tailrec.scala
@@ -1,53 +1,65 @@
import scala.annotation.tailrec
// putting @tailrec through the paces
-object Main {
- @tailrec
- def facfail(n: Int): Int =
- if (n == 0) 1
- else n * facfail(n - 1)
-
+object Winners {
@tailrec
def facsucc(n: Int, acc: Int): Int =
if (n == 0) acc
else facsucc(n - 1, n * acc)
- @tailrec def loopy1(x: Int): Int = loopy1(x - 1)
+ @tailrec def loopsucc1(x: Int): Int = loopsucc1(x - 1)
+ @tailrec def loopsucc2[T](x: Int): Int = loopsucc2[T](x - 1)
def ding {
object dong {
- @tailrec def loopy2(x: Int): Int = loopy2(x)
+ @tailrec def loopsucc3(x: Int): Int = loopsucc3(x)
}
()
}
def inner(q: Int) = {
@tailrec
- def loopy3(x: Int): Int = loopy3(x + 1)
+ def loopsucc4(x: Int): Int = loopsucc4(x + 1)
- loopy3(q)
+ loopsucc4(q)
+ }
+
+ object innerBob {
+ @tailrec def loopsucc5(x: Int): Int = loopsucc5(x)
}
}
-class Bob {
- // these should work
+class Winners {
@tailrec private def succ1(x: Int): Int = succ1(x)
@tailrec final def succ2(x: Int): Int = succ2(x)
@tailrec final def succ3[T](in: List[T], acc: List[T]): List[T] = in match {
case Nil => Nil
case x :: xs => succ3(xs, x :: acc)
}
+}
+object Failures {
+ @tailrec
+ def facfail(n: Int): Int =
+ if (n == 0) 1
+ else n * facfail(n - 1)
+}
+
+class Failures {
// not private, not final
@tailrec def fail1(x: Int): Int = fail1(x)
// a typical between-chair-and-keyboard error
- @tailrec def fail2[T](xs: List[T]): List[T] = xs match {
+ @tailrec final def fail2[T](xs: List[T]): List[T] = xs match {
case Nil => Nil
- case x :: xs => x :: fail2(xs)
+ case x :: xs => x :: fail2[T](xs)
}
- object innerBob {
- @tailrec def succ4(x: Int): Int = succ4(x)
+ // unsafe
+ @tailrec final def fail3[T](x: Int): Int = fail3(x - 1)
+
+ // unsafe
+ class Tom[T](x: Int) {
+ @tailrec final def fail4[U](other: Tom[U], x: Int): Int = other.fail4[U](other, x - 1)
}
}
diff --git a/test/files/neg/typeerror.check b/test/files/neg/typeerror.check
index 3e21a79ad5..3ce11dad8a 100644
--- a/test/files/neg/typeerror.check
+++ b/test/files/neg/typeerror.check
@@ -1,6 +1,6 @@
typeerror.scala:6: error: type mismatch;
found : Long(in method add)
- required: Long(in package scala)
+ required: scala.Long
else add2(x.head, y.head) :: add(x.tail, y.tail)
^
one error found