summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
Diffstat (limited to 'test/files')
-rw-r--r--test/files/neg/catch-all.check6
-rw-r--r--test/files/neg/sealed-final-neg.check4
-rw-r--r--test/files/neg/sealed-final-neg.flags1
-rw-r--r--test/files/neg/sealed-final-neg.scala41
-rw-r--r--test/files/pos/sealed-final.flags1
-rw-r--r--test/files/pos/sealed-final.scala14
-rw-r--r--test/files/pos/t1107a.scala (renamed from test/files/pos/t1107.scala)0
-rw-r--r--test/files/pos/t1203a.scala (renamed from test/files/pos/t1203.scala)0
-rw-r--r--test/files/pos/t6072.scala3
-rw-r--r--test/files/run/compiler-asSeenFrom.scala18
-rw-r--r--test/files/run/existentials-in-compiler.scala2
-rw-r--r--test/files/run/search.check6
-rw-r--r--test/files/run/search.scala14
-rw-r--r--test/files/run/t2418.check1
-rw-r--r--test/files/run/t2418.scala10
-rw-r--r--test/files/run/t2886.check10
-rw-r--r--test/files/run/t4023.check21
-rw-r--r--test/files/run/t4023.scala23
-rw-r--r--test/files/run/t6028.check20
-rw-r--r--test/files/run/t6052.scala21
-rw-r--r--test/files/run/t6064.scala9
-rw-r--r--test/files/run/t6154.check1
-rw-r--r--test/files/run/t6154.scala10
23 files changed, 208 insertions, 28 deletions
diff --git a/test/files/neg/catch-all.check b/test/files/neg/catch-all.check
index 62f895cc7e..a9cd0ba927 100644
--- a/test/files/neg/catch-all.check
+++ b/test/files/neg/catch-all.check
@@ -1,10 +1,10 @@
-catch-all.scala:2: error: This catches all Throwables. If this is really intended, use `case _ : Throwable` to clear this warning.
+catch-all.scala:2: error: This catches all Throwables. If this is really intended, use `case _: Throwable` to clear this warning.
try { "warn" } catch { case _ => }
^
-catch-all.scala:4: error: This catches all Throwables. If this is really intended, use `case x : Throwable` to clear this warning.
+catch-all.scala:4: error: This catches all Throwables. If this is really intended, use `case x: Throwable` to clear this warning.
try { "warn" } catch { case x => }
^
-catch-all.scala:6: error: This catches all Throwables. If this is really intended, use `case x : Throwable` to clear this warning.
+catch-all.scala:6: error: This catches all Throwables. If this is really intended, use `case x: Throwable` to clear this warning.
try { "warn" } catch { case _: RuntimeException => ; case x => }
^
three errors found
diff --git a/test/files/neg/sealed-final-neg.check b/test/files/neg/sealed-final-neg.check
new file mode 100644
index 0000000000..500d23f49a
--- /dev/null
+++ b/test/files/neg/sealed-final-neg.check
@@ -0,0 +1,4 @@
+sealed-final-neg.scala:41: error: expected class or object definition
+"Due to SI-6142 this emits no warnings, so we'll just break it until that's fixed."
+^
+one error found
diff --git a/test/files/neg/sealed-final-neg.flags b/test/files/neg/sealed-final-neg.flags
new file mode 100644
index 0000000000..cfabf7a5b4
--- /dev/null
+++ b/test/files/neg/sealed-final-neg.flags
@@ -0,0 +1 @@
+-Xfatal-warnings -Yinline-warnings -optimise \ No newline at end of file
diff --git a/test/files/neg/sealed-final-neg.scala b/test/files/neg/sealed-final-neg.scala
new file mode 100644
index 0000000000..bc25330e13
--- /dev/null
+++ b/test/files/neg/sealed-final-neg.scala
@@ -0,0 +1,41 @@
+package neg1 {
+ sealed abstract class Foo {
+ @inline def bar(x: Int) = x + 1
+ }
+ object Foo {
+ def mkFoo(): Foo = new Baz2
+ }
+
+ object Baz1 extends Foo
+ final class Baz2 extends Foo
+ final class Baz3 extends Foo {
+ override def bar(x: Int) = x - 1
+ }
+
+ object Test {
+ // bar can't be inlined - it is overridden in Baz3
+ def f = Foo.mkFoo() bar 10
+ }
+}
+
+package neg2 {
+ sealed abstract class Foo {
+ @inline def bar(x: Int) = x + 1
+ }
+ object Foo {
+ def mkFoo(): Foo = new Baz2
+ }
+
+ object Baz1 extends Foo
+ final class Baz2 extends Foo
+ class Baz3 extends Foo {
+ override def bar(x: Int) = x - 1
+ }
+
+ object Test {
+ // bar can't be inlined - Baz3 is not final
+ def f = Foo.mkFoo() bar 10
+ }
+}
+
+"Due to SI-6142 this emits no warnings, so we'll just break it until that's fixed."
diff --git a/test/files/pos/sealed-final.flags b/test/files/pos/sealed-final.flags
new file mode 100644
index 0000000000..cfabf7a5b4
--- /dev/null
+++ b/test/files/pos/sealed-final.flags
@@ -0,0 +1 @@
+-Xfatal-warnings -Yinline-warnings -optimise \ No newline at end of file
diff --git a/test/files/pos/sealed-final.scala b/test/files/pos/sealed-final.scala
new file mode 100644
index 0000000000..bdedb5c1f6
--- /dev/null
+++ b/test/files/pos/sealed-final.scala
@@ -0,0 +1,14 @@
+sealed abstract class Foo {
+ @inline def bar(x: Int) = x + 1
+}
+object Foo {
+ def mkFoo(): Foo = new Baz2
+}
+
+object Baz1 extends Foo
+final class Baz2 extends Foo
+
+object Test {
+ // bar should be inlined now
+ def f = Foo.mkFoo() bar 10
+}
diff --git a/test/files/pos/t1107.scala b/test/files/pos/t1107a.scala
index 0bf40bb4cc..0bf40bb4cc 100644
--- a/test/files/pos/t1107.scala
+++ b/test/files/pos/t1107a.scala
diff --git a/test/files/pos/t1203.scala b/test/files/pos/t1203a.scala
index 062ef93fc6..062ef93fc6 100644
--- a/test/files/pos/t1203.scala
+++ b/test/files/pos/t1203a.scala
diff --git a/test/files/pos/t6072.scala b/test/files/pos/t6072.scala
new file mode 100644
index 0000000000..e25ebbffc5
--- /dev/null
+++ b/test/files/pos/t6072.scala
@@ -0,0 +1,3 @@
+class A {
+ object B { def eq(lvl: Int) = ??? }
+}
diff --git a/test/files/run/compiler-asSeenFrom.scala b/test/files/run/compiler-asSeenFrom.scala
index 19feb45101..0d4b504d3c 100644
--- a/test/files/run/compiler-asSeenFrom.scala
+++ b/test/files/run/compiler-asSeenFrom.scala
@@ -47,10 +47,10 @@ package ll {
for (p <- typeRefPrefixes ; c <- classes filter (isPossibleEnclosure(p.typeSymbol, _)) ; a <- targs) yield
typeRef(p, c, List(a))
)
-
+
val wfmt = "%-" + 25 + "s"
def to_s(x: Any): String = wfmt.format(x.toString.replaceAll("""\bll\.""", ""))
-
+
def fmt(args: Any*): String = {
(args map to_s mkString " ").replaceAll("""\s+$""", "")
}
@@ -61,7 +61,7 @@ package ll {
}
def permuteAsSeenFrom(targs: List[Type]) = (
- for {
+ for {
tp <- typeRefs(targs filterNot (_ eq NoType))
prefix <- asSeenPrefixes
if tp.prefix != prefix
@@ -72,11 +72,11 @@ package ll {
}
yield ((site, tp, prefix, seen))
)
-
+
def block(label: Any)(lines: List[String]): List[String] = {
val first = "" + label + " {"
val last = "}"
-
+
first +: lines.map(" " + _) :+ last
}
@@ -84,7 +84,7 @@ package ll {
permuteAsSeenFrom(targs).groupBy(_._1).toList.sortBy(_._1.toString) flatMap {
case (site, xs) =>
block(fmt(site)) {
- fmt("type", "seen from prefix", "is") ::
+ fmt("type", "seen from prefix", "is") ::
fmt("----", "----------------", "--") :: {
xs.groupBy(_._2).toList.sortBy(_._1.toString) flatMap {
case (tp, ys) =>
@@ -95,7 +95,7 @@ package ll {
}
}
}
-
+
def pretty(xs: List[_]) = if (xs.isEmpty) "" else xs.mkString("\n ", "\n ", "\n")
def signaturesIn(info: Type): List[String] = (
@@ -103,11 +103,11 @@ package ll {
filterNot (s => s.isType || s.owner == ObjectClass || s.owner == AnyClass || s.isConstructor)
map (_.defString)
)
-
+
def check(source: String, unit: global.CompilationUnit) = {
import syms._
- afterTyper {
+ exitingTyper {
val typeArgs = List[Type](IntClass.tpe, ListClass[Int]) ++ tparams.map(_.tpe)
permute(typeArgs) foreach println
}
diff --git a/test/files/run/existentials-in-compiler.scala b/test/files/run/existentials-in-compiler.scala
index c69d1217fd..14c25849cb 100644
--- a/test/files/run/existentials-in-compiler.scala
+++ b/test/files/run/existentials-in-compiler.scala
@@ -73,7 +73,7 @@ package extest {
def check(source: String, unit: global.CompilationUnit) = {
getRequiredPackage("extest").moduleClass.info.decls.toList.filter(_.isType).map(_.initialize).sortBy(_.name.toString) foreach { clazz =>
- afterTyper {
+ exitingTyper {
clazz.info
println(clazz.defString)
println(" " + classExistentialType(clazz) + "\n")
diff --git a/test/files/run/search.check b/test/files/run/search.check
new file mode 100644
index 0000000000..a885696509
--- /dev/null
+++ b/test/files/run/search.check
@@ -0,0 +1,6 @@
+Found(2)
+Found(4)
+InsertionPoint(9)
+Found(2)
+Found(4)
+InsertionPoint(9)
diff --git a/test/files/run/search.scala b/test/files/run/search.scala
new file mode 100644
index 0000000000..ed7fed54a7
--- /dev/null
+++ b/test/files/run/search.scala
@@ -0,0 +1,14 @@
+object Test extends App {
+ import scala.collection.{LinearSeq, IndexedSeq}
+ import scala.collection.Searching.search
+
+ val ls = LinearSeq(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13)
+ println(ls.search(3))
+ println(ls.search(5, 3, 8))
+ println(ls.search(12))
+
+ val is = IndexedSeq(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13)
+ println(is.search(3))
+ println(is.search(5, 3, 8))
+ println(is.search(12))
+}
diff --git a/test/files/run/t2418.check b/test/files/run/t2418.check
new file mode 100644
index 0000000000..f599e28b8a
--- /dev/null
+++ b/test/files/run/t2418.check
@@ -0,0 +1 @@
+10
diff --git a/test/files/run/t2418.scala b/test/files/run/t2418.scala
new file mode 100644
index 0000000000..f330bef60a
--- /dev/null
+++ b/test/files/run/t2418.scala
@@ -0,0 +1,10 @@
+class Foo {
+ @volatile final var x=10
+ override def toString = "" + x
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ println((new Foo))
+ }
+}
diff --git a/test/files/run/t2886.check b/test/files/run/t2886.check
index 8d97a82799..b093815562 100644
--- a/test/files/run/t2886.check
+++ b/test/files/run/t2886.check
@@ -1,5 +1,5 @@
-((x: String) => {
- val x$1 = x;
- val x$2 = x;
- Test.this.test(x$2, x$1)
-})
+((x: String) => {
+ <hidden> val x$1 = x;
+ <hidden> val x$2 = x;
+ Test.this.test(x$2, x$1)
+})
diff --git a/test/files/run/t4023.check b/test/files/run/t4023.check
new file mode 100644
index 0000000000..05f867c397
--- /dev/null
+++ b/test/files/run/t4023.check
@@ -0,0 +1,21 @@
+Try 1: (6 classes)
+class Test$C$B1
+class Test$C$B2
+class Test$C$B3$
+class Test$C$B4$
+class Test$C$B5$
+class Test$C$B6$
+Try 2: (6 classes)
+class Test$C$B1
+class Test$C$B2
+class Test$C$B3$
+class Test$C$B4$
+class Test$C$B5$
+class Test$C$B6$
+Try 3: (6 classes)
+class Test$C$B1
+class Test$C$B2
+class Test$C$B3$
+class Test$C$B4$
+class Test$C$B5$
+class Test$C$B6$
diff --git a/test/files/run/t4023.scala b/test/files/run/t4023.scala
new file mode 100644
index 0000000000..4846fa31b4
--- /dev/null
+++ b/test/files/run/t4023.scala
@@ -0,0 +1,23 @@
+object Test {
+ object C {
+ class B1
+ private class B2
+ object B3
+ private object B4
+ object B5 extends B1
+ private object B6 extends B2
+
+ val valuesTry1 = this.getClass.getDeclaredClasses
+ val valuesTry2 = C.getClass.getDeclaredClasses
+ val valuesTry3 = getClass.getDeclaredClasses
+ }
+
+ def main(args: Array[String]) {
+ println("Try 1: (" + C.valuesTry1.length + " classes)")
+ C.valuesTry1.foreach(println)
+ println("Try 2: (" + C.valuesTry2.length + " classes)")
+ C.valuesTry2.foreach(println)
+ println("Try 3: (" + C.valuesTry3.length + " classes)")
+ C.valuesTry3.foreach(println)
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t6028.check b/test/files/run/t6028.check
index 34f4b22134..c10bd76500 100644
--- a/test/files/run/t6028.check
+++ b/test/files/run/t6028.check
@@ -31,14 +31,14 @@ package <empty> {
};
final def apply(): Int = $anonfun$foo$1.this.apply$mcI$sp();
<specialized> def apply$mcI$sp(): Int = $anonfun$foo$1.this.$outer.T$$classParam.+($anonfun$foo$1.this.$outer.field()).+($anonfun$foo$1.this.methodParam$1).+($anonfun$foo$1.this.methodLocal$1);
- <synthetic> <paramaccessor> private[this] val $outer: T = _;
- <synthetic> <stable> def T$$anonfun$$$outer(): T = $anonfun$foo$1.this.$outer;
- final <bridge> def apply(): Object = scala.Int.box($anonfun$foo$1.this.apply());
+ <synthetic> <paramaccessor> <hidden> private[this] val $outer: T = _;
+ <synthetic> <stable> <hidden> def T$$anonfun$$$outer(): T = $anonfun$foo$1.this.$outer;
+ final <bridge> <hidden> def apply(): Object = scala.Int.box($anonfun$foo$1.this.apply());
<synthetic> <paramaccessor> private[this] val methodParam$1: Int = _;
<synthetic> <paramaccessor> private[this] val methodLocal$1: Int = _
};
abstract trait MethodLocalTrait$1 extends Object {
- <synthetic> <stable> def T$MethodLocalTrait$$$outer(): T
+ <synthetic> <stable> <hidden> def T$MethodLocalTrait$$$outer(): T
};
object MethodLocalObject$2 extends Object with T#MethodLocalTrait$1 {
def <init>($outer: T, barParam$1: Int): T#MethodLocalObject$2.type = {
@@ -46,9 +46,9 @@ package <empty> {
MethodLocalObject$2.this.$asInstanceOf[T#MethodLocalTrait$1$class]()./*MethodLocalTrait$1$class*/$init$(barParam$1);
()
};
- <synthetic> <paramaccessor> private[this] val $outer: T = _;
- <synthetic> <stable> def T$MethodLocalObject$$$outer(): T = MethodLocalObject$2.this.$outer;
- <synthetic> <stable> def T$MethodLocalTrait$$$outer(): T = MethodLocalObject$2.this.$outer
+ <synthetic> <paramaccessor> <hidden> private[this] val $outer: T = _;
+ <synthetic> <stable> <hidden> def T$MethodLocalObject$$$outer(): T = MethodLocalObject$2.this.$outer;
+ <synthetic> <stable> <hidden> def T$MethodLocalTrait$$$outer(): T = MethodLocalObject$2.this.$outer
};
final <stable> private[this] def MethodLocalObject$1(barParam$1: Int, MethodLocalObject$module$1: runtime.VolatileObjectRef): T#MethodLocalObject$2.type = {
MethodLocalObject$module$1.elem = new T#MethodLocalObject$2.type(T.this, barParam$1);
@@ -69,9 +69,9 @@ package <empty> {
<specialized> def apply$mcV$sp(): Unit = try {
$anonfun$tryy$1.this.tryyLocal$1.elem = $anonfun$tryy$1.this.tryyParam$1
} finally ();
- <synthetic> <paramaccessor> private[this] val $outer: T = _;
- <synthetic> <stable> def T$$anonfun$$$outer(): T = $anonfun$tryy$1.this.$outer;
- final <bridge> def apply(): Object = {
+ <synthetic> <paramaccessor> <hidden> private[this] val $outer: T = _;
+ <synthetic> <stable> <hidden> def T$$anonfun$$$outer(): T = $anonfun$tryy$1.this.$outer;
+ final <bridge> <hidden> def apply(): Object = {
$anonfun$tryy$1.this.apply();
scala.runtime.BoxedUnit.UNIT
};
diff --git a/test/files/run/t6052.scala b/test/files/run/t6052.scala
new file mode 100644
index 0000000000..385d5390d3
--- /dev/null
+++ b/test/files/run/t6052.scala
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+object Test extends App {
+ def seqarr(i: Int) = Array[Int]() ++ (0 until i)
+ def pararr(i: Int) = seqarr(i).par
+
+ def check[T](i: Int, f: Int => T) {
+ val gseq = seqarr(i).toSeq.groupBy(f)
+ val gpar = pararr(i).groupBy(f)
+ assert(gseq == gpar, (gseq, gpar))
+ }
+
+ for (i <- 0 until 20) check(i, _ > 0)
+ for (i <- 0 until 20) check(i, _ % 2)
+ for (i <- 0 until 20) check(i, _ % 4)
+}
diff --git a/test/files/run/t6064.scala b/test/files/run/t6064.scala
new file mode 100644
index 0000000000..fc184dd92d
--- /dev/null
+++ b/test/files/run/t6064.scala
@@ -0,0 +1,9 @@
+object Test extends App {
+ assert(Option(42) contains 42)
+ assert(Some(42) contains 42)
+ assert(Option(BigInt(42)) contains 42)
+ assert(Option(42) contains BigInt(42))
+ assert(!(None contains 42))
+ assert(Some(null) contains null)
+ assert(!(Option(null) contains null))
+} \ No newline at end of file
diff --git a/test/files/run/t6154.check b/test/files/run/t6154.check
new file mode 100644
index 0000000000..9766475a41
--- /dev/null
+++ b/test/files/run/t6154.check
@@ -0,0 +1 @@
+ok
diff --git a/test/files/run/t6154.scala b/test/files/run/t6154.scala
new file mode 100644
index 0000000000..02ef62905f
--- /dev/null
+++ b/test/files/run/t6154.scala
@@ -0,0 +1,10 @@
+object Test {
+ def foo(a: Int) {
+ var bar: Int = 0
+ bar = try { 0 } catch { case ex: Throwable => 0 }
+ new { foo(bar) }
+ }
+
+ def main(args: Array[String]): Unit =
+ try foo(0) catch { case _: java.lang.StackOverflowError => println("ok") }
+}