Skip to content

Commit f28d7a9

Browse files
committed
Merge pull request #65 from samuelgruetter/scala-tests-raw
Add untried tests from scala/test/files/{pos,neg}
2 parents 9cd9d97 + 9ef5f68 commit f28d7a9

File tree

3,539 files changed

+49725
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,539 files changed

+49725
-0
lines changed

tests/untried/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.log
2+
*.obj/

tests/untried/filters

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#
2+
#Java HotSpot(TM) 64-Bit Server VM warning: Failed to reserve shared memory (errno = 28).
3+
Java HotSpot\(TM\) .* warning:
4+
# Hotspot receiving VM options through the $_JAVA_OPTIONS
5+
# env variable outputs them on stderr
6+
Picked up _JAVA_OPTIONS:
7+
# Filter out a message caused by this bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8021205
8+
objc\[\d+\]: Class JavaLaunchHelper is implemented in both .* and .*\. One of the two will be used\. Which one is undefined\.
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
abstract-class-2.scala:11: error: object creation impossible, since method f in trait S2 of type (x: P2.this.p.S1)Int is not defined
2+
(Note that P.this.p.S1 does not match P2.this.S1: their prefixes (i.e. enclosing instances) differ)
3+
object O2 extends S2 {
4+
^
5+
one error found
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class P {
2+
trait S1
3+
val p = new P
4+
5+
trait S2 {
6+
def f(x: p.S1): Int
7+
}
8+
}
9+
10+
class P2 extends P {
11+
object O2 extends S2 {
12+
def f(x: S1) = 5
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
S.scala:1: error: class S needs to be abstract, since method g in class J of type (y: Int, z: java.util.List)Int is not defined
2+
(Note that java.util.List does not match java.util.List[String]. To implement a raw type, use java.util.List[_])
3+
class S extends J {
4+
^
5+
one error found
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
public abstract class J {
2+
public abstract int f();
3+
public abstract int g(int y, java.util.List z);
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class S extends J {
2+
def f() = 55
3+
def g(y: Int, z: java.util.List[String]) = 11
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
abstract-concrete-methods.scala:7: error: class Outer2 needs to be abstract, since method score in trait Outer of type (i: Outer2#Inner)Double is not defined
2+
(Note that This#Inner does not match Outer2#Inner: class Inner in class Outer2 is a subclass of trait Inner in trait Outer, but method parameter types must match exactly.)
3+
class Outer2 extends Outer[Outer2] {
4+
^
5+
one error found
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
trait Outer[This <: Outer[This]] {
2+
self: This =>
3+
4+
trait Inner
5+
def score(i: This#Inner): Double
6+
}
7+
class Outer2 extends Outer[Outer2] {
8+
class Inner extends super.Inner
9+
def score(i: Outer2#Inner) = 0.0
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
abstract-explaintypes.scala:6: error: type mismatch;
2+
found : A
3+
required: A.this.T
4+
def foo2: T = bar().baz();
5+
^
6+
A <: A.this.T?
7+
false
8+
abstract-explaintypes.scala:9: error: type mismatch;
9+
found : A
10+
required: A.this.T
11+
def foo5: T = baz().baz();
12+
^
13+
A <: A.this.T?
14+
false
15+
two errors found
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-explaintypes
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
trait A {
2+
type T <: A;
3+
def baz(): A;
4+
def bar(): T;
5+
def foo1: A = bar().bar();
6+
def foo2: T = bar().baz();
7+
def foo3 = bar().baz();
8+
def foo4: A = baz().bar();
9+
def foo5: T = baz().baz();
10+
def foo6 = baz().baz();
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
abstract-inaccessible.scala:5: warning: method implementMe in trait YourTrait references private[foo] trait Bippy.
2+
Classes which cannot access Bippy may be unable to provide a concrete implementation of implementMe.
3+
def implementMe(f: Int => (String, Bippy)): Unit
4+
^
5+
abstract-inaccessible.scala:6: warning: method overrideMe in trait YourTrait references private[foo] trait Bippy.
6+
Classes which cannot access Bippy may be unable to override overrideMe.
7+
def overrideMe[T <: Bippy](x: T): T = x
8+
^
9+
abstract-inaccessible.scala:7: warning: method overrideMeAlso in trait YourTrait references private[foo] trait Bippy.
10+
Classes which cannot access Bippy may be unable to override overrideMeAlso.
11+
def overrideMeAlso(x: Map[Int, Set[Bippy]]) = 5
12+
^
13+
error: No warnings can be incurred under -Xfatal-warnings.
14+
three warnings found
15+
one error found
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-Xfatal-warnings -Xlint
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package foo {
2+
private[foo] trait Bippy { }
3+
4+
trait YourTrait {
5+
def implementMe(f: Int => (String, Bippy)): Unit
6+
def overrideMe[T <: Bippy](x: T): T = x
7+
def overrideMeAlso(x: Map[Int, Set[Bippy]]) = 5
8+
}
9+
}
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
abstract-report.scala:1: error: class Unimplemented needs to be abstract, since:
2+
it has 12 unimplemented members.
3+
/** As seen from class Unimplemented, the missing signatures are as follows.
4+
* For convenience, these are usable as stub implementations.
5+
*/
6+
// Members declared in scala.collection.GenTraversableOnce
7+
def isTraversableAgain: Boolean = ???
8+
def toIterator: Iterator[String] = ???
9+
def toStream: Stream[String] = ???
10+
11+
// Members declared in scala.collection.TraversableOnce
12+
def copyToArray[B >: String](xs: Array[B],start: Int,len: Int): Unit = ???
13+
def exists(p: String => Boolean): Boolean = ???
14+
def find(p: String => Boolean): Option[String] = ???
15+
def forall(p: String => Boolean): Boolean = ???
16+
def foreach[U](f: String => U): Unit = ???
17+
def hasDefiniteSize: Boolean = ???
18+
def isEmpty: Boolean = ???
19+
def seq: scala.collection.TraversableOnce[String] = ???
20+
def toTraversable: Traversable[String] = ???
21+
22+
class Unimplemented extends TraversableOnce[String] { }
23+
^
24+
one error found
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
class Unimplemented extends TraversableOnce[String] { }
+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
abstract-report2.scala:3: error: class Foo needs to be abstract, since:
2+
it has 13 unimplemented members.
3+
/** As seen from class Foo, the missing signatures are as follows.
4+
* For convenience, these are usable as stub implementations.
5+
*/
6+
def add(x$1: Int): Boolean = ???
7+
def addAll(x$1: java.util.Collection[_ <: Int]): Boolean = ???
8+
def clear(): Unit = ???
9+
def contains(x$1: Any): Boolean = ???
10+
def containsAll(x$1: java.util.Collection[_]): Boolean = ???
11+
def isEmpty(): Boolean = ???
12+
def iterator(): java.util.Iterator[Int] = ???
13+
def remove(x$1: Any): Boolean = ???
14+
def removeAll(x$1: java.util.Collection[_]): Boolean = ???
15+
def retainAll(x$1: java.util.Collection[_]): Boolean = ???
16+
def size(): Int = ???
17+
def toArray[T](x$1: Array[T with Object]): Array[T with Object] = ???
18+
def toArray(): Array[Object] = ???
19+
20+
class Foo extends Collection[Int]
21+
^
22+
abstract-report2.scala:5: error: class Bar needs to be abstract, since:
23+
it has 13 unimplemented members.
24+
/** As seen from class Bar, the missing signatures are as follows.
25+
* For convenience, these are usable as stub implementations.
26+
*/
27+
def add(x$1: List[_ <: String]): Boolean = ???
28+
def addAll(x$1: java.util.Collection[_ <: List[_ <: String]]): Boolean = ???
29+
def clear(): Unit = ???
30+
def contains(x$1: Any): Boolean = ???
31+
def containsAll(x$1: java.util.Collection[_]): Boolean = ???
32+
def isEmpty(): Boolean = ???
33+
def iterator(): java.util.Iterator[List[_ <: String]] = ???
34+
def remove(x$1: Any): Boolean = ???
35+
def removeAll(x$1: java.util.Collection[_]): Boolean = ???
36+
def retainAll(x$1: java.util.Collection[_]): Boolean = ???
37+
def size(): Int = ???
38+
def toArray[T](x$1: Array[T with Object]): Array[T with Object] = ???
39+
def toArray(): Array[Object] = ???
40+
41+
class Bar extends Collection[List[_ <: String]]
42+
^
43+
abstract-report2.scala:7: error: class Baz needs to be abstract, since:
44+
it has 13 unimplemented members.
45+
/** As seen from class Baz, the missing signatures are as follows.
46+
* For convenience, these are usable as stub implementations.
47+
*/
48+
def add(x$1: T): Boolean = ???
49+
def addAll(x$1: java.util.Collection[_ <: T]): Boolean = ???
50+
def clear(): Unit = ???
51+
def contains(x$1: Any): Boolean = ???
52+
def containsAll(x$1: java.util.Collection[_]): Boolean = ???
53+
def isEmpty(): Boolean = ???
54+
def iterator(): java.util.Iterator[T] = ???
55+
def remove(x$1: Any): Boolean = ???
56+
def removeAll(x$1: java.util.Collection[_]): Boolean = ???
57+
def retainAll(x$1: java.util.Collection[_]): Boolean = ???
58+
def size(): Int = ???
59+
def toArray[T](x$1: Array[T with Object]): Array[T with Object] = ???
60+
def toArray(): Array[Object] = ???
61+
62+
class Baz[T] extends Collection[T]
63+
^
64+
abstract-report2.scala:15: error: class Dingus needs to be abstract, since:
65+
it has 24 unimplemented members.
66+
/** As seen from class Dingus, the missing signatures are as follows.
67+
* For convenience, these are usable as stub implementations.
68+
*/
69+
// Members declared in java.util.Collection
70+
def add(x$1: String): Boolean = ???
71+
def addAll(x$1: java.util.Collection[_ <: String]): Boolean = ???
72+
def clear(): Unit = ???
73+
def contains(x$1: Any): Boolean = ???
74+
def containsAll(x$1: java.util.Collection[_]): Boolean = ???
75+
def iterator(): java.util.Iterator[String] = ???
76+
def remove(x$1: Any): Boolean = ???
77+
def removeAll(x$1: java.util.Collection[_]): Boolean = ???
78+
def retainAll(x$1: java.util.Collection[_]): Boolean = ???
79+
def toArray[T](x$1: Array[T with Object]): Array[T with Object] = ???
80+
def toArray(): Array[Object] = ???
81+
82+
// Members declared in scala.collection.GenTraversableOnce
83+
def isTraversableAgain: Boolean = ???
84+
def toIterator: Iterator[(Set[Int], String)] = ???
85+
def toStream: Stream[(Set[Int], String)] = ???
86+
87+
// Members declared in scala.collection.TraversableOnce
88+
def copyToArray[B >: (Set[Int], String)](xs: Array[B],start: Int,len: Int): Unit = ???
89+
def exists(p: ((Set[Int], String)) => Boolean): Boolean = ???
90+
def find(p: ((Set[Int], String)) => Boolean): Option[(Set[Int], String)] = ???
91+
def forall(p: ((Set[Int], String)) => Boolean): Boolean = ???
92+
def foreach[U](f: ((Set[Int], String)) => U): Unit = ???
93+
def hasDefiniteSize: Boolean = ???
94+
def isEmpty: Boolean = ???
95+
def seq: scala.collection.TraversableOnce[(Set[Int], String)] = ???
96+
def toTraversable: Traversable[(Set[Int], String)] = ???
97+
98+
// Members declared in Xyz
99+
def foo(x: List[Int]): Boolean = ???
100+
101+
class Dingus extends Bippy[String, Set[Int], List[Int]]
102+
^
103+
four errors found
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import java.util.Collection
2+
3+
class Foo extends Collection[Int]
4+
5+
class Bar extends Collection[List[_ <: String]]
6+
7+
class Baz[T] extends Collection[T]
8+
9+
trait Xyz[T] {
10+
def foo(x: T): Boolean
11+
}
12+
13+
trait Bippy[T1, T2, T3] extends Collection[T1] with TraversableOnce[(T2, String)] with Xyz[T3]
14+
15+
class Dingus extends Bippy[String, Set[Int], List[Int]]

tests/untried/neg/abstract-vars.check

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
abstract-vars.scala:5: error: class Fail1 needs to be abstract, since variable x is not defined
2+
(Note that variables need to be initialized to be defined)
3+
class Fail1 extends A {
4+
^
5+
abstract-vars.scala:9: error: class Fail2 needs to be abstract, since variable x in class A of type Int is not defined
6+
(Note that variables need to be initialized to be defined)
7+
class Fail2 extends A { }
8+
^
9+
abstract-vars.scala:11: error: class Fail3 needs to be abstract, since variable x in class A of type Int is not defined
10+
(Note that an abstract var requires a setter in addition to the getter)
11+
class Fail3 extends A {
12+
^
13+
abstract-vars.scala:14: error: class Fail4 needs to be abstract, since variable x in class A of type Int is not defined
14+
(Note that an abstract var requires a setter in addition to the getter)
15+
class Fail4 extends A {
16+
^
17+
abstract-vars.scala:18: error: class Fail5 needs to be abstract, since variable x in class A of type Int is not defined
18+
(Note that an abstract var requires a getter in addition to the setter)
19+
class Fail5 extends A {
20+
^
21+
5 errors found

tests/untried/neg/abstract-vars.scala

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
abstract class A {
2+
var x: Int
3+
}
4+
5+
class Fail1 extends A {
6+
var x: Int
7+
}
8+
9+
class Fail2 extends A { }
10+
11+
class Fail3 extends A {
12+
val x: Int = 5
13+
}
14+
class Fail4 extends A {
15+
def x: Int = 5
16+
}
17+
18+
class Fail5 extends A {
19+
def x_=(y: Int) = ()
20+
}
21+
22+
class Success1 extends A {
23+
val x: Int = 5
24+
def x_=(y: Int) = ()
25+
}
26+
27+
class Success2 extends A {
28+
var x: Int = 5
29+
}

tests/untried/neg/abstract.check

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
abstract.scala:6: error: type mismatch;
2+
found : A
3+
required: A.this.T
4+
def foo2: T = bar().baz();
5+
^
6+
abstract.scala:9: error: type mismatch;
7+
found : A
8+
required: A.this.T
9+
def foo5: T = baz().baz();
10+
^
11+
two errors found

tests/untried/neg/abstract.scala

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
trait A {
2+
type T <: A;
3+
def baz(): A;
4+
def bar(): T;
5+
def foo1: A = bar().bar();
6+
def foo2: T = bar().baz();
7+
def foo3 = bar().baz();
8+
def foo4: A = baz().bar();
9+
def foo5: T = baz().baz();
10+
def foo6 = baz().baz();
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
abstraction-from-volatile-type-error.scala:9: error: illegal abstraction from value with volatile type a.Tv
2+
val tv : a.Tv
3+
^
4+
one error found
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class A {
2+
type T
3+
type Tv = AnyRef with T
4+
}
5+
6+
object Test {
7+
type B = a.type forSome {
8+
val a : A
9+
val tv : a.Tv
10+
}
11+
}

tests/untried/neg/accesses.check

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
accesses.scala:23: error: overriding method f2 in class A of type ()Unit;
2+
method f2 has weaker access privileges; it should not be private
3+
private def f2(): Unit = ()
4+
^
5+
accesses.scala:24: error: overriding method f3 in class A of type ()Unit;
6+
method f3 has weaker access privileges; it should be at least protected
7+
private[p2] def f3(): Unit = ()
8+
^
9+
accesses.scala:25: error: overriding method f4 in class A of type ()Unit;
10+
method f4 has weaker access privileges; it should be at least private[p1]
11+
private[p2] def f4(): Unit
12+
^
13+
accesses.scala:26: error: overriding method f5 in class A of type ()Unit;
14+
method f5 has weaker access privileges; it should be at least protected[p1]
15+
protected[p2] def f5(): Unit
16+
^
17+
four errors found

0 commit comments

Comments
 (0)