diff --git a/test/files/neg/bug500.check b/test/files/neg/bug500.check new file mode 100644 index 000000000..245945fbc --- /dev/null +++ b/test/files/neg/bug500.check @@ -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 diff --git a/test/files/neg/bug500.scala b/test/files/neg/bug500.scala new file mode 100644 index 000000000..d572cd8b8 --- /dev/null +++ b/test/files/neg/bug500.scala @@ -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() + } + } +} diff --git a/test/files/neg/bug501.check b/test/files/neg/bug501.check new file mode 100644 index 000000000..7b00a3903 --- /dev/null +++ b/test/files/neg/bug501.check @@ -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 diff --git a/test/files/neg/bug501.scala b/test/files/neg/bug501.scala new file mode 100644 index 000000000..454344974 --- /dev/null +++ b/test/files/neg/bug501.scala @@ -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); + } +} diff --git a/test/files/neg/bug520.check b/test/files/neg/bug520.check new file mode 100644 index 000000000..4fb56d90f --- /dev/null +++ b/test/files/neg/bug520.check @@ -0,0 +1,4 @@ +bug520.scala:8 error: overloaded method verifyKeyword needs result type + verifyKeyword("", source, pos); + ^ +one error found diff --git a/test/files/neg/bug520.scala b/test/files/neg/bug520.scala new file mode 100644 index 000000000..949a50951 --- /dev/null +++ b/test/files/neg/bug520.scala @@ -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); +} diff --git a/test/files/neg/bug521.check b/test/files/neg/bug521.check new file mode 100644 index 000000000..818f80052 --- /dev/null +++ b/test/files/neg/bug521.check @@ -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 diff --git a/test/files/neg/bug521.scala b/test/files/neg/bug521.scala new file mode 100755 index 000000000..065f65557 --- /dev/null +++ b/test/files/neg/bug521.scala @@ -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 = ""; + } +} diff --git a/test/files/neg/mixins.check b/test/files/neg/mixins.check new file mode 100644 index 000000000..805f9c424 --- /dev/null +++ b/test/files/neg/mixins.check @@ -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 diff --git a/test/files/neg/mixins.scala b/test/files/neg/mixins.scala new file mode 100644 index 000000000..dd0ec2332 --- /dev/null +++ b/test/files/neg/mixins.scala @@ -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 diff --git a/test/files/run/bridges.scala b/test/files/run/bridges.scala index bf3781fde..65ba2f13c 100644 --- a/test/files/run/bridges.scala +++ b/test/files/run/bridges.scala @@ -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; } diff --git a/test/files/run/bugs.scala b/test/files/run/bugs.scala index 4cb8dbeb3..2c940834e 100644 --- a/test/files/run/bugs.scala +++ b/test/files/run/bugs.scala @@ -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); } }