diff options
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/SD-290.scala | 39 | ||||
-rw-r--r-- | test/files/run/elidable.flags | 2 | ||||
-rw-r--r-- | test/files/run/elidable.scala | 21 | ||||
-rw-r--r-- | test/files/run/eta-expand-star2.check | 2 | ||||
-rw-r--r-- | test/files/run/eta-expand-star2.flags | 1 | ||||
-rw-r--r-- | test/files/run/eta-expand-star2.scala | 8 | ||||
-rw-r--r-- | test/files/run/t10067.flags | 1 | ||||
-rw-r--r-- | test/files/run/t10067/OuterClass.java | 7 | ||||
-rw-r--r-- | test/files/run/t10067/Test.scala | 19 | ||||
-rw-r--r-- | test/files/run/t10069.scala | 34 | ||||
-rw-r--r-- | test/files/run/t10069b.scala | 13 | ||||
-rw-r--r-- | test/files/run/t7899-regression.check | 1 | ||||
-rw-r--r-- | test/files/run/t7899-regression.flags | 1 | ||||
-rw-r--r-- | test/files/run/t7899-regression.scala | 24 |
14 files changed, 135 insertions, 38 deletions
diff --git a/test/files/run/SD-290.scala b/test/files/run/SD-290.scala new file mode 100644 index 0000000000..0af9cb7cfa --- /dev/null +++ b/test/files/run/SD-290.scala @@ -0,0 +1,39 @@ +object p1 { + class B + object B + + class C extends java.io.Serializable + object C + + type D = DD + object D +} +package object p2 { + class B + object B + + class C extends java.io.Serializable + object C + + type D = DD + object D + +} +class DD extends java.io.Serializable + +object Test { + def main(args: Array[String]): Unit = { + + // This is the behaviour that was intended and was unchanged by this commmit. + assert(!(p1.B : Object).isInstanceOf[scala.Serializable]) + assert(p1.C.isInstanceOf[scala.Serializable]) + assert(!(p1.D: Object).isInstanceOf[scala.Serializable]) + + assert(!(p2.B : Object).isInstanceOf[scala.Serializable]) + assert(p2.C.isInstanceOf[scala.Serializable]) + + // this behaviour was different in 2.12.1 and earlier due to a bug + // in companionSymbolOf + assert(!(p2.D: Object).isInstanceOf[scala.Serializable]) + } +} diff --git a/test/files/run/elidable.flags b/test/files/run/elidable.flags index 93fd3d5317..4bebebdc41 100644 --- a/test/files/run/elidable.flags +++ b/test/files/run/elidable.flags @@ -1 +1 @@ --Xelide-below 900 +-Xelide-below WARNING diff --git a/test/files/run/elidable.scala b/test/files/run/elidable.scala index 6a603084b7..02785972bb 100644 --- a/test/files/run/elidable.scala +++ b/test/files/run/elidable.scala @@ -1,6 +1,8 @@ import annotation._ import elidable._ +// runs -Xelide-below WARNING or 900 + trait T { @elidable(FINEST) def f1() @elidable(SEVERE) def f2() @@ -38,6 +40,13 @@ object Test { @elidable(FINEST) def fd() = 1.0 @elidable(FINEST) def fe() = "s" + /* variable elisions? see test/files/neg/t10068.scala + @elidable(INFO) val goner1: Int = { assert(false, "Should have been elided.") ; 42 } + @elidable(INFO) lazy val goner2: Int = { assert(false, "Should have been elided.") ; 42 } + @elidable(INFO) var goner3: Int = { assert(false, "Should have been elided.") ; 42 } + @elidable(INFO) var goner4: Nothing = _ + */ + def main(args: Array[String]): Unit = { f1() f2() @@ -80,5 +89,17 @@ object Test { Class.forName(className).getMethod(methodName) } } + + // variable elisions? + /* + assert(goner1 == 0) + assert(goner2 == 0) + assert(goner3 == 0) + try assert(goner4 == null) + catch { + case _: NullPointerException => println("NPE") + case _: NotImplementedError => println("NIE") + } + */ } } diff --git a/test/files/run/eta-expand-star2.check b/test/files/run/eta-expand-star2.check deleted file mode 100644 index d6929e4969..0000000000 --- a/test/files/run/eta-expand-star2.check +++ /dev/null @@ -1,2 +0,0 @@ -warning: there was one deprecation warning; re-run with -deprecation for details -hello diff --git a/test/files/run/eta-expand-star2.flags b/test/files/run/eta-expand-star2.flags deleted file mode 100644 index 0402fe55a4..0000000000 --- a/test/files/run/eta-expand-star2.flags +++ /dev/null @@ -1 +0,0 @@ --Yeta-expand-keeps-star
\ No newline at end of file diff --git a/test/files/run/eta-expand-star2.scala b/test/files/run/eta-expand-star2.scala deleted file mode 100644 index eb650788d0..0000000000 --- a/test/files/run/eta-expand-star2.scala +++ /dev/null @@ -1,8 +0,0 @@ -object Test { - def f[T](xs: T*): T = xs.head - def g[T] = f[T] _ - - def main(args: Array[String]): Unit = { - println(g("hello")) - } -} diff --git a/test/files/run/t10067.flags b/test/files/run/t10067.flags new file mode 100644 index 0000000000..c02e5f2461 --- /dev/null +++ b/test/files/run/t10067.flags @@ -0,0 +1 @@ +-unchecked diff --git a/test/files/run/t10067/OuterClass.java b/test/files/run/t10067/OuterClass.java new file mode 100644 index 0000000000..15c2c990d7 --- /dev/null +++ b/test/files/run/t10067/OuterClass.java @@ -0,0 +1,7 @@ +public class OuterClass { + public class InnerClass { } + + public Object getInnerClassInstance() { + return new InnerClass(); + } +} diff --git a/test/files/run/t10067/Test.scala b/test/files/run/t10067/Test.scala new file mode 100644 index 0000000000..af1e12592e --- /dev/null +++ b/test/files/run/t10067/Test.scala @@ -0,0 +1,19 @@ +object Test { + def main(args: Array[String]): Unit = { + //get inner class as some instance of super type + var oc = new OuterClass(); + var icObj = oc.getInnerClassInstance(); + + //get a stable identifier on outer class + val ocStable = oc; + + //these will work + icObj.isInstanceOf[ocStable.InnerClass]; + icObj.asInstanceOf[ocStable.InnerClass]; + + //this will fail with java.lang.NoSuchMethodError + icObj match { + case ic: ocStable.InnerClass => ; + } + } +} diff --git a/test/files/run/t10069.scala b/test/files/run/t10069.scala new file mode 100644 index 0000000000..4e70b7e814 --- /dev/null +++ b/test/files/run/t10069.scala @@ -0,0 +1,34 @@ +object Expected extends Exception +object Test { + def throwExpected: Nothing = throw Expected + def foo0(a: Array[Double]) = { // does compile for Int instead of Double + val v = 42 + a(0) = throwExpected // was crash in code gen: java.lang.NegativeArraySizeException + } + + def foo1(a: Array[Double]) = { // does compile for Int instead of Double + a(0) = throwExpected // was VerifyError at runtime + } + + def foo2(a: Array[Int]) = { // does compile for Int instead of Double + a(0) = throwExpected // was VerifyError at runtime + } + + def foo3(a: Array[String]) = { // does compile for Int instead of Double + a(0) = throwExpected // was already working + } + + + def main(args: Array[String]): Unit = { + check(foo0(new Array[Double](1))) + check(foo1(new Array[Double](1))) + check(foo2(new Array[Int](1))) + check(foo3(new Array[String](1))) + } + def check(f: => Any) { + try {f ; sys.error("no exception thrown") + } catch { + case Expected => + } + } +} diff --git a/test/files/run/t10069b.scala b/test/files/run/t10069b.scala new file mode 100644 index 0000000000..c9d652bb0c --- /dev/null +++ b/test/files/run/t10069b.scala @@ -0,0 +1,13 @@ +object Test { + def main(args: Array[String]): Unit = { + try { + Int.box(???) // crashed the compiler: java.util.NoSuchElementException: key not found: Lscala/runtime/Nothing$; + sys.error("no exception") + } catch { + case _: NotImplementedError => + // oka + case e: Throwable => + sys.error("wrong exception: " + e) + } + } +} diff --git a/test/files/run/t7899-regression.check b/test/files/run/t7899-regression.check deleted file mode 100644 index 602b03a1d1..0000000000 --- a/test/files/run/t7899-regression.check +++ /dev/null @@ -1 +0,0 @@ -warning: -Yinfer-by-name is deprecated: This flag is scheduled for removal in 2.12. If you have a case where you need this flag then please report a bug. diff --git a/test/files/run/t7899-regression.flags b/test/files/run/t7899-regression.flags deleted file mode 100644 index 553a27eafd..0000000000 --- a/test/files/run/t7899-regression.flags +++ /dev/null @@ -1 +0,0 @@ --Yinfer-by-name -deprecation diff --git a/test/files/run/t7899-regression.scala b/test/files/run/t7899-regression.scala deleted file mode 100644 index 67d38cdd1d..0000000000 --- a/test/files/run/t7899-regression.scala +++ /dev/null @@ -1,24 +0,0 @@ -import language.higherKinds - -object Test { - trait Monad[M[_]] { - def foo[A](ma: M[A])(f: M[A] => Any) = f(ma) - } - implicit def function1Covariant[T]: Monad[({type l[a] = (T => a)})#l] = - new Monad[({type l[a] = (T => a)})#l] {} - - def main(args: Array[String]) { - // inference of T = (=> Any) here was outlawed by SI-7899 / 8ed7099 - // but this pattern is used in Scalaz in just a few places and caused - // a regression. - // - // Inference of a by-name type doesn't *always* lead to a ClassCastException, - // it only gets there if a method in generic code accepts a parameter of - // that type. - // - // We need to introduce the stricter inference rules gradually, probably - // with a warning. - val m = implicitly[Monad[({type f[+x] = (=> Any) => x})#f]] - assert(m.foo[Int]((x => 0))(f => f(???)) == 0) - } -} |