summaryrefslogtreecommitdiff
path: root/test/files/neg
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/neg')
-rw-r--r--test/files/neg/t200.check2
-rw-r--r--test/files/neg/t2779.check2
-rw-r--r--test/files/neg/t278.check2
-rw-r--r--test/files/neg/t414.check2
-rw-r--r--test/files/neg/t452.check2
-rw-r--r--test/files/neg/t4879.check4
-rw-r--r--test/files/neg/t5529.check12
-rw-r--r--test/files/neg/t5529.scala13
-rw-r--r--test/files/neg/t5553_1.check54
-rw-r--r--test/files/neg/t5553_1.scala34
-rw-r--r--test/files/neg/t5553_2.check50
-rw-r--r--test/files/neg/t5553_2.scala59
-rw-r--r--test/files/neg/t591.check2
-rw-r--r--test/files/neg/t800.check6
-rw-r--r--test/files/neg/t960.check4
15 files changed, 235 insertions, 13 deletions
diff --git a/test/files/neg/t200.check b/test/files/neg/t200.check
index 78701f8533..3ef6665fe5 100644
--- a/test/files/neg/t200.check
+++ b/test/files/neg/t200.check
@@ -1,4 +1,4 @@
-t200.scala:7: error: method foo is defined twice
+t200.scala:7: error: method foo is defined twice in t200.scala
def foo: Int;
^
one error found
diff --git a/test/files/neg/t2779.check b/test/files/neg/t2779.check
index 4f94a780a1..d642541e3e 100644
--- a/test/files/neg/t2779.check
+++ b/test/files/neg/t2779.check
@@ -1,4 +1,4 @@
-t2779.scala:16: error: method f is defined twice
+t2779.scala:16: error: method f is defined twice in t2779.scala
override def f = List(M1)
^
one error found
diff --git a/test/files/neg/t278.check b/test/files/neg/t278.check
index 675ef910ee..0c2dfeb67a 100644
--- a/test/files/neg/t278.check
+++ b/test/files/neg/t278.check
@@ -4,7 +4,7 @@ t278.scala:5: error: overloaded method value a with alternatives:
does not take type parameters
println(a[A])
^
-t278.scala:4: error: method a is defined twice
+t278.scala:4: error: method a is defined twice in t278.scala
def a = (p:A) => ()
^
two errors found
diff --git a/test/files/neg/t414.check b/test/files/neg/t414.check
index a855497648..e15dbaea71 100644
--- a/test/files/neg/t414.check
+++ b/test/files/neg/t414.check
@@ -1,5 +1,5 @@
t414.scala:5: error: pattern type is incompatible with expected type;
- found : object Empty
+ found : Empty.type
required: IntMap[a]
Note: if you intended to match against the class, try `case _: Empty[_]` or `case Empty()`
case Empty =>
diff --git a/test/files/neg/t452.check b/test/files/neg/t452.check
index 85197af21b..aac663068e 100644
--- a/test/files/neg/t452.check
+++ b/test/files/neg/t452.check
@@ -1,5 +1,5 @@
t452.scala:3: error: type mismatch;
- found : Test.type (with underlying type object Test)
+ found : Test.type
required: Test.Foo
def this() = this(this);
^
diff --git a/test/files/neg/t4879.check b/test/files/neg/t4879.check
index 49f3c73cf7..21cd329640 100644
--- a/test/files/neg/t4879.check
+++ b/test/files/neg/t4879.check
@@ -1,11 +1,11 @@
t4879.scala:6: error: pattern type is incompatible with expected type;
- found : object C
+ found : C.type
required: C
Note: if you intended to match against the class, try `case _: C` or `case C(_)`
case C => true
^
t4879.scala:10: error: pattern type is incompatible with expected type;
- found : object D
+ found : D.type
required: D[T,U,V]
Note: if you intended to match against the class, try `case _: D[_,_,_]` or `case D(_,_,_)`
case D => true
diff --git a/test/files/neg/t5529.check b/test/files/neg/t5529.check
new file mode 100644
index 0000000000..78a26aeb50
--- /dev/null
+++ b/test/files/neg/t5529.check
@@ -0,0 +1,12 @@
+t5529.scala:12: error: File is already defined as class File
+ type File
+ ^
+t5529.scala:10: error: class type required but test.Test.File found
+ sealed class Dir extends File { }
+ ^
+t5529.scala:10: error: illegal inheritance; super<none>
+ is not a subclass of the superclass Object
+ of the mixin trait ScalaObject
+ sealed class Dir extends File { }
+ ^
+three errors found
diff --git a/test/files/neg/t5529.scala b/test/files/neg/t5529.scala
new file mode 100644
index 0000000000..033009a8a6
--- /dev/null
+++ b/test/files/neg/t5529.scala
@@ -0,0 +1,13 @@
+// /scala/trac/5529/a.scala
+// Tue Feb 28 13:11:28 PST 2012
+
+package test;
+
+object Test {
+ sealed class File {
+ val i = 1
+ }
+ sealed class Dir extends File { }
+
+ type File
+}
diff --git a/test/files/neg/t5553_1.check b/test/files/neg/t5553_1.check
new file mode 100644
index 0000000000..afd6489888
--- /dev/null
+++ b/test/files/neg/t5553_1.check
@@ -0,0 +1,54 @@
+t5553_1.scala:18: error: ambiguous reference to overloaded definition,
+both method apply in object Foo1 of type (z: String)Base[T]
+and method apply in object Foo1 of type (a: Int)Base[T]
+match expected type ?
+ def test1[T] = Foo1[T]
+ ^
+t5553_1.scala:19: error: type mismatch;
+ found : [T](z: String)Base[T] <and> (a: Int)Base[T]
+ required: Int
+ def test2[T]: Int = Foo1[T]
+ ^
+t5553_1.scala:20: error: type mismatch;
+ found : [T(in method apply)](z: String)Base[T(in method apply)] <and> (a: Int)Base[T(in method apply)]
+ required: Base[T(in method test3)]
+ def test3[T]: Base[T] = Foo1[T]
+ ^
+t5553_1.scala:24: error: ambiguous reference to overloaded definition,
+both method apply in object Foo2 of type (z: String)Base[T]
+and method apply in object Foo2 of type (a: Int)Base[T]
+match expected type ?
+ def test4[T] = Foo2[T]
+ ^
+t5553_1.scala:25: error: type mismatch;
+ found : [T](z: String)Base[T] <and> (a: Int)Base[T]
+ required: Int
+ def test5[T]: Int = Foo2[T]
+ ^
+t5553_1.scala:26: error: type mismatch;
+ found : [T(in method apply)](z: String)Base[T(in method apply)] <and> (a: Int)Base[T(in method apply)]
+ required: Base[T(in method test6)]
+ def test6[T]: Base[T] = Foo2[T]
+ ^
+t5553_1.scala:30: error: ambiguous reference to overloaded definition,
+both method apply in object Foo3 of type (z: String)String
+and method apply in object Foo3 of type (a: Int)Base[T]
+match expected type ?
+ def test7[T] = Foo3[T]
+ ^
+t5553_1.scala:31: error: type mismatch;
+ found : [T](z: String)String <and> (a: Int)Base[T]
+ required: String
+ def test8[T]: String = Foo3[T]
+ ^
+t5553_1.scala:32: error: type mismatch;
+ found : [T](z: String)String <and> (a: Int)Base[T]
+ required: Int
+ def test9[T]: Int = Foo3[T]
+ ^
+t5553_1.scala:33: error: type mismatch;
+ found : [T(in method apply)](z: String)String <and> (a: Int)Base[T(in method apply)]
+ required: Base[T(in method test10)]
+ def test10[T]: Base[T] = Foo3[T]
+ ^
+10 errors found
diff --git a/test/files/neg/t5553_1.scala b/test/files/neg/t5553_1.scala
new file mode 100644
index 0000000000..32d61ec852
--- /dev/null
+++ b/test/files/neg/t5553_1.scala
@@ -0,0 +1,34 @@
+class Base[T]
+
+object Foo1 {
+ def apply[T](a: Int): Base[T] = new Base[T]
+ def apply[T](z: String): Base[T] = new Base[T]
+}
+
+object Foo2 {
+ def apply[T](a: Int): Base[T] = new Base[T]
+ def apply[T](z: String="abc"): Base[T] = new Base[T]
+}
+
+object Foo3 {
+ def apply[T](a: Int): Base[T] = new Base[T]
+ def apply[T](z: String="abc"): String = z
+}
+object Test {
+ def test1[T] = Foo1[T]
+ def test2[T]: Int = Foo1[T]
+ def test3[T]: Base[T] = Foo1[T]
+}
+
+object Test2 {
+ def test4[T] = Foo2[T]
+ def test5[T]: Int = Foo2[T]
+ def test6[T]: Base[T] = Foo2[T]
+}
+
+object Test3{
+ def test7[T] = Foo3[T]
+ def test8[T]: String = Foo3[T]
+ def test9[T]: Int = Foo3[T]
+ def test10[T]: Base[T] = Foo3[T]
+}
diff --git a/test/files/neg/t5553_2.check b/test/files/neg/t5553_2.check
new file mode 100644
index 0000000000..599fdb0523
--- /dev/null
+++ b/test/files/neg/t5553_2.check
@@ -0,0 +1,50 @@
+t5553_2.scala:27: error: type mismatch;
+ found : Base[T]
+ required: Int
+ def test4[T]: Int = Foo1[T](1)
+ ^
+t5553_2.scala:34: error: type mismatch;
+ found : String
+ required: Base[T]
+ def test7[T]: Base[T] = Foo2[T]
+ ^
+t5553_2.scala:35: error: type mismatch;
+ found : String
+ required: Int
+ def test8[T]: Int = Foo2[T]
+ ^
+t5553_2.scala:40: error: type mismatch;
+ found : String
+ required: Int
+ def test9[T]: Int = Foo3[T]
+ ^
+t5553_2.scala:41: error: type mismatch;
+ found : String
+ required: Base[T]
+ def test10[T]: Base[T] = Foo3[T]
+ ^
+t5553_2.scala:47: error: could not find implicit value for parameter z: String
+ def test13[T]: Int = Foo3[T]
+ ^
+t5553_2.scala:48: error: could not find implicit value for parameter z: String
+ def test14[T]: Base[T] = Foo3[T]
+ ^
+t5553_2.scala:49: error: could not find implicit value for parameter z: String
+ def test15[T]: String = Foo3[T]
+ ^
+t5553_2.scala:50: error: could not find implicit value for parameter z: String
+ def test16[T] = Foo3[T]
+ ^
+t5553_2.scala:54: error: ambiguous reference to overloaded definition,
+both method apply in object Foo4 of type (x: Int)(implicit z: String)Base[T]
+and method apply in object Foo4 of type (x: Int)Base[T]
+match argument types (Int)
+ def test17[T] = Foo4[T](1)
+ ^
+t5553_2.scala:55: error: ambiguous reference to overloaded definition,
+both method apply in object Foo4 of type (x: Int)(implicit z: String)Base[T]
+and method apply in object Foo4 of type (x: Int)Base[T]
+match argument types (Int) and expected result type Base[T]
+ def test18[T]: Base[T] = Foo4[T](1)
+ ^
+11 errors found
diff --git a/test/files/neg/t5553_2.scala b/test/files/neg/t5553_2.scala
new file mode 100644
index 0000000000..16958aec8e
--- /dev/null
+++ b/test/files/neg/t5553_2.scala
@@ -0,0 +1,59 @@
+class Base[T]
+
+object Foo1 {
+ def apply[T](x: Int): Base[T] = new Base[T]
+ def apply[T](x: Int, z: String="abc"): String = z
+}
+
+object Foo2 {
+ def apply[T](a: Int): Base[T] = new Base[T]
+ def apply[T]: String = "abc"
+}
+
+object Foo3 {
+ def apply[T](x: Int): Base[T] = new Base[T]
+ def apply[T](implicit z: String): String = z
+}
+
+object Foo4 {
+ def apply[T](x: Int): Base[T] = new Base[T]
+ def apply[T](x: Int)(implicit z: String): Base[T] = new Base[T]
+}
+
+object Test1 {
+ def test1[T] = Foo1[T](1)
+ def test2[T]: String = Foo1[T](1)
+ def test3[T]: Base[T] = Foo1[T](1)
+ def test4[T]: Int = Foo1[T](1)
+
+}
+
+object Test2 {
+ def test5[T] = Foo2[T]
+ def test6[T]: String = Foo2[T]
+ def test7[T]: Base[T] = Foo2[T]
+ def test8[T]: Int = Foo2[T]
+}
+
+object Test3 {
+ implicit val v: String = "abc"
+ def test9[T]: Int = Foo3[T]
+ def test10[T]: Base[T] = Foo3[T]
+ def test11[T]: String = Foo3[T]
+ def test12[T] = Foo3[T]
+}
+
+object Test4 {
+ def test13[T]: Int = Foo3[T]
+ def test14[T]: Base[T] = Foo3[T]
+ def test15[T]: String = Foo3[T]
+ def test16[T] = Foo3[T]
+}
+
+object Test5 {
+ def test17[T] = Foo4[T](1)
+ def test18[T]: Base[T] = Foo4[T](1)
+ //def test19[T]: String = Foo4[T](1) // #5554
+}
+
+
diff --git a/test/files/neg/t591.check b/test/files/neg/t591.check
index 434c2dd002..5cdeebf079 100644
--- a/test/files/neg/t591.check
+++ b/test/files/neg/t591.check
@@ -1,4 +1,4 @@
-t591.scala:38: error: method input_= is defined twice
+t591.scala:38: error: method input_= is defined twice in t591.scala
def input_=(in : Input) = {}
^
one error found
diff --git a/test/files/neg/t800.check b/test/files/neg/t800.check
index 4bfba5420b..44c316a95b 100644
--- a/test/files/neg/t800.check
+++ b/test/files/neg/t800.check
@@ -1,13 +1,13 @@
t800.scala:4: error: qualification is already defined as value qualification
val qualification = false;
^
-t800.scala:8: error: method qualification is defined twice
+t800.scala:8: error: method qualification is defined twice in t800.scala
val qualification = false;
^
-t800.scala:12: error: value qualification is defined twice
+t800.scala:12: error: value qualification is defined twice in t800.scala
var qualification = false;
^
-t800.scala:16: error: method qualification is defined twice
+t800.scala:16: error: method qualification is defined twice in t800.scala
var qualification = false;
^
four errors found
diff --git a/test/files/neg/t960.check b/test/files/neg/t960.check
index 4cc76d3602..603b1cb032 100644
--- a/test/files/neg/t960.check
+++ b/test/files/neg/t960.check
@@ -7,7 +7,7 @@ match argument types (List[a])
t960.scala:22: error: cannot resolve overloaded unapply
case List(x, xs) => 7
^
-t960.scala:12: error: method unapply is defined twice
+t960.scala:12: error: method unapply is defined twice in t960.scala
def unapply[a](xs: List[a]): Option[Null] = xs match {
^
-three errors found \ No newline at end of file
+three errors found