git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@5723 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
parent
9c2316fd39
commit
d77116296f
|
@ -0,0 +1,4 @@
|
|||
bug500.scala:3 error: lower bound X does not conform to upper bound Y
|
||||
type T >: X <: Y;
|
||||
^
|
||||
one error found
|
|
@ -0,0 +1,22 @@
|
|||
object Magic {
|
||||
abstract class O[X,Y] {
|
||||
type T >: X <: Y;
|
||||
class I { def magic(v: T): T = v; }
|
||||
}
|
||||
def magic[X,Y](v: X): Y = {
|
||||
val o: O[X,Y] = null;
|
||||
val i: o.I = new o.I();
|
||||
i.magic(v);
|
||||
}
|
||||
}
|
||||
|
||||
object Test {
|
||||
def main(args: Array[String]): Unit = {
|
||||
try {
|
||||
val i: Int = Magic.magic("42");
|
||||
System.out.println(i);
|
||||
} catch {
|
||||
case ex: Throwable => ex.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
bug501.scala:3 error: lower bound X does not conform to upper bound Y
|
||||
abstract class I { type T >: X <: Y; }
|
||||
^
|
||||
one error found
|
|
@ -0,0 +1,18 @@
|
|||
object Magic {
|
||||
class O[X,Y] {
|
||||
abstract class I { type T >: X <: Y; }
|
||||
val i: I = null;
|
||||
def magic(v: i.T): i.T = v;
|
||||
}
|
||||
def magic[X,Y](v: X): Y = {
|
||||
val o: O[X,Y] = new O();
|
||||
o.magic(v);
|
||||
}
|
||||
}
|
||||
|
||||
object Test {
|
||||
def main(args: Array[String]): Unit = {
|
||||
val i: Int = Magic.magic("42");
|
||||
System.out.println(i);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
bug520.scala:8 error: overloaded method verifyKeyword needs result type
|
||||
verifyKeyword("", source, pos);
|
||||
^
|
||||
one error found
|
|
@ -0,0 +1,9 @@
|
|||
object test {
|
||||
|
||||
def verifyKeyword(keyword : String, source : java.io.File, pos : Int) = {
|
||||
assert(keyword != null);
|
||||
}
|
||||
|
||||
def verifyKeyword(source : java.io.File, pos : Int) =
|
||||
verifyKeyword("", source, pos);
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
bug521.scala:12 error: class PlainFile needs to be abstract, since method path in class AbstractFile of type => java.lang.String is not defined
|
||||
class PlainFile(val file : File) extends AbstractFile {}
|
||||
^
|
||||
bug521.scala:21 error: error overriding value file in class PlainFile of type => java.io.File;
|
||||
value file needs `override' modifier
|
||||
final class ZipArchive(val file : File, archive : ZipFile) extends PlainFile(file) {
|
||||
^
|
||||
bug521.scala:21 error: class ZipArchive needs to be abstract, since method path in class AbstractFile of type => java.lang.String is not defined
|
||||
final class ZipArchive(val file : File, archive : ZipFile) extends PlainFile(file) {
|
||||
^
|
||||
bug521.scala:23 error: error overriding value path in class VirtualFile of type => java.lang.String;
|
||||
method path needs to be an immutable value
|
||||
override def path = "";
|
||||
^
|
||||
four errors found
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
// AbstractFile.scala
|
||||
package test;
|
||||
import java.io._;
|
||||
abstract class AbstractFile {
|
||||
def path : String;
|
||||
}
|
||||
|
||||
// PlainFile.scala
|
||||
//package scala.tools.nsc.io;
|
||||
//import java.io._;
|
||||
class PlainFile(val file : File) extends AbstractFile {}
|
||||
// VirtualFile.scala
|
||||
//package scala.tools.nsc.io;
|
||||
class VirtualFile(val name : String, val path : String) extends AbstractFile {
|
||||
}
|
||||
// ZipArchive.scala
|
||||
//package scala.tools.nsc.io;
|
||||
//import java.io._;
|
||||
import java.util.zip._;
|
||||
final class ZipArchive(val file : File, archive : ZipFile) extends PlainFile(file) {
|
||||
class Entry(name : String, path : String) extends VirtualFile(name, path) {
|
||||
override def path = "";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
mixins.scala:9 error: illegal inheritance; superclass C
|
||||
is not a subclass of the superclass B
|
||||
of the mixin class M
|
||||
class D extends C with M
|
||||
^
|
||||
one error found
|
|
@ -0,0 +1,9 @@
|
|||
class A;
|
||||
|
||||
class B extends A
|
||||
|
||||
class C extends A
|
||||
|
||||
mixin class M extends B
|
||||
|
||||
class D extends C with M
|
|
@ -39,21 +39,21 @@ import Help.bar;
|
|||
import Help.mix;
|
||||
import Help.sub;
|
||||
|
||||
abstract class Foo___ { type I<:AnyRef; def f: I ; f; }
|
||||
abstract class Foo__f { type I<:AnyRef; def f: I = {foo; null}; f; }
|
||||
abstract class Foo___ { type I>:AllRef<:AnyRef; def f: I ; f; }
|
||||
abstract class Foo__f { type I>:AllRef<:AnyRef; def f: I = {foo; null}; f; }
|
||||
abstract class Foo_I_ { class I ; def f: I ; f; }
|
||||
abstract class Foo_If { class I ; def f: I = {foo; null}; f; }
|
||||
abstract class FooX__[X] { type I<:AnyRef; def f: I ; f; }
|
||||
abstract class FooX_f[X] { type I<:AnyRef; def f: I = {foo; null}; f; }
|
||||
abstract class FooX__[X] { type I>:AllRef<:AnyRef; def f: I ; f; }
|
||||
abstract class FooX_f[X] { type I>:AllRef<:AnyRef; def f: I = {foo; null}; f; }
|
||||
abstract class FooXI_[X] { class I ; def f: I ; f; }
|
||||
abstract class FooXIf[X] { class I ; def f: I = {foo; null}; f; }
|
||||
|
||||
trait Bar___ { type I<:AnyRef; def f: I ; f; }
|
||||
trait Bar__f { type I<:AnyRef; def f: I = {bar; null}; f; }
|
||||
trait Bar___ { type I>:AllRef<:AnyRef; def f: I ; f; }
|
||||
trait Bar__f { type I>:AllRef<:AnyRef; def f: I = {bar; null}; f; }
|
||||
trait Bar_I_ { class I ; def f: I ; f; }
|
||||
trait Bar_If { class I ; def f: I = {bar; null}; f; }
|
||||
trait BarY__[Y] { type I<:AnyRef; def f: I ; f; }
|
||||
trait BarY_f[Y] { type I<:AnyRef; def f: I = {bar; null}; f; }
|
||||
trait BarY__[Y] { type I>:AllRef<:AnyRef; def f: I ; f; }
|
||||
trait BarY_f[Y] { type I>:AllRef<:AnyRef; def f: I = {bar; null}; f; }
|
||||
trait BarYI_[Y] { class I ; def f: I ; f; }
|
||||
trait BarYIf[Y] { class I ; def f: I = {bar; null}; f; }
|
||||
|
||||
|
|
|
@ -335,7 +335,7 @@ object Bug257Test {
|
|||
// version - A
|
||||
|
||||
abstract class Bug266AFoo {
|
||||
type T <: AnyRef;
|
||||
type T >: AllRef <: AnyRef;
|
||||
abstract class I0 { def f(x: T): Unit; f(null); }
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue