summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2015-01-29 09:59:54 +1000
committerJason Zaugg <jzaugg@gmail.com>2015-01-29 09:59:54 +1000
commit1db62995b52b06f5037331172b3f54739d720d62 (patch)
tree0b684c4adfcb800fa195947b37fdb5dc89731552 /test
parent8b5f2b435b4b14089806406c8923f7e845d10ef6 (diff)
parenteb15950e697eb77e52733f81c65e2d51951ad881 (diff)
downloadscala-1db62995b52b06f5037331172b3f54739d720d62.tar.gz
scala-1db62995b52b06f5037331172b3f54739d720d62.tar.bz2
scala-1db62995b52b06f5037331172b3f54739d720d62.zip
Merge commit 'eb15950' into merge/2.11.x-to-2.12.x-20150129
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/patmatexhaust.check2
-rw-r--r--test/files/neg/patmatexhaust.flags2
-rw-r--r--test/files/neg/patmatexhaust.scala2
-rw-r--r--test/files/neg/t3240.check4
-rw-r--r--test/files/neg/t6902.scala2
-rw-r--r--test/files/neg/t8217-local-alias-requires-rhs.check10
-rw-r--r--test/files/neg/t8217-local-alias-requires-rhs.scala15
-rw-r--r--test/files/neg/t8291.check7
-rw-r--r--test/files/neg/t8291.scala7
-rw-r--r--test/files/neg/t8430.check12
-rw-r--r--test/files/neg/t8430.flags2
-rw-r--r--test/files/neg/t845.check4
-rw-r--r--test/files/neg/t8731.check9
-rw-r--r--test/files/neg/t8731.flags1
-rw-r--r--test/files/neg/t8731.scala15
-rw-r--r--test/files/neg/t8869.check7
-rw-r--r--test/files/neg/t8869.scala10
-rw-r--r--test/files/neg/t8890.check4
-rw-r--r--test/files/neg/t8890.scala11
-rw-r--r--test/files/pos/switch-small.flags1
-rw-r--r--test/files/pos/switch-small.scala8
-rw-r--r--test/files/pos/t3240.scala (renamed from test/files/neg/t3240.scala)0
-rw-r--r--test/files/pos/t8267.scala33
-rw-r--r--test/files/pos/t845.scala (renamed from test/files/neg/t845.scala)0
-rw-r--r--test/files/pos/t8868a/Sub_2.scala1
-rw-r--r--test/files/pos/t8868a/T_1.scala6
-rw-r--r--test/files/pos/t8868b/Sub_2.scala2
-rw-r--r--test/files/pos/t8868b/T_1.scala4
-rw-r--r--test/files/pos/t8868c/Sub_2.scala2
-rw-r--r--test/files/pos/t8868c/T_1.scala9
-rw-r--r--test/files/pos/t8894.scala12
-rw-r--r--test/files/presentation/doc.check (renamed from test/disabled/presentation/doc.check)0
-rwxr-xr-xtest/files/presentation/doc/doc.scala (renamed from test/disabled/presentation/doc/doc.scala)0
-rwxr-xr-xtest/files/presentation/doc/src/Class.scala (renamed from test/disabled/presentation/doc/src/Class.scala)0
-rwxr-xr-xtest/files/presentation/doc/src/p/Base.scala (renamed from test/disabled/presentation/doc/src/p/Base.scala)0
-rwxr-xr-xtest/files/presentation/doc/src/p/Derived.scala (renamed from test/disabled/presentation/doc/src/p/Derived.scala)0
-rw-r--r--test/files/run/t4594-repl-settings.scala2
-rw-r--r--test/files/run/t4788-separate-compilation.check5
-rw-r--r--test/files/run/t4788-separate-compilation/CAnnotation_1.java5
-rw-r--r--test/files/run/t4788-separate-compilation/C_1.scala2
-rw-r--r--test/files/run/t4788-separate-compilation/D_1.scala5
-rw-r--r--test/files/run/t4788-separate-compilation/RAnnotation_1.java5
-rw-r--r--test/files/run/t4788-separate-compilation/R_1.scala2
-rw-r--r--test/files/run/t4788-separate-compilation/SAnnotation_1.java5
-rw-r--r--test/files/run/t4788-separate-compilation/S_1.scala2
-rw-r--r--test/files/run/t4788-separate-compilation/Test_2.scala35
-rw-r--r--test/files/run/t4788.check5
-rw-r--r--test/files/run/t4788/C.scala2
-rw-r--r--test/files/run/t4788/CAnnotation.java5
-rw-r--r--test/files/run/t4788/D.scala5
-rw-r--r--test/files/run/t4788/R.scala2
-rw-r--r--test/files/run/t4788/RAnnotation.java5
-rw-r--r--test/files/run/t4788/S.scala2
-rw-r--r--test/files/run/t4788/SAnnotation.java5
-rw-r--r--test/files/run/t4788/Test.scala35
-rw-r--r--test/files/run/t5830.check1
-rw-r--r--test/files/run/t5830.scala13
-rw-r--r--test/files/run/t6011c.scala2
-rw-r--r--test/files/run/t6622.check10
-rw-r--r--test/files/run/t6622.scala50
-rw-r--r--test/files/run/t8087.scala12
-rw-r--r--test/files/run/t8445.check1
-rw-r--r--test/files/run/t8445.scala11
-rw-r--r--test/files/run/t8843-repl-xlat.scala33
-rw-r--r--test/files/run/t8845.flags1
-rw-r--r--test/files/run/t8845.scala17
-rw-r--r--test/files/run/t8888.flags1
-rw-r--r--test/files/run/t8888.scala12
-rw-r--r--test/files/run/t8907.scala39
-rw-r--r--test/files/run/virtpatmat_nested_lists.flags1
-rw-r--r--test/files/run/virtpatmat_opt_sharing.flags1
-rw-r--r--test/junit/scala/collection/immutable/PagedSeqTest.scala (renamed from test/junit/scala/collection/PagedSeq.scala)0
-rw-r--r--test/junit/scala/collection/immutable/QueueTest.scala (renamed from test/junit/scala/collection/QueueTest.scala)0
-rw-r--r--test/junit/scala/collection/immutable/RangeConsistencyTest.scala (renamed from test/junit/scala/collection/NumericRangeTest.scala)0
-rw-r--r--test/junit/scala/collection/immutable/StreamTest.scala (renamed from test/junit/scala/collection/StreamTest.scala)0
-rw-r--r--test/junit/scala/collection/mutable/ArraySortingTest.scala (renamed from test/junit/scala/collection/ArraySortingTest.scala)0
-rw-r--r--test/junit/scala/collection/mutable/PriorityQueueTest.scala (renamed from test/junit/scala/collection/PriorityQueueTest.scala)0
-rw-r--r--test/junit/scala/collection/mutable/VectorTest.scala (renamed from test/junit/scala/collection/VectorTest.scala)0
-rw-r--r--test/junit/scala/issues/BytecodeTests.scala39
-rw-r--r--test/junit/scala/math/NumericTest.scala2
-rw-r--r--test/junit/scala/reflect/internal/PrintersTest.scala6
-rw-r--r--test/junit/scala/reflect/internal/ScopeTest.scala2
-rw-r--r--test/junit/scala/reflect/internal/util/AbstractFileClassLoaderTest.scala138
-rw-r--r--test/junit/scala/tools/nsc/SampleTest.scala1
-rw-r--r--test/junit/scala/tools/nsc/backend/jvm/CodeGenTools.scala3
-rw-r--r--test/junit/scala/util/SpecVersionTest.scala (renamed from test/junit/scala/util/t7265.scala)4
-rw-r--r--test/junit/scala/util/matching/CharRegexTest.scala (renamed from test/junit/scala/util/matching/regextract-char.scala)0
87 files changed, 692 insertions, 46 deletions
diff --git a/test/files/neg/patmatexhaust.check b/test/files/neg/patmatexhaust.check
index 2dad608451..bbf5e9b528 100644
--- a/test/files/neg/patmatexhaust.check
+++ b/test/files/neg/patmatexhaust.check
@@ -12,7 +12,7 @@ It would fail on the following inputs: (Kult(_), Kult(_)), (Qult(), Qult())
^
patmatexhaust.scala:49: warning: match may not be exhaustive.
It would fail on the following inputs: Gp(), Gu
- def ma4(x:Deep) = x match { // missing cases: Gu, Gp
+ def ma4(x:Deep) = x match { // missing cases: Gu, Gp which is not abstract so must be included
^
patmatexhaust.scala:55: warning: unreachable code
case _ if 1 == 0 =>
diff --git a/test/files/neg/patmatexhaust.flags b/test/files/neg/patmatexhaust.flags
index 85d8eb2ba2..3b01ca062c 100644
--- a/test/files/neg/patmatexhaust.flags
+++ b/test/files/neg/patmatexhaust.flags
@@ -1 +1 @@
--Xfatal-warnings
+-Xfatal-warnings -Ypatmat-exhaust-depth off \ No newline at end of file
diff --git a/test/files/neg/patmatexhaust.scala b/test/files/neg/patmatexhaust.scala
index f937197829..26f0c12a91 100644
--- a/test/files/neg/patmatexhaust.scala
+++ b/test/files/neg/patmatexhaust.scala
@@ -46,7 +46,7 @@ class TestSealedExhaustive { // compile only
case _ =>
}
- def ma4(x:Deep) = x match { // missing cases: Gu, Gp
+ def ma4(x:Deep) = x match { // missing cases: Gu, Gp which is not abstract so must be included
case Ga =>
}
diff --git a/test/files/neg/t3240.check b/test/files/neg/t3240.check
deleted file mode 100644
index efae682c66..0000000000
--- a/test/files/neg/t3240.check
+++ /dev/null
@@ -1,4 +0,0 @@
-t3240.scala:3: error: only classes can have declared but undefined members
- type t
- ^
-one error found
diff --git a/test/files/neg/t6902.scala b/test/files/neg/t6902.scala
index ce5ff8b6fb..627c324279 100644
--- a/test/files/neg/t6902.scala
+++ b/test/files/neg/t6902.scala
@@ -16,7 +16,7 @@ object Test {
// at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:50)
// at scala.tools.nsc.Global.abort(Global.scala:249)
// at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder$jcode$.emitSWITCH(GenASM.scala:1850)
- ((1: Byte): @unchecked @annotation.switch) match {
+ ((1: Byte): @unchecked) match {
case 1 => 2
case 1 => 3 // crash
}
diff --git a/test/files/neg/t8217-local-alias-requires-rhs.check b/test/files/neg/t8217-local-alias-requires-rhs.check
new file mode 100644
index 0000000000..0d4f0864ba
--- /dev/null
+++ b/test/files/neg/t8217-local-alias-requires-rhs.check
@@ -0,0 +1,10 @@
+t8217-local-alias-requires-rhs.scala:6: error: only classes can have declared but undefined members
+ type B
+ ^
+t8217-local-alias-requires-rhs.scala:3: error: only classes can have declared but undefined members
+ type A
+ ^
+t8217-local-alias-requires-rhs.scala:14: error: only classes can have declared but undefined members
+ def this(a: Any) = { this(); type C }
+ ^
+three errors found
diff --git a/test/files/neg/t8217-local-alias-requires-rhs.scala b/test/files/neg/t8217-local-alias-requires-rhs.scala
new file mode 100644
index 0000000000..12b7976835
--- /dev/null
+++ b/test/files/neg/t8217-local-alias-requires-rhs.scala
@@ -0,0 +1,15 @@
+trait Alias {
+ def foo = {
+ type A
+ }
+ val bar = {
+ type B
+ object O {
+ type OK
+ }
+ }
+}
+
+class C {
+ def this(a: Any) = { this(); type C }
+}
diff --git a/test/files/neg/t8291.check b/test/files/neg/t8291.check
new file mode 100644
index 0000000000..c9972e5575
--- /dev/null
+++ b/test/files/neg/t8291.check
@@ -0,0 +1,7 @@
+t8291.scala:5: error: Could not find implicit for Int or String
+ implicitly[X[Int, String]]
+ ^
+t8291.scala:6: error: Could not find implicit for Int or String
+ implicitly[Z[String]]
+ ^
+two errors found
diff --git a/test/files/neg/t8291.scala b/test/files/neg/t8291.scala
new file mode 100644
index 0000000000..b344586a56
--- /dev/null
+++ b/test/files/neg/t8291.scala
@@ -0,0 +1,7 @@
+@scala.annotation.implicitNotFound("Could not find implicit for ${T} or ${U}") trait X[T, U]
+
+object Test {
+ type Z[U] = X[Int, U]
+ implicitly[X[Int, String]]
+ implicitly[Z[String]]
+}
diff --git a/test/files/neg/t8430.check b/test/files/neg/t8430.check
index 7c6a73ce53..dbc0c70bba 100644
--- a/test/files/neg/t8430.check
+++ b/test/files/neg/t8430.check
@@ -1,25 +1,25 @@
t8430.scala:15: warning: match may not be exhaustive.
-It would fail on the following inputs: ??, LetC, LetF, LetL(IntLit), LetP
+It would fail on the following inputs: LetC, LetF, LetL(BooleanLit), LetL(IntLit), LetL(UnitLit), LetP
(tree: Tree) => tree match {case LetL(CharLit) => ??? }
^
t8430.scala:16: warning: match may not be exhaustive.
-It would fail on the following inputs: ??, LetC, LetF, LetL(IntLit), LetP
+It would fail on the following inputs: LetC, LetF, LetL(BooleanLit), LetL(IntLit), LetL(UnitLit), LetP
(tree: Tree) => tree match {case LetL(CharLit) => ??? }
^
t8430.scala:17: warning: match may not be exhaustive.
-It would fail on the following inputs: ??, LetC, LetF, LetL(IntLit), LetP
+It would fail on the following inputs: LetC, LetF, LetL(BooleanLit), LetL(IntLit), LetL(UnitLit), LetP
(tree: Tree) => tree match {case LetL(CharLit) => ??? }
^
t8430.scala:18: warning: match may not be exhaustive.
-It would fail on the following inputs: ??, LetC, LetF, LetL(IntLit), LetP
+It would fail on the following inputs: LetC, LetF, LetL(BooleanLit), LetL(IntLit), LetL(UnitLit), LetP
(tree: Tree) => tree match {case LetL(CharLit) => ??? }
^
t8430.scala:19: warning: match may not be exhaustive.
-It would fail on the following inputs: ??, LetC, LetF, LetL(IntLit), LetP
+It would fail on the following inputs: LetC, LetF, LetL(BooleanLit), LetL(IntLit), LetL(UnitLit), LetP
(tree: Tree) => tree match {case LetL(CharLit) => ??? }
^
t8430.scala:20: warning: match may not be exhaustive.
-It would fail on the following inputs: ??, LetC, LetF, LetL(IntLit), LetP
+It would fail on the following inputs: LetC, LetF, LetL(BooleanLit), LetL(IntLit), LetL(UnitLit), LetP
(tree: Tree) => tree match {case LetL(CharLit) => ??? }
^
error: No warnings can be incurred under -Xfatal-warnings.
diff --git a/test/files/neg/t8430.flags b/test/files/neg/t8430.flags
index 85d8eb2ba2..6f60189a8d 100644
--- a/test/files/neg/t8430.flags
+++ b/test/files/neg/t8430.flags
@@ -1 +1 @@
--Xfatal-warnings
+-Xfatal-warnings -Ypatmat-exhaust-depth off
diff --git a/test/files/neg/t845.check b/test/files/neg/t845.check
deleted file mode 100644
index 07ed7e417b..0000000000
--- a/test/files/neg/t845.check
+++ /dev/null
@@ -1,4 +0,0 @@
-t845.scala:4: error: only classes can have declared but undefined members
- type Bar;
- ^
-one error found
diff --git a/test/files/neg/t8731.check b/test/files/neg/t8731.check
new file mode 100644
index 0000000000..2a9af475fc
--- /dev/null
+++ b/test/files/neg/t8731.check
@@ -0,0 +1,9 @@
+t8731.scala:5: warning: matches with two cases or fewer are emitted using if-then-else instead of switch
+ def f(x: Int) = (x: @annotation.switch) match {
+ ^
+t8731.scala:10: warning: could not emit switch for @switch annotated match
+ def g(x: Int) = (x: @annotation.switch) match {
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+two warnings found
+one error found
diff --git a/test/files/neg/t8731.flags b/test/files/neg/t8731.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/neg/t8731.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/t8731.scala b/test/files/neg/t8731.scala
new file mode 100644
index 0000000000..d93fe706ad
--- /dev/null
+++ b/test/files/neg/t8731.scala
@@ -0,0 +1,15 @@
+class C {
+ // not a compile-time constant due to return type
+ final val K: Int = 20
+
+ def f(x: Int) = (x: @annotation.switch) match {
+ case K => 0
+ case 2 => 1
+ }
+
+ def g(x: Int) = (x: @annotation.switch) match {
+ case K => 0
+ case 2 => 1
+ case 3 => 2
+ }
+}
diff --git a/test/files/neg/t8869.check b/test/files/neg/t8869.check
new file mode 100644
index 0000000000..40b8570f9f
--- /dev/null
+++ b/test/files/neg/t8869.check
@@ -0,0 +1,7 @@
+t8869.scala:5: error: class Option takes type parameters
+ def value: TC[({type l1[x] = Option})#l1] = ??? // error not reported!
+ ^
+t8869.scala:7: error: class Option takes type parameters
+ type l2[x] = Option // error correctly reported
+ ^
+two errors found
diff --git a/test/files/neg/t8869.scala b/test/files/neg/t8869.scala
new file mode 100644
index 0000000000..0c7f0c9451
--- /dev/null
+++ b/test/files/neg/t8869.scala
@@ -0,0 +1,10 @@
+class TC[T[_]] {
+ def identity[A](a: T[A]): T[A] = a
+}
+object Test {
+ def value: TC[({type l1[x] = Option})#l1] = ??? // error not reported!
+
+ type l2[x] = Option // error correctly reported
+ def value1: TC[l2] = ???
+}
+
diff --git a/test/files/neg/t8890.check b/test/files/neg/t8890.check
new file mode 100644
index 0000000000..1b69d6cf30
--- /dev/null
+++ b/test/files/neg/t8890.check
@@ -0,0 +1,4 @@
+t8890.scala:6: error: not found: type Str
+ def bar(x: Str): Unit = ???
+ ^
+one error found
diff --git a/test/files/neg/t8890.scala b/test/files/neg/t8890.scala
new file mode 100644
index 0000000000..cbdeb11d43
--- /dev/null
+++ b/test/files/neg/t8890.scala
@@ -0,0 +1,11 @@
+package foo
+
+class A {
+ /** The other */
+ def bar(x: Int): Unit = ???
+ def bar(x: Str): Unit = ???
+}
+
+class B {
+ (new A).bar(0)
+} \ No newline at end of file
diff --git a/test/files/pos/switch-small.flags b/test/files/pos/switch-small.flags
deleted file mode 100644
index 85d8eb2ba2..0000000000
--- a/test/files/pos/switch-small.flags
+++ /dev/null
@@ -1 +0,0 @@
--Xfatal-warnings
diff --git a/test/files/pos/switch-small.scala b/test/files/pos/switch-small.scala
deleted file mode 100644
index 9de9ca028e..0000000000
--- a/test/files/pos/switch-small.scala
+++ /dev/null
@@ -1,8 +0,0 @@
-import annotation._
-
-object Test {
- def f(x: Int) = (x: @switch) match {
- case 1 => 1
- case _ => 2
- }
-}
diff --git a/test/files/neg/t3240.scala b/test/files/pos/t3240.scala
index cf197a406d..cf197a406d 100644
--- a/test/files/neg/t3240.scala
+++ b/test/files/pos/t3240.scala
diff --git a/test/files/pos/t8267.scala b/test/files/pos/t8267.scala
new file mode 100644
index 0000000000..37b498fe3e
--- /dev/null
+++ b/test/files/pos/t8267.scala
@@ -0,0 +1,33 @@
+class Bippy { trait Foo[A] }
+
+final class RichBippy[C <: Bippy with Singleton](val c1: C) {
+ def f: Int = 1
+ def f[A](x: A)(ev: c1.Foo[A]): Int = 2
+
+ def g[A <: Nothing](x: A): Int = 1
+ def g[A](x: A)(ev: c1.Foo[A]): Int = 2
+
+ def h[A](x: A)(ev: c1.Foo[A]): Int = 1
+
+ def i(x: Nothing): Int = 1
+ def i(x: AnyRef)(ev: c1.Foo[x.type]): Int = 2
+}
+
+object p {
+
+ val c = new Bippy
+ val d0 = new RichBippy[c.type](c)
+ def d1 = new RichBippy[c.type](c)
+
+ d0.f[Int](5)(null: c.Foo[Int]) // ok
+ d1.f[Int](5)(null: c.Foo[Int]) // fails
+
+ d0.g[Int](5)(null: c.Foo[Int]) // ok
+ d1.g[Int](5)(null: c.Foo[Int]) // fails
+
+ d0.h[Int](5)(null: c.Foo[Int]) // ok
+ d1.h[Int](5)(null: c.Foo[Int]) // ok
+
+ d0.i("")(null) // ok
+ d1.i("")(null) // ok
+}
diff --git a/test/files/neg/t845.scala b/test/files/pos/t845.scala
index ddf6a16f32..ddf6a16f32 100644
--- a/test/files/neg/t845.scala
+++ b/test/files/pos/t845.scala
diff --git a/test/files/pos/t8868a/Sub_2.scala b/test/files/pos/t8868a/Sub_2.scala
new file mode 100644
index 0000000000..a19b529c88
--- /dev/null
+++ b/test/files/pos/t8868a/Sub_2.scala
@@ -0,0 +1 @@
+class Sub extends T
diff --git a/test/files/pos/t8868a/T_1.scala b/test/files/pos/t8868a/T_1.scala
new file mode 100644
index 0000000000..9fb97b1413
--- /dev/null
+++ b/test/files/pos/t8868a/T_1.scala
@@ -0,0 +1,6 @@
+class C
+
+trait T {
+ @deprecated(since = "", message = "")
+ class X
+}
diff --git a/test/files/pos/t8868b/Sub_2.scala b/test/files/pos/t8868b/Sub_2.scala
new file mode 100644
index 0000000000..58b44db2b3
--- /dev/null
+++ b/test/files/pos/t8868b/Sub_2.scala
@@ -0,0 +1,2 @@
+class Sub extends T
+
diff --git a/test/files/pos/t8868b/T_1.scala b/test/files/pos/t8868b/T_1.scala
new file mode 100644
index 0000000000..0b71cfdaa3
--- /dev/null
+++ b/test/files/pos/t8868b/T_1.scala
@@ -0,0 +1,4 @@
+@deprecated(since = "2.4.0", message = "")
+trait T {
+ class X
+}
diff --git a/test/files/pos/t8868c/Sub_2.scala b/test/files/pos/t8868c/Sub_2.scala
new file mode 100644
index 0000000000..58b44db2b3
--- /dev/null
+++ b/test/files/pos/t8868c/Sub_2.scala
@@ -0,0 +1,2 @@
+class Sub extends T
+
diff --git a/test/files/pos/t8868c/T_1.scala b/test/files/pos/t8868c/T_1.scala
new file mode 100644
index 0000000000..dc541950d8
--- /dev/null
+++ b/test/files/pos/t8868c/T_1.scala
@@ -0,0 +1,9 @@
+class C(a: Any) extends annotation.StaticAnnotation
+
+@C({val x = 0; x})
+trait T {
+ class X
+
+ @C({val x = 0; x})
+ def foo = 42
+}
diff --git a/test/files/pos/t8894.scala b/test/files/pos/t8894.scala
new file mode 100644
index 0000000000..3b26f1ae7e
--- /dev/null
+++ b/test/files/pos/t8894.scala
@@ -0,0 +1,12 @@
+class CC(val i: Int, val s: String)
+object CC extends {
+ type P = (Int, String)
+
+ //def unapply(c: CC): Option[(Int, String)] = Some((c.i, c.s)) // OK
+ def unapply(c: CC): Option[P] = Some((c.i, c.s)) // fails (because of the type alias)
+}
+
+class Test {
+ val cc = new CC(23, "foo")
+ val CC(i, s) = cc
+} \ No newline at end of file
diff --git a/test/disabled/presentation/doc.check b/test/files/presentation/doc.check
index 5a3ff13151..5a3ff13151 100644
--- a/test/disabled/presentation/doc.check
+++ b/test/files/presentation/doc.check
diff --git a/test/disabled/presentation/doc/doc.scala b/test/files/presentation/doc/doc.scala
index f2233f1828..f2233f1828 100755
--- a/test/disabled/presentation/doc/doc.scala
+++ b/test/files/presentation/doc/doc.scala
diff --git a/test/disabled/presentation/doc/src/Class.scala b/test/files/presentation/doc/src/Class.scala
index a974bd6f5c..a974bd6f5c 100755
--- a/test/disabled/presentation/doc/src/Class.scala
+++ b/test/files/presentation/doc/src/Class.scala
diff --git a/test/disabled/presentation/doc/src/p/Base.scala b/test/files/presentation/doc/src/p/Base.scala
index d91632b6f6..d91632b6f6 100755
--- a/test/disabled/presentation/doc/src/p/Base.scala
+++ b/test/files/presentation/doc/src/p/Base.scala
diff --git a/test/disabled/presentation/doc/src/p/Derived.scala b/test/files/presentation/doc/src/p/Derived.scala
index 1a9c9a26d1..1a9c9a26d1 100755
--- a/test/disabled/presentation/doc/src/p/Derived.scala
+++ b/test/files/presentation/doc/src/p/Derived.scala
diff --git a/test/files/run/t4594-repl-settings.scala b/test/files/run/t4594-repl-settings.scala
index 4202991607..db5dc19866 100644
--- a/test/files/run/t4594-repl-settings.scala
+++ b/test/files/run/t4594-repl-settings.scala
@@ -14,7 +14,7 @@ object Test extends SessionTest {
|warning: there was one deprecation warning; re-run with -deprecation for details
|a: String
|
- |scala> :settings +deprecation
+ |scala> :settings -deprecation
|
|scala> def b = depp
|<console>:8: warning: method depp is deprecated: Please don't do that.
diff --git a/test/files/run/t4788-separate-compilation.check b/test/files/run/t4788-separate-compilation.check
new file mode 100644
index 0000000000..172ad90102
--- /dev/null
+++ b/test/files/run/t4788-separate-compilation.check
@@ -0,0 +1,5 @@
+Some(@Ljava/lang/Deprecated;())
+None
+None
+Some(@LCAnnotation;() // invisible)
+Some(@LRAnnotation;())
diff --git a/test/files/run/t4788-separate-compilation/CAnnotation_1.java b/test/files/run/t4788-separate-compilation/CAnnotation_1.java
new file mode 100644
index 0000000000..7120218d62
--- /dev/null
+++ b/test/files/run/t4788-separate-compilation/CAnnotation_1.java
@@ -0,0 +1,5 @@
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.CLASS;
+
+@Retention(value=CLASS)
+@interface CAnnotation {}
diff --git a/test/files/run/t4788-separate-compilation/C_1.scala b/test/files/run/t4788-separate-compilation/C_1.scala
new file mode 100644
index 0000000000..aba9b595e4
--- /dev/null
+++ b/test/files/run/t4788-separate-compilation/C_1.scala
@@ -0,0 +1,2 @@
+@CAnnotation
+class C
diff --git a/test/files/run/t4788-separate-compilation/D_1.scala b/test/files/run/t4788-separate-compilation/D_1.scala
new file mode 100644
index 0000000000..c2479fba86
--- /dev/null
+++ b/test/files/run/t4788-separate-compilation/D_1.scala
@@ -0,0 +1,5 @@
+@Deprecated
+class DJava
+
+@deprecated("", "")
+class DScala
diff --git a/test/files/run/t4788-separate-compilation/RAnnotation_1.java b/test/files/run/t4788-separate-compilation/RAnnotation_1.java
new file mode 100644
index 0000000000..f24cf66f7b
--- /dev/null
+++ b/test/files/run/t4788-separate-compilation/RAnnotation_1.java
@@ -0,0 +1,5 @@
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@Retention(value=RUNTIME)
+@interface RAnnotation {}
diff --git a/test/files/run/t4788-separate-compilation/R_1.scala b/test/files/run/t4788-separate-compilation/R_1.scala
new file mode 100644
index 0000000000..ab0cd065d9
--- /dev/null
+++ b/test/files/run/t4788-separate-compilation/R_1.scala
@@ -0,0 +1,2 @@
+@RAnnotation
+class R
diff --git a/test/files/run/t4788-separate-compilation/SAnnotation_1.java b/test/files/run/t4788-separate-compilation/SAnnotation_1.java
new file mode 100644
index 0000000000..471f27d82a
--- /dev/null
+++ b/test/files/run/t4788-separate-compilation/SAnnotation_1.java
@@ -0,0 +1,5 @@
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.SOURCE;
+
+@Retention(value=SOURCE)
+@interface SAnnotation {}
diff --git a/test/files/run/t4788-separate-compilation/S_1.scala b/test/files/run/t4788-separate-compilation/S_1.scala
new file mode 100644
index 0000000000..f8756d9bc8
--- /dev/null
+++ b/test/files/run/t4788-separate-compilation/S_1.scala
@@ -0,0 +1,2 @@
+@SAnnotation
+class S
diff --git a/test/files/run/t4788-separate-compilation/Test_2.scala b/test/files/run/t4788-separate-compilation/Test_2.scala
new file mode 100644
index 0000000000..cbbb5ff386
--- /dev/null
+++ b/test/files/run/t4788-separate-compilation/Test_2.scala
@@ -0,0 +1,35 @@
+import java.io.PrintWriter;
+
+import scala.tools.partest.BytecodeTest
+import scala.tools.asm.util._
+import scala.tools.nsc.util.stringFromWriter
+
+object Test extends BytecodeTest {
+ def annotationsForClass(className: String): Option[String] = {
+ val classNode = loadClassNode(className, skipDebugInfo = false)
+ val textifier = new Textifier
+ classNode.accept(new TraceClassVisitor(null, textifier, null))
+
+ val classString = stringFromWriter(w => textifier.print(w))
+ classString
+ .split('\n')
+ .filterNot(_.contains("@Lscala/reflect/ScalaSignature"))
+ .find(_.contains("@L"))
+ .map(_.trim)
+ }
+
+ def show {
+ // It seems like @java.lang.Deprecated shows up in both the
+ // Deprecated attribute and RuntimeVisibleAnnotation attribute,
+ // while @scala.deprecated only shows up in the Deprecated attribute.
+ // The check file just documents status quo, not sure if Scala
+ // should brought in line with Java or not...
+ // See the commit message and SI-8883 for more info.
+ println(annotationsForClass("DJava"))
+ println(annotationsForClass("DScala"))
+
+ println(annotationsForClass("S"))
+ println(annotationsForClass("C"))
+ println(annotationsForClass("R"))
+ }
+}
diff --git a/test/files/run/t4788.check b/test/files/run/t4788.check
new file mode 100644
index 0000000000..172ad90102
--- /dev/null
+++ b/test/files/run/t4788.check
@@ -0,0 +1,5 @@
+Some(@Ljava/lang/Deprecated;())
+None
+None
+Some(@LCAnnotation;() // invisible)
+Some(@LRAnnotation;())
diff --git a/test/files/run/t4788/C.scala b/test/files/run/t4788/C.scala
new file mode 100644
index 0000000000..aba9b595e4
--- /dev/null
+++ b/test/files/run/t4788/C.scala
@@ -0,0 +1,2 @@
+@CAnnotation
+class C
diff --git a/test/files/run/t4788/CAnnotation.java b/test/files/run/t4788/CAnnotation.java
new file mode 100644
index 0000000000..7120218d62
--- /dev/null
+++ b/test/files/run/t4788/CAnnotation.java
@@ -0,0 +1,5 @@
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.CLASS;
+
+@Retention(value=CLASS)
+@interface CAnnotation {}
diff --git a/test/files/run/t4788/D.scala b/test/files/run/t4788/D.scala
new file mode 100644
index 0000000000..c2479fba86
--- /dev/null
+++ b/test/files/run/t4788/D.scala
@@ -0,0 +1,5 @@
+@Deprecated
+class DJava
+
+@deprecated("", "")
+class DScala
diff --git a/test/files/run/t4788/R.scala b/test/files/run/t4788/R.scala
new file mode 100644
index 0000000000..ab0cd065d9
--- /dev/null
+++ b/test/files/run/t4788/R.scala
@@ -0,0 +1,2 @@
+@RAnnotation
+class R
diff --git a/test/files/run/t4788/RAnnotation.java b/test/files/run/t4788/RAnnotation.java
new file mode 100644
index 0000000000..f24cf66f7b
--- /dev/null
+++ b/test/files/run/t4788/RAnnotation.java
@@ -0,0 +1,5 @@
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@Retention(value=RUNTIME)
+@interface RAnnotation {}
diff --git a/test/files/run/t4788/S.scala b/test/files/run/t4788/S.scala
new file mode 100644
index 0000000000..f8756d9bc8
--- /dev/null
+++ b/test/files/run/t4788/S.scala
@@ -0,0 +1,2 @@
+@SAnnotation
+class S
diff --git a/test/files/run/t4788/SAnnotation.java b/test/files/run/t4788/SAnnotation.java
new file mode 100644
index 0000000000..471f27d82a
--- /dev/null
+++ b/test/files/run/t4788/SAnnotation.java
@@ -0,0 +1,5 @@
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.SOURCE;
+
+@Retention(value=SOURCE)
+@interface SAnnotation {}
diff --git a/test/files/run/t4788/Test.scala b/test/files/run/t4788/Test.scala
new file mode 100644
index 0000000000..cbbb5ff386
--- /dev/null
+++ b/test/files/run/t4788/Test.scala
@@ -0,0 +1,35 @@
+import java.io.PrintWriter;
+
+import scala.tools.partest.BytecodeTest
+import scala.tools.asm.util._
+import scala.tools.nsc.util.stringFromWriter
+
+object Test extends BytecodeTest {
+ def annotationsForClass(className: String): Option[String] = {
+ val classNode = loadClassNode(className, skipDebugInfo = false)
+ val textifier = new Textifier
+ classNode.accept(new TraceClassVisitor(null, textifier, null))
+
+ val classString = stringFromWriter(w => textifier.print(w))
+ classString
+ .split('\n')
+ .filterNot(_.contains("@Lscala/reflect/ScalaSignature"))
+ .find(_.contains("@L"))
+ .map(_.trim)
+ }
+
+ def show {
+ // It seems like @java.lang.Deprecated shows up in both the
+ // Deprecated attribute and RuntimeVisibleAnnotation attribute,
+ // while @scala.deprecated only shows up in the Deprecated attribute.
+ // The check file just documents status quo, not sure if Scala
+ // should brought in line with Java or not...
+ // See the commit message and SI-8883 for more info.
+ println(annotationsForClass("DJava"))
+ println(annotationsForClass("DScala"))
+
+ println(annotationsForClass("S"))
+ println(annotationsForClass("C"))
+ println(annotationsForClass("R"))
+ }
+}
diff --git a/test/files/run/t5830.check b/test/files/run/t5830.check
index 675387eb8e..9260854676 100644
--- a/test/files/run/t5830.check
+++ b/test/files/run/t5830.check
@@ -1,5 +1,6 @@
a with oef
a with oef
+a with oef
a
def with oef
def
diff --git a/test/files/run/t5830.scala b/test/files/run/t5830.scala
index 5d808bfa28..03b9c540e0 100644
--- a/test/files/run/t5830.scala
+++ b/test/files/run/t5830.scala
@@ -1,12 +1,11 @@
import scala.annotation.switch
object Test extends App {
- // TODO: should not emit a switch
- // def noSwitch(ch: Char, eof: Boolean) = (ch: @switch) match {
- // case 'a' if eof => println("a with oef") // then branch
- // }
+ def noSwitch(ch: Char, eof: Boolean) = ch match {
+ case 'a' if eof => println("a with oef") // then branch
+ }
- def onlyThen(ch: Char, eof: Boolean) = (ch: @switch) match {
+ def onlyThen(ch: Char, eof: Boolean) = ch match {
case 'a' if eof => println("a with oef") // then branch
case 'c' =>
}
@@ -18,7 +17,7 @@ object Test extends App {
case 'c' =>
}
- def defaultUnguarded(ch: Char, eof: Boolean) = (ch: @switch) match {
+ def defaultUnguarded(ch: Char, eof: Boolean) = ch match {
case ' ' if eof => println("spacey oef")
case _ => println("default")
}
@@ -44,7 +43,7 @@ object Test extends App {
// case 'c' =>
// }
- // noSwitch('a', true)
+ noSwitch('a', true)
onlyThen('a', true) // 'a with oef'
ifThenElse('a', true) // 'a with oef'
ifThenElse('a', false) // 'a'
diff --git a/test/files/run/t6011c.scala b/test/files/run/t6011c.scala
index 0647e3f81a..96a685b9cf 100644
--- a/test/files/run/t6011c.scala
+++ b/test/files/run/t6011c.scala
@@ -6,7 +6,7 @@ object Test extends App {
// at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:50)
// at scala.tools.nsc.Global.abort(Global.scala:249)
// at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder$jcode$.emitSWITCH(GenASM.scala:1850)
- ((1: Byte): @unchecked @annotation.switch) match {
+ ((1: Byte): @unchecked) match {
case 1 => 2
case 1 => 3 // crash
}
diff --git a/test/files/run/t6622.check b/test/files/run/t6622.check
new file mode 100644
index 0000000000..5d006d88e6
--- /dev/null
+++ b/test/files/run/t6622.check
@@ -0,0 +1,10 @@
+ O1.resultVal isMemberClass = false, null
+class A$1
+ O1.resultDef isMemberClass = false, public void O1$.resultDef()
+class A$2
+ C2.resultVal isMemberClass = false, null
+class $B$1
+ O3.resultDef isMemberClass = false, public void O3$.resultDef()
+class C$1
+ O4.resultDefDefault isMemberClass = false, public java.lang.Object O4$.resultDefDefault$default$1()
+class C$2
diff --git a/test/files/run/t6622.scala b/test/files/run/t6622.scala
new file mode 100644
index 0000000000..de8ffa01bf
--- /dev/null
+++ b/test/files/run/t6622.scala
@@ -0,0 +1,50 @@
+import Test.check
+
+object O1 {
+ lazy val resultVal = {
+ class A
+ check("O1.resultVal", classOf[A])
+ }
+
+ def resultDef = {
+ class A
+ check("O1.resultDef", classOf[A])
+ }
+}
+
+class C2 {
+ val resultVal = {
+ val tmp = {
+ class B
+ check("C2.resultVal", classOf[B])
+ }
+ }
+}
+
+object O3 {
+ def resultDef = {
+ class C
+ check("O3.resultDef", classOf[C])
+ }
+}
+
+object O4 {
+ def resultDefDefault(a: Any = {
+ class C
+ check("O4.resultDefDefault", classOf[C])
+ }) = ();
+}
+
+
+object Test extends App {
+ def check(desc: String, clazz: Class[_]) {
+ println(s" $desc isMemberClass = ${clazz.isMemberClass}, ${clazz.getEnclosingMethod}")
+ println(reflect.runtime.currentMirror.classSymbol(clazz))
+ }
+
+ O1.resultVal
+ O1.resultDef
+ new C2().resultVal
+ O3.resultDef
+ O4.resultDefDefault()
+}
diff --git a/test/files/run/t8087.scala b/test/files/run/t8087.scala
new file mode 100644
index 0000000000..6047211756
--- /dev/null
+++ b/test/files/run/t8087.scala
@@ -0,0 +1,12 @@
+trait Foo {
+ @volatile private[this] var x: String = ""
+ @volatile private var y: String = ""
+}
+
+class Bar extends Foo
+
+object Test extends App {
+ classOf[Bar].getDeclaredFields.foreach(f => {
+ assert(java.lang.reflect.Modifier.isVolatile(f.getModifiers), f.getName)
+ })
+}
diff --git a/test/files/run/t8445.check b/test/files/run/t8445.check
new file mode 100644
index 0000000000..41fd6d3ed1
--- /dev/null
+++ b/test/files/run/t8445.check
@@ -0,0 +1 @@
+warning: there was one feature warning; re-run with -feature for details
diff --git a/test/files/run/t8445.scala b/test/files/run/t8445.scala
new file mode 100644
index 0000000000..ed196b62a2
--- /dev/null
+++ b/test/files/run/t8445.scala
@@ -0,0 +1,11 @@
+object X {
+ class Y
+ def y = new Y {
+ class Z
+ def z = classOf[Z]
+ }
+}
+
+object Test extends App {
+ assert(X.y.z.getEnclosingClass.getName == "X$$anon$1")
+}
diff --git a/test/files/run/t8843-repl-xlat.scala b/test/files/run/t8843-repl-xlat.scala
new file mode 100644
index 0000000000..6426dbe7d4
--- /dev/null
+++ b/test/files/run/t8843-repl-xlat.scala
@@ -0,0 +1,33 @@
+
+import scala.tools.partest.SessionTest
+
+// Handy hamburger helper for repl resources
+object Test extends SessionTest {
+ def session =
+"""Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala> $intp.isettings.unwrapStrings = false
+$intp.isettings.unwrapStrings: Boolean = false
+
+scala> class Bippy
+defined class Bippy
+
+scala> $intp.classLoader getResource "Bippy.class"
+res0: java.net.URL = memory:(memory)/$line4/$read$$iw$$iw$Bippy.class
+
+scala> ($intp.classLoader getResources "Bippy.class").nextElement
+res1: java.net.URL = memory:(memory)/$line4/$read$$iw$$iw$Bippy.class
+
+scala> ($intp.classLoader classBytes "Bippy").nonEmpty
+res2: Boolean = true
+
+scala> ($intp.classLoader classAsStream "Bippy") != null
+res3: Boolean = true
+
+scala> $intp.classLoader getResource "Bippy"
+res4: java.net.URL = null
+
+scala> :quit"""
+}
+
diff --git a/test/files/run/t8845.flags b/test/files/run/t8845.flags
new file mode 100644
index 0000000000..aada25f80d
--- /dev/null
+++ b/test/files/run/t8845.flags
@@ -0,0 +1 @@
+-Ybackend:GenBCode -Ynooptimize
diff --git a/test/files/run/t8845.scala b/test/files/run/t8845.scala
new file mode 100644
index 0000000000..8ccdbdadc7
--- /dev/null
+++ b/test/files/run/t8845.scala
@@ -0,0 +1,17 @@
+// crashes compiler under GenASM, works under GenBCode.
+object Interpreter {
+ def mkDataProp(i: Int) = i
+ def break(n: Int): Unit =
+ try {
+ n match {
+ case _ =>
+ val newDesc = mkDataProp(n)
+ n match { case _ => return }
+ }
+ } catch { case e: Throwable => }
+ finally { }
+}
+
+object Test extends App {
+ Interpreter.break(0)
+}
diff --git a/test/files/run/t8888.flags b/test/files/run/t8888.flags
new file mode 100644
index 0000000000..48b438ddf8
--- /dev/null
+++ b/test/files/run/t8888.flags
@@ -0,0 +1 @@
+-Ydelambdafy:method
diff --git a/test/files/run/t8888.scala b/test/files/run/t8888.scala
new file mode 100644
index 0000000000..36cc1ddf3e
--- /dev/null
+++ b/test/files/run/t8888.scala
@@ -0,0 +1,12 @@
+class C {
+ final def resume: Unit = (this: Any) match {
+ case x : C => (x: Any) match {
+ case y : C =>
+ () => (x, y) // used to trigger a ClassFormatError under -Ydelambdafy:method
+ }
+ }
+}
+
+object Test extends App {
+ new C().resume
+}
diff --git a/test/files/run/t8907.scala b/test/files/run/t8907.scala
new file mode 100644
index 0000000000..7952ac82d9
--- /dev/null
+++ b/test/files/run/t8907.scala
@@ -0,0 +1,39 @@
+import scala.tools.partest._
+import java.io.File
+
+object Test extends StoreReporterDirectTest {
+ def code = ???
+
+ def compileCode(code: String) = {
+ val classpath = List(sys.props("partest.lib"), testOutput.path) mkString sys.props("path.separator")
+ compileString(newCompiler("-cp", classpath, "-d", testOutput.path))(code)
+ }
+
+ def show(): Unit = {
+ compileCode("""
+ class C { class Inner }
+
+ class D {
+ object O {
+ def foo(c: C)(i: c.Inner): c.Inner = ???
+ }
+ }
+ """)
+ assert(filteredInfos.isEmpty, filteredInfos)
+ deleteClass("C")
+ compileCode("""
+ class E {
+ def foo = {
+ (null: D).toString
+ }
+ }
+ """)
+ assert(storeReporter.infos.isEmpty, storeReporter.infos.mkString("\n")) // Included a MissingRequirementError before.
+ }
+
+ def deleteClass(name: String) {
+ val classFile = new File(testOutput.path, name + ".class")
+ assert(classFile.exists)
+ assert(classFile.delete())
+ }
+}
diff --git a/test/files/run/virtpatmat_nested_lists.flags b/test/files/run/virtpatmat_nested_lists.flags
new file mode 100644
index 0000000000..ca9a4c0697
--- /dev/null
+++ b/test/files/run/virtpatmat_nested_lists.flags
@@ -0,0 +1 @@
+-Ypatmat-exhaust-depth off \ No newline at end of file
diff --git a/test/files/run/virtpatmat_opt_sharing.flags b/test/files/run/virtpatmat_opt_sharing.flags
new file mode 100644
index 0000000000..ca9a4c0697
--- /dev/null
+++ b/test/files/run/virtpatmat_opt_sharing.flags
@@ -0,0 +1 @@
+-Ypatmat-exhaust-depth off \ No newline at end of file
diff --git a/test/junit/scala/collection/PagedSeq.scala b/test/junit/scala/collection/immutable/PagedSeqTest.scala
index 5f83cf6f31..5f83cf6f31 100644
--- a/test/junit/scala/collection/PagedSeq.scala
+++ b/test/junit/scala/collection/immutable/PagedSeqTest.scala
diff --git a/test/junit/scala/collection/QueueTest.scala b/test/junit/scala/collection/immutable/QueueTest.scala
index 9a40d8fc90..9a40d8fc90 100644
--- a/test/junit/scala/collection/QueueTest.scala
+++ b/test/junit/scala/collection/immutable/QueueTest.scala
diff --git a/test/junit/scala/collection/NumericRangeTest.scala b/test/junit/scala/collection/immutable/RangeConsistencyTest.scala
index 3980c31577..3980c31577 100644
--- a/test/junit/scala/collection/NumericRangeTest.scala
+++ b/test/junit/scala/collection/immutable/RangeConsistencyTest.scala
diff --git a/test/junit/scala/collection/StreamTest.scala b/test/junit/scala/collection/immutable/StreamTest.scala
index 6dc1c79a48..6dc1c79a48 100644
--- a/test/junit/scala/collection/StreamTest.scala
+++ b/test/junit/scala/collection/immutable/StreamTest.scala
diff --git a/test/junit/scala/collection/ArraySortingTest.scala b/test/junit/scala/collection/mutable/ArraySortingTest.scala
index 4e54b39ce7..4e54b39ce7 100644
--- a/test/junit/scala/collection/ArraySortingTest.scala
+++ b/test/junit/scala/collection/mutable/ArraySortingTest.scala
diff --git a/test/junit/scala/collection/PriorityQueueTest.scala b/test/junit/scala/collection/mutable/PriorityQueueTest.scala
index a14f1bf4c8..a14f1bf4c8 100644
--- a/test/junit/scala/collection/PriorityQueueTest.scala
+++ b/test/junit/scala/collection/mutable/PriorityQueueTest.scala
diff --git a/test/junit/scala/collection/VectorTest.scala b/test/junit/scala/collection/mutable/VectorTest.scala
index e9c4d44a72..e9c4d44a72 100644
--- a/test/junit/scala/collection/VectorTest.scala
+++ b/test/junit/scala/collection/mutable/VectorTest.scala
diff --git a/test/junit/scala/issues/BytecodeTests.scala b/test/junit/scala/issues/BytecodeTests.scala
new file mode 100644
index 0000000000..7a05472277
--- /dev/null
+++ b/test/junit/scala/issues/BytecodeTests.scala
@@ -0,0 +1,39 @@
+package scala.issues
+
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+import org.junit.Test
+import scala.tools.asm.Opcodes
+import scala.tools.nsc.backend.jvm.CodeGenTools._
+import org.junit.Assert._
+import scala.collection.JavaConverters._
+import scala.tools.partest.ASMConverters._
+
+@RunWith(classOf[JUnit4])
+class BytecodeTests {
+ val compiler = newCompiler()
+
+ @Test
+ def t8731(): Unit = {
+ val code =
+ """class C {
+ | def f(x: Int) = (x: @annotation.switch) match {
+ | case 1 => 0
+ | case 2 => 1
+ | case 3 => 2
+ | }
+ | final val K = 10
+ | def g(x: Int) = (x: @annotation.switch) match {
+ | case K => 0
+ | case 1 => 10
+ | case 2 => 20
+ | }
+ |}
+ """.stripMargin
+
+ val List(c) = compileClasses(compiler)(code)
+
+ assertTrue(getSingleMethod(c, "f").instructions.count(_.isInstanceOf[TableSwitch]) == 1)
+ assertTrue(getSingleMethod(c, "g").instructions.count(_.isInstanceOf[LookupSwitch]) == 1)
+ }
+}
diff --git a/test/junit/scala/math/NumericTest.scala b/test/junit/scala/math/NumericTest.scala
index 4f0657f471..9bf7d4f1e4 100644
--- a/test/junit/scala/math/NumericTest.scala
+++ b/test/junit/scala/math/NumericTest.scala
@@ -1,4 +1,4 @@
-
+package scala.math
import org.junit.Assert._
import org.junit.Test
diff --git a/test/junit/scala/reflect/internal/PrintersTest.scala b/test/junit/scala/reflect/internal/PrintersTest.scala
index 1458b942dc..ca9b4671b2 100644
--- a/test/junit/scala/reflect/internal/PrintersTest.scala
+++ b/test/junit/scala/reflect/internal/PrintersTest.scala
@@ -24,10 +24,10 @@ object PrinterHelper {
resultCode.lines mkString s"$LF"
def assertResultCode(code: String)(parsedCode: String = "", typedCode: String = "", wrap: Boolean = false, printRoot: Boolean = false) = {
- def toolboxTree(tree: => Tree) = try{
+ def toolboxTree(tree: => Tree) = try {
tree
} catch {
- case e:scala.tools.reflect.ToolBoxError => throw new Exception(e.getMessage + ": " + code)
+ case e:scala.tools.reflect.ToolBoxError => throw new Exception(e.getMessage + ": " + code, e)
}
def wrapCode(source: String) = {
@@ -1186,4 +1186,4 @@ trait QuasiTreesPrintTests {
| };
| ()
|}""")
-} \ No newline at end of file
+}
diff --git a/test/junit/scala/reflect/internal/ScopeTest.scala b/test/junit/scala/reflect/internal/ScopeTest.scala
index 5166620189..1ab24facac 100644
--- a/test/junit/scala/reflect/internal/ScopeTest.scala
+++ b/test/junit/scala/reflect/internal/ScopeTest.scala
@@ -1,4 +1,4 @@
-package symtab
+package scala.reflect.internal
import scala.tools.nsc.symtab
diff --git a/test/junit/scala/reflect/internal/util/AbstractFileClassLoaderTest.scala b/test/junit/scala/reflect/internal/util/AbstractFileClassLoaderTest.scala
new file mode 100644
index 0000000000..a2537ddab7
--- /dev/null
+++ b/test/junit/scala/reflect/internal/util/AbstractFileClassLoaderTest.scala
@@ -0,0 +1,138 @@
+package scala.reflect.internal.util
+
+import org.junit.Assert._
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+@RunWith(classOf[JUnit4])
+class AbstractFileClassLoaderTest {
+
+ import scala.reflect.io._
+ import scala.io.Source
+ import scala.io.Codec.UTF8
+ import scala.reflect.io.Streamable
+ import java.net.{ URLClassLoader, URL }
+
+ implicit def `we love utf8` = UTF8
+ implicit class `abs file ops`(f: AbstractFile) {
+ def writeContent(s: String): Unit = Streamable.closing(f.bufferedOutput)(os => os write s.getBytes(UTF8.charSet))
+ }
+ implicit class `url slurp`(url: URL) {
+ def slurp(): String = Streamable.slurp(url)
+ }
+
+ val NoClassLoader: ClassLoader = null
+
+ def fuzzBuzzBooz: (AbstractFile, AbstractFile) = {
+ val fuzz = new VirtualDirectory("fuzz", None)
+ val buzz = fuzz subdirectoryNamed "buzz"
+ val booz = buzz fileNamed "booz.class"
+ (fuzz, booz)
+ }
+
+ @Test
+ def afclGetsParent(): Unit = {
+ val p = new URLClassLoader(Array.empty[URL])
+ val d = new VirtualDirectory("vd", None)
+ val x = new AbstractFileClassLoader(d, p)
+ assertSame(p, x.getParent)
+ }
+
+ @Test
+ def afclGetsResource(): Unit = {
+ val (fuzz, booz) = fuzzBuzzBooz
+ booz writeContent "hello, world"
+ val x = new AbstractFileClassLoader(fuzz, NoClassLoader)
+ val r = x.getResource("buzz/booz.class")
+ assertNotNull(r)
+ assertEquals("hello, world", r.slurp())
+ }
+
+ @Test
+ def afclGetsResourceFromParent(): Unit = {
+ val (fuzz, booz) = fuzzBuzzBooz
+ val (fuzz_, booz_) = fuzzBuzzBooz
+ booz writeContent "hello, world"
+ booz_ writeContent "hello, world_"
+ val p = new AbstractFileClassLoader(fuzz, NoClassLoader)
+ val x = new AbstractFileClassLoader(fuzz_, p)
+ val r = x.getResource("buzz/booz.class")
+ assertNotNull(r)
+ assertEquals("hello, world", r.slurp())
+ }
+
+ @Test
+ def afclGetsResourceInDefaultPackage(): Unit = {
+ val fuzz = new VirtualDirectory("fuzz", None)
+ val booz = fuzz fileNamed "booz.class"
+ val bass = fuzz fileNamed "bass"
+ booz writeContent "hello, world"
+ bass writeContent "lo tone"
+ val x = new AbstractFileClassLoader(fuzz, NoClassLoader)
+ val r = x.getResource("booz.class")
+ assertNotNull(r)
+ assertEquals("hello, world", r.slurp())
+ assertEquals("lo tone", (x getResource "bass").slurp())
+ }
+
+ // SI-8843
+ @Test
+ def afclGetsResources(): Unit = {
+ val (fuzz, booz) = fuzzBuzzBooz
+ booz writeContent "hello, world"
+ val x = new AbstractFileClassLoader(fuzz, NoClassLoader)
+ val e = x.getResources("buzz/booz.class")
+ assertTrue(e.hasMoreElements)
+ assertEquals("hello, world", e.nextElement.slurp())
+ assertFalse(e.hasMoreElements)
+ }
+
+ @Test
+ def afclGetsResourcesFromParent(): Unit = {
+ val (fuzz, booz) = fuzzBuzzBooz
+ val (fuzz_, booz_) = fuzzBuzzBooz
+ booz writeContent "hello, world"
+ booz_ writeContent "hello, world_"
+ val p = new AbstractFileClassLoader(fuzz, NoClassLoader)
+ val x = new AbstractFileClassLoader(fuzz_, p)
+ val e = x.getResources("buzz/booz.class")
+ assertTrue(e.hasMoreElements)
+ assertEquals("hello, world", e.nextElement.slurp())
+ assertTrue(e.hasMoreElements)
+ assertEquals("hello, world_", e.nextElement.slurp())
+ assertFalse(e.hasMoreElements)
+ }
+
+ @Test
+ def afclGetsResourceAsStream(): Unit = {
+ val (fuzz, booz) = fuzzBuzzBooz
+ booz writeContent "hello, world"
+ val x = new AbstractFileClassLoader(fuzz, NoClassLoader)
+ val r = x.getResourceAsStream("buzz/booz.class")
+ assertNotNull(r)
+ assertEquals("hello, world", Streamable.closing(r)(is => Source.fromInputStream(is).mkString))
+ }
+
+ @Test
+ def afclGetsClassBytes(): Unit = {
+ val (fuzz, booz) = fuzzBuzzBooz
+ booz writeContent "hello, world"
+ val x = new AbstractFileClassLoader(fuzz, NoClassLoader)
+ val b = x.classBytes("buzz/booz.class")
+ assertEquals("hello, world", new String(b, UTF8.charSet))
+ }
+
+ @Test
+ def afclGetsClassBytesFromParent(): Unit = {
+ val (fuzz, booz) = fuzzBuzzBooz
+ val (fuzz_, booz_) = fuzzBuzzBooz
+ booz writeContent "hello, world"
+ booz_ writeContent "hello, world_"
+
+ val p = new AbstractFileClassLoader(fuzz, NoClassLoader)
+ val x = new AbstractFileClassLoader(fuzz_, p)
+ val b = x.classBytes("buzz/booz.class")
+ assertEquals("hello, world", new String(b, UTF8.charSet))
+ }
+}
diff --git a/test/junit/scala/tools/nsc/SampleTest.scala b/test/junit/scala/tools/nsc/SampleTest.scala
index 8e026da1ea..810c88ef9d 100644
--- a/test/junit/scala/tools/nsc/SampleTest.scala
+++ b/test/junit/scala/tools/nsc/SampleTest.scala
@@ -1,5 +1,4 @@
package scala.tools.nsc
-package test
import org.junit.Assert._
import org.junit.Test
diff --git a/test/junit/scala/tools/nsc/backend/jvm/CodeGenTools.scala b/test/junit/scala/tools/nsc/backend/jvm/CodeGenTools.scala
index 15bc1f427d..b892eb36cf 100644
--- a/test/junit/scala/tools/nsc/backend/jvm/CodeGenTools.scala
+++ b/test/junit/scala/tools/nsc/backend/jvm/CodeGenTools.scala
@@ -76,4 +76,7 @@ object CodeGenTools {
def assertSameCode(actual: List[Instruction], expected: List[Instruction]): Unit = {
assertTrue(s"\nExpected: $expected\nActual : $actual", actual === expected)
}
+
+ def getSingleMethod(classNode: ClassNode, name: String): Method =
+ convertMethod(classNode.methods.asScala.toList.find(_.name == name).get)
}
diff --git a/test/junit/scala/util/t7265.scala b/test/junit/scala/util/SpecVersionTest.scala
index 71f085d21d..e3e7a978f2 100644
--- a/test/junit/scala/util/t7265.scala
+++ b/test/junit/scala/util/SpecVersionTest.scala
@@ -1,14 +1,11 @@
package scala.util
-package test
import org.junit.Assert._
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
-import scala.util.PropertiesTrait
-
/** The java version property uses the spec version
* and must work for all "major.minor" and fail otherwise.
*/
@@ -24,6 +21,7 @@ class SpecVersionTest {
override lazy val scalaProps = new java.util.Properties
}
+ // SI-7265
@Test
def comparesCorrectly(): Unit = {
assert(sut isJavaAtLeast "1.5")
diff --git a/test/junit/scala/util/matching/regextract-char.scala b/test/junit/scala/util/matching/CharRegexTest.scala
index 50fdcd9d46..50fdcd9d46 100644
--- a/test/junit/scala/util/matching/regextract-char.scala
+++ b/test/junit/scala/util/matching/CharRegexTest.scala