From 0642bdf04484bfccd03abacdd278750eebf22d98 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sat, 16 Oct 2010 16:55:30 +0000 Subject: new tests. no review. --- test/files/pos/3567/Foo.scala | 3 +++ test/files/pos/3567/Outer.java | 7 +++++++ test/files/pos/t3672.scala | 4 ++++ test/files/pos/t3833.scala | 26 ++++++++++++++++++++++++++ test/files/pos/t3837.scala | 10 ++++++++++ test/files/pos/t3856.scala | 8 ++++++++ 6 files changed, 58 insertions(+) create mode 100644 test/files/pos/3567/Foo.scala create mode 100644 test/files/pos/3567/Outer.java create mode 100644 test/files/pos/t3672.scala create mode 100644 test/files/pos/t3833.scala create mode 100644 test/files/pos/t3837.scala create mode 100644 test/files/pos/t3856.scala (limited to 'test') diff --git a/test/files/pos/3567/Foo.scala b/test/files/pos/3567/Foo.scala new file mode 100644 index 0000000000..4f83ba9f43 --- /dev/null +++ b/test/files/pos/3567/Foo.scala @@ -0,0 +1,3 @@ +class Foo { + val foo = Outer.f() +} diff --git a/test/files/pos/3567/Outer.java b/test/files/pos/3567/Outer.java new file mode 100644 index 0000000000..f1f124b808 --- /dev/null +++ b/test/files/pos/3567/Outer.java @@ -0,0 +1,7 @@ +class Outer { + class Inner { + } + static Outer.Inner f() { + return null; + } +} diff --git a/test/files/pos/t3672.scala b/test/files/pos/t3672.scala new file mode 100644 index 0000000000..b2752ce21f --- /dev/null +++ b/test/files/pos/t3672.scala @@ -0,0 +1,4 @@ +object Test { + def foo(f: Int => Int) = () ; foo { implicit x : Int => x + 1 } + def bar(f: Int => Int) = () ; foo { x : Int => x + 1 } +} diff --git a/test/files/pos/t3833.scala b/test/files/pos/t3833.scala new file mode 100644 index 0000000000..c49e9339ca --- /dev/null +++ b/test/files/pos/t3833.scala @@ -0,0 +1,26 @@ +object Main { + def mkArray[T <: A](atype: Int) :T#AType = { + (atype match { + case 1 => + new Array[Int](10) + // Decompiled code: return (Object[])new int[10]; + case 2 => + new Array[Float](10) + }).asInstanceOf[T#AType] + } + + def main(args: Array[String]) { + println(mkArray[I](1)) + //java.lang.ClassCastException: [I cannot be cast to [Ljava.lang.Object; + } +} + +trait A { + type AType <: AnyRef +} +trait I extends A { + type AType = Array[Int] +} +trait F extends A { + type AType = Array[Float] +} diff --git a/test/files/pos/t3837.scala b/test/files/pos/t3837.scala new file mode 100644 index 0000000000..bcaf63cc8d --- /dev/null +++ b/test/files/pos/t3837.scala @@ -0,0 +1,10 @@ +class BipClass { } +trait BipTrait { + self: BipClass => + + private[this] def foo() = 5 + def bar() = this.foo() +} +// error: value foo is not a member of BipTrait with BipClass +// def bar() = this.foo() +// ^ diff --git a/test/files/pos/t3856.scala b/test/files/pos/t3856.scala new file mode 100644 index 0000000000..71c7bdc99d --- /dev/null +++ b/test/files/pos/t3856.scala @@ -0,0 +1,8 @@ +case class C[T](x: T) + +case class CS(xs: C[_]*) + +object Test { + val x = CS(C(5), C("abc")) match { case CS(C(5), xs @ _*) => xs } + println(x) +} -- cgit v1.2.3