Skip to content

Add untried tests from scala/test/files/{pos,neg} #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 13, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 2 additions & 0 deletions tests/untried/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.log
*.obj/
8 changes: 8 additions & 0 deletions tests/untried/filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#
#Java HotSpot(TM) 64-Bit Server VM warning: Failed to reserve shared memory (errno = 28).
Java HotSpot\(TM\) .* warning:
# Hotspot receiving VM options through the $_JAVA_OPTIONS
# env variable outputs them on stderr
Picked up _JAVA_OPTIONS:
# Filter out a message caused by this bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8021205
objc\[\d+\]: Class JavaLaunchHelper is implemented in both .* and .*\. One of the two will be used\. Which one is undefined\.
5 changes: 5 additions & 0 deletions tests/untried/neg/abstract-class-2.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
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
(Note that P.this.p.S1 does not match P2.this.S1: their prefixes (i.e. enclosing instances) differ)
object O2 extends S2 {
^
one error found
14 changes: 14 additions & 0 deletions tests/untried/neg/abstract-class-2.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class P {
trait S1
val p = new P

trait S2 {
def f(x: p.S1): Int
}
}

class P2 extends P {
object O2 extends S2 {
def f(x: S1) = 5
}
}
5 changes: 5 additions & 0 deletions tests/untried/neg/abstract-class-error.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
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
(Note that java.util.List does not match java.util.List[String]. To implement a raw type, use java.util.List[_])
class S extends J {
^
one error found
4 changes: 4 additions & 0 deletions tests/untried/neg/abstract-class-error/J.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
public abstract class J {
public abstract int f();
public abstract int g(int y, java.util.List z);
}
4 changes: 4 additions & 0 deletions tests/untried/neg/abstract-class-error/S.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class S extends J {
def f() = 55
def g(y: Int, z: java.util.List[String]) = 11
}
5 changes: 5 additions & 0 deletions tests/untried/neg/abstract-concrete-methods.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
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
(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.)
class Outer2 extends Outer[Outer2] {
^
one error found
10 changes: 10 additions & 0 deletions tests/untried/neg/abstract-concrete-methods.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
trait Outer[This <: Outer[This]] {
self: This =>

trait Inner
def score(i: This#Inner): Double
}
class Outer2 extends Outer[Outer2] {
class Inner extends super.Inner
def score(i: Outer2#Inner) = 0.0
}
15 changes: 15 additions & 0 deletions tests/untried/neg/abstract-explaintypes.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
abstract-explaintypes.scala:6: error: type mismatch;
found : A
required: A.this.T
def foo2: T = bar().baz();
^
A <: A.this.T?
false
abstract-explaintypes.scala:9: error: type mismatch;
found : A
required: A.this.T
def foo5: T = baz().baz();
^
A <: A.this.T?
false
two errors found
1 change: 1 addition & 0 deletions tests/untried/neg/abstract-explaintypes.flags
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-explaintypes
11 changes: 11 additions & 0 deletions tests/untried/neg/abstract-explaintypes.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
trait A {
type T <: A;
def baz(): A;
def bar(): T;
def foo1: A = bar().bar();
def foo2: T = bar().baz();
def foo3 = bar().baz();
def foo4: A = baz().bar();
def foo5: T = baz().baz();
def foo6 = baz().baz();
}
15 changes: 15 additions & 0 deletions tests/untried/neg/abstract-inaccessible.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
abstract-inaccessible.scala:5: warning: method implementMe in trait YourTrait references private[foo] trait Bippy.
Classes which cannot access Bippy may be unable to provide a concrete implementation of implementMe.
def implementMe(f: Int => (String, Bippy)): Unit
^
abstract-inaccessible.scala:6: warning: method overrideMe in trait YourTrait references private[foo] trait Bippy.
Classes which cannot access Bippy may be unable to override overrideMe.
def overrideMe[T <: Bippy](x: T): T = x
^
abstract-inaccessible.scala:7: warning: method overrideMeAlso in trait YourTrait references private[foo] trait Bippy.
Classes which cannot access Bippy may be unable to override overrideMeAlso.
def overrideMeAlso(x: Map[Int, Set[Bippy]]) = 5
^
error: No warnings can be incurred under -Xfatal-warnings.
three warnings found
one error found
1 change: 1 addition & 0 deletions tests/untried/neg/abstract-inaccessible.flags
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-Xfatal-warnings -Xlint
9 changes: 9 additions & 0 deletions tests/untried/neg/abstract-inaccessible.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package foo {
private[foo] trait Bippy { }

trait YourTrait {
def implementMe(f: Int => (String, Bippy)): Unit
def overrideMe[T <: Bippy](x: T): T = x
def overrideMeAlso(x: Map[Int, Set[Bippy]]) = 5
}
}
24 changes: 24 additions & 0 deletions tests/untried/neg/abstract-report.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
abstract-report.scala:1: error: class Unimplemented needs to be abstract, since:
it has 12 unimplemented members.
/** As seen from class Unimplemented, the missing signatures are as follows.
* For convenience, these are usable as stub implementations.
*/
// Members declared in scala.collection.GenTraversableOnce
def isTraversableAgain: Boolean = ???
def toIterator: Iterator[String] = ???
def toStream: Stream[String] = ???

// Members declared in scala.collection.TraversableOnce
def copyToArray[B >: String](xs: Array[B],start: Int,len: Int): Unit = ???
def exists(p: String => Boolean): Boolean = ???
def find(p: String => Boolean): Option[String] = ???
def forall(p: String => Boolean): Boolean = ???
def foreach[U](f: String => U): Unit = ???
def hasDefiniteSize: Boolean = ???
def isEmpty: Boolean = ???
def seq: scala.collection.TraversableOnce[String] = ???
def toTraversable: Traversable[String] = ???

class Unimplemented extends TraversableOnce[String] { }
^
one error found
1 change: 1 addition & 0 deletions tests/untried/neg/abstract-report.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
class Unimplemented extends TraversableOnce[String] { }
103 changes: 103 additions & 0 deletions tests/untried/neg/abstract-report2.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
abstract-report2.scala:3: error: class Foo needs to be abstract, since:
it has 13 unimplemented members.
/** As seen from class Foo, the missing signatures are as follows.
* For convenience, these are usable as stub implementations.
*/
def add(x$1: Int): Boolean = ???
def addAll(x$1: java.util.Collection[_ <: Int]): Boolean = ???
def clear(): Unit = ???
def contains(x$1: Any): Boolean = ???
def containsAll(x$1: java.util.Collection[_]): Boolean = ???
def isEmpty(): Boolean = ???
def iterator(): java.util.Iterator[Int] = ???
def remove(x$1: Any): Boolean = ???
def removeAll(x$1: java.util.Collection[_]): Boolean = ???
def retainAll(x$1: java.util.Collection[_]): Boolean = ???
def size(): Int = ???
def toArray[T](x$1: Array[T with Object]): Array[T with Object] = ???
def toArray(): Array[Object] = ???

class Foo extends Collection[Int]
^
abstract-report2.scala:5: error: class Bar needs to be abstract, since:
it has 13 unimplemented members.
/** As seen from class Bar, the missing signatures are as follows.
* For convenience, these are usable as stub implementations.
*/
def add(x$1: List[_ <: String]): Boolean = ???
def addAll(x$1: java.util.Collection[_ <: List[_ <: String]]): Boolean = ???
def clear(): Unit = ???
def contains(x$1: Any): Boolean = ???
def containsAll(x$1: java.util.Collection[_]): Boolean = ???
def isEmpty(): Boolean = ???
def iterator(): java.util.Iterator[List[_ <: String]] = ???
def remove(x$1: Any): Boolean = ???
def removeAll(x$1: java.util.Collection[_]): Boolean = ???
def retainAll(x$1: java.util.Collection[_]): Boolean = ???
def size(): Int = ???
def toArray[T](x$1: Array[T with Object]): Array[T with Object] = ???
def toArray(): Array[Object] = ???

class Bar extends Collection[List[_ <: String]]
^
abstract-report2.scala:7: error: class Baz needs to be abstract, since:
it has 13 unimplemented members.
/** As seen from class Baz, the missing signatures are as follows.
* For convenience, these are usable as stub implementations.
*/
def add(x$1: T): Boolean = ???
def addAll(x$1: java.util.Collection[_ <: T]): Boolean = ???
def clear(): Unit = ???
def contains(x$1: Any): Boolean = ???
def containsAll(x$1: java.util.Collection[_]): Boolean = ???
def isEmpty(): Boolean = ???
def iterator(): java.util.Iterator[T] = ???
def remove(x$1: Any): Boolean = ???
def removeAll(x$1: java.util.Collection[_]): Boolean = ???
def retainAll(x$1: java.util.Collection[_]): Boolean = ???
def size(): Int = ???
def toArray[T](x$1: Array[T with Object]): Array[T with Object] = ???
def toArray(): Array[Object] = ???

class Baz[T] extends Collection[T]
^
abstract-report2.scala:15: error: class Dingus needs to be abstract, since:
it has 24 unimplemented members.
/** As seen from class Dingus, the missing signatures are as follows.
* For convenience, these are usable as stub implementations.
*/
// Members declared in java.util.Collection
def add(x$1: String): Boolean = ???
def addAll(x$1: java.util.Collection[_ <: String]): Boolean = ???
def clear(): Unit = ???
def contains(x$1: Any): Boolean = ???
def containsAll(x$1: java.util.Collection[_]): Boolean = ???
def iterator(): java.util.Iterator[String] = ???
def remove(x$1: Any): Boolean = ???
def removeAll(x$1: java.util.Collection[_]): Boolean = ???
def retainAll(x$1: java.util.Collection[_]): Boolean = ???
def toArray[T](x$1: Array[T with Object]): Array[T with Object] = ???
def toArray(): Array[Object] = ???

// Members declared in scala.collection.GenTraversableOnce
def isTraversableAgain: Boolean = ???
def toIterator: Iterator[(Set[Int], String)] = ???
def toStream: Stream[(Set[Int], String)] = ???

// Members declared in scala.collection.TraversableOnce
def copyToArray[B >: (Set[Int], String)](xs: Array[B],start: Int,len: Int): Unit = ???
def exists(p: ((Set[Int], String)) => Boolean): Boolean = ???
def find(p: ((Set[Int], String)) => Boolean): Option[(Set[Int], String)] = ???
def forall(p: ((Set[Int], String)) => Boolean): Boolean = ???
def foreach[U](f: ((Set[Int], String)) => U): Unit = ???
def hasDefiniteSize: Boolean = ???
def isEmpty: Boolean = ???
def seq: scala.collection.TraversableOnce[(Set[Int], String)] = ???
def toTraversable: Traversable[(Set[Int], String)] = ???

// Members declared in Xyz
def foo(x: List[Int]): Boolean = ???

class Dingus extends Bippy[String, Set[Int], List[Int]]
^
four errors found
15 changes: 15 additions & 0 deletions tests/untried/neg/abstract-report2.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import java.util.Collection

class Foo extends Collection[Int]

class Bar extends Collection[List[_ <: String]]

class Baz[T] extends Collection[T]

trait Xyz[T] {
def foo(x: T): Boolean
}

trait Bippy[T1, T2, T3] extends Collection[T1] with TraversableOnce[(T2, String)] with Xyz[T3]

class Dingus extends Bippy[String, Set[Int], List[Int]]
21 changes: 21 additions & 0 deletions tests/untried/neg/abstract-vars.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
abstract-vars.scala:5: error: class Fail1 needs to be abstract, since variable x is not defined
(Note that variables need to be initialized to be defined)
class Fail1 extends A {
^
abstract-vars.scala:9: error: class Fail2 needs to be abstract, since variable x in class A of type Int is not defined
(Note that variables need to be initialized to be defined)
class Fail2 extends A { }
^
abstract-vars.scala:11: error: class Fail3 needs to be abstract, since variable x in class A of type Int is not defined
(Note that an abstract var requires a setter in addition to the getter)
class Fail3 extends A {
^
abstract-vars.scala:14: error: class Fail4 needs to be abstract, since variable x in class A of type Int is not defined
(Note that an abstract var requires a setter in addition to the getter)
class Fail4 extends A {
^
abstract-vars.scala:18: error: class Fail5 needs to be abstract, since variable x in class A of type Int is not defined
(Note that an abstract var requires a getter in addition to the setter)
class Fail5 extends A {
^
5 errors found
29 changes: 29 additions & 0 deletions tests/untried/neg/abstract-vars.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
abstract class A {
var x: Int
}

class Fail1 extends A {
var x: Int
}

class Fail2 extends A { }

class Fail3 extends A {
val x: Int = 5
}
class Fail4 extends A {
def x: Int = 5
}

class Fail5 extends A {
def x_=(y: Int) = ()
}

class Success1 extends A {
val x: Int = 5
def x_=(y: Int) = ()
}

class Success2 extends A {
var x: Int = 5
}
11 changes: 11 additions & 0 deletions tests/untried/neg/abstract.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
abstract.scala:6: error: type mismatch;
found : A
required: A.this.T
def foo2: T = bar().baz();
^
abstract.scala:9: error: type mismatch;
found : A
required: A.this.T
def foo5: T = baz().baz();
^
two errors found
11 changes: 11 additions & 0 deletions tests/untried/neg/abstract.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
trait A {
type T <: A;
def baz(): A;
def bar(): T;
def foo1: A = bar().bar();
def foo2: T = bar().baz();
def foo3 = bar().baz();
def foo4: A = baz().bar();
def foo5: T = baz().baz();
def foo6 = baz().baz();
}
4 changes: 4 additions & 0 deletions tests/untried/neg/abstraction-from-volatile-type-error.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
abstraction-from-volatile-type-error.scala:9: error: illegal abstraction from value with volatile type a.Tv
val tv : a.Tv
^
one error found
11 changes: 11 additions & 0 deletions tests/untried/neg/abstraction-from-volatile-type-error.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class A {
type T
type Tv = AnyRef with T
}

object Test {
type B = a.type forSome {
val a : A
val tv : a.Tv
}
}
17 changes: 17 additions & 0 deletions tests/untried/neg/accesses.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
accesses.scala:23: error: overriding method f2 in class A of type ()Unit;
method f2 has weaker access privileges; it should not be private
private def f2(): Unit = ()
^
accesses.scala:24: error: overriding method f3 in class A of type ()Unit;
method f3 has weaker access privileges; it should be at least protected
private[p2] def f3(): Unit = ()
^
accesses.scala:25: error: overriding method f4 in class A of type ()Unit;
method f4 has weaker access privileges; it should be at least private[p1]
private[p2] def f4(): Unit
^
accesses.scala:26: error: overriding method f5 in class A of type ()Unit;
method f5 has weaker access privileges; it should be at least protected[p1]
protected[p2] def f5(): Unit
^
four errors found
Loading