summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/files/jvm/innerClassAttribute.check54
-rw-r--r--test/files/jvm/innerClassAttribute/Classes_1.scala187
-rw-r--r--test/files/jvm/innerClassAttribute/JavaAnnot_1.java3
-rw-r--r--test/files/jvm/innerClassAttribute/Java_A_1.java10
-rw-r--r--test/files/jvm/innerClassAttribute/Test.scala352
-rw-r--r--test/files/jvm/interpreter.check2
-rw-r--r--test/files/jvm/javaReflection.check259
-rw-r--r--test/files/jvm/javaReflection/Classes_1.scala84
-rw-r--r--test/files/jvm/javaReflection/Test.scala137
-rw-r--r--test/files/jvm/throws-annot-from-java.check2
-rw-r--r--test/files/jvm/varargs.check3
-rw-r--r--test/files/jvm/varargs/JavaClass.java1
-rw-r--r--test/files/jvm/varargs/VaClass.scala2
-rw-r--r--test/files/jvm/xml05.check2
-rw-r--r--test/files/neg/forgot-interpolator.check16
-rw-r--r--test/files/neg/forgot-interpolator.scala4
-rw-r--r--test/files/neg/macro-basic-mamdmi.check10
-rw-r--r--test/files/neg/t3909.check1
-rw-r--r--test/files/neg/t4851.check4
-rw-r--r--test/files/neg/t4851.flags2
-rw-r--r--test/files/neg/t4851/J2.java4
-rw-r--r--test/files/neg/t5148.check9
-rw-r--r--test/files/neg/t5691.check24
-rw-r--r--test/files/neg/t5691.flags1
-rw-r--r--test/files/neg/t5691.scala27
-rw-r--r--test/files/neg/t6675b.scala2
-rw-r--r--test/files/neg/t7848-interp-warn.check6
-rw-r--r--test/files/neg/t7848-interp-warn.flags2
-rw-r--r--test/files/neg/t8035-no-adapted-args.check21
-rw-r--r--test/files/neg/t8035-no-adapted-args.flags1
-rw-r--r--test/files/neg/t8035-no-adapted-args.scala6
-rw-r--r--test/files/neg/t8266-invalid-interp.check4
-rw-r--r--test/files/neg/t8525.check15
-rw-r--r--test/files/neg/t8525.flags1
-rw-r--r--test/files/neg/t8525.scala10
-rw-r--r--test/files/neg/t8610-arg.check6
-rw-r--r--test/files/neg/t8610-arg.flags1
-rw-r--r--test/files/neg/t8610-arg.scala10
-rw-r--r--test/files/neg/t8610.check18
-rw-r--r--test/files/neg/t8610.flags1
-rw-r--r--test/files/neg/t8610.scala10
-rw-r--r--test/files/neg/t8736-c.check11
-rw-r--r--test/files/neg/t8736-c.flags1
-rw-r--r--test/files/neg/t8736-c.scala7
-rw-r--r--test/files/neg/warn-inferred-any.flags2
-rw-r--r--test/files/pos/macro-attachments/Macros_1.scala19
-rw-r--r--test/files/pos/macro-attachments/Test_2.scala3
-rw-r--r--test/files/pos/t8013.flags2
-rw-r--r--test/files/pos/t8736-b.flags1
-rw-r--r--test/files/pos/t8736-b.scala7
-rw-r--r--test/files/pos/t8736.flags1
-rw-r--r--test/files/pos/t8736.scala7
-rw-r--r--test/files/pos/t8743.scala15
-rw-r--r--test/files/pos/t8781/Macro_1.scala13
-rw-r--r--test/files/pos/t8781/Test_2.flags1
-rw-r--r--test/files/pos/t8781/Test_2.scala5
-rw-r--r--test/files/pos/t8793.scala15
-rw-r--r--test/files/pos/t8828.flags1
-rw-r--r--test/files/pos/t8828.scala20
-rw-r--r--test/files/run/abstypetags_serialize.check4
-rw-r--r--test/files/run/class-symbol-contravariant.check2
-rw-r--r--test/files/run/constant-type.check2
-rw-r--r--test/files/run/constrained-types.check2
-rw-r--r--test/files/run/exprs_serialize.check21
-rw-r--r--test/files/run/exprs_serialize.scala12
-rw-r--r--test/files/run/kind-repl-command.check2
-rw-r--r--test/files/run/lub-visibility.check2
-rw-r--r--test/files/run/macro-bundle-repl.check2
-rw-r--r--test/files/run/macro-rangepos-subpatterns.check1
-rw-r--r--test/files/run/macro-rangepos-subpatterns.flags1
-rw-r--r--test/files/run/macro-rangepos-subpatterns/Macros_1.scala18
-rw-r--r--test/files/run/macro-rangepos-subpatterns/Test_2.scala5
-rw-r--r--test/files/run/macro-repl-basic.check2
-rw-r--r--test/files/run/macro-repl-dontexpand.check2
-rw-r--r--test/files/run/macro-system-properties.check2
-rw-r--r--test/files/run/names-defaults.check1
-rw-r--r--test/files/run/names-defaults.scala4
-rw-r--r--test/files/run/private-override.check1
-rw-r--r--test/files/run/reflection-attachments.check0
-rw-r--r--test/files/run/reflection-equality.check2
-rw-r--r--test/files/run/reflection-magicsymbols-repl.check2
-rw-r--r--test/files/run/reflection-repl-classes.check2
-rw-r--r--test/files/run/reflection-repl-elementary.check2
-rw-r--r--test/files/run/reify-repl-fail-gracefully.check2
-rw-r--r--test/files/run/reify_newimpl_22.check2
-rw-r--r--test/files/run/reify_newimpl_23.check2
-rw-r--r--test/files/run/reify_newimpl_25.check2
-rw-r--r--test/files/run/reify_newimpl_26.check2
-rw-r--r--test/files/run/reify_newimpl_35.check2
-rw-r--r--test/files/run/repl-assign.check2
-rw-r--r--test/files/run/repl-bare-expr.check2
-rw-r--r--test/files/run/repl-colon-type.check2
-rw-r--r--test/files/run/repl-empty-package.check2
-rw-r--r--test/files/run/repl-javap-app.check6
-rw-r--r--test/files/run/repl-out-dir.check2
-rw-r--r--test/files/run/repl-parens.check2
-rw-r--r--test/files/run/repl-paste-2.check2
-rw-r--r--test/files/run/repl-paste-3.check2
-rw-r--r--test/files/run/repl-paste-4.scala2
-rw-r--r--test/files/run/repl-paste-raw.scala2
-rw-r--r--test/files/run/repl-paste.check2
-rw-r--r--test/files/run/repl-power.check2
-rw-r--r--test/files/run/repl-reset.check2
-rw-r--r--test/files/run/repl-save.scala2
-rw-r--r--test/files/run/repl-term-macros.check2
-rw-r--r--test/files/run/repl-transcript.check2
-rw-r--r--test/files/run/repl-trim-stack-trace.scala2
-rw-r--r--test/files/run/repl-type-verbose.check2
-rw-r--r--test/files/run/stringinterpolation_macro-run.check4
-rw-r--r--test/files/run/stringinterpolation_macro-run.scala1
-rw-r--r--test/files/run/t3376.check2
-rw-r--r--test/files/run/t4025.check2
-rw-r--r--test/files/run/t4172.check2
-rw-r--r--test/files/run/t4216.check2
-rw-r--r--test/files/run/t4285.check2
-rw-r--r--test/files/run/t4332.scala2
-rw-r--r--test/files/run/t4542.check2
-rw-r--r--test/files/run/t4594-repl-settings.scala2
-rw-r--r--test/files/run/t4671.check2
-rw-r--r--test/files/run/t4710.check2
-rw-r--r--test/files/run/t5072.check2
-rw-r--r--test/files/run/t5256c.check2
-rw-r--r--test/files/run/t5256d.check2
-rw-r--r--test/files/run/t5535.check2
-rw-r--r--test/files/run/t5537.check2
-rw-r--r--test/files/run/t5583.check2
-rw-r--r--test/files/run/t5655.check2
-rw-r--r--test/files/run/t5789.check2
-rw-r--r--test/files/run/t6086-repl.check2
-rw-r--r--test/files/run/t6146b.check2
-rw-r--r--test/files/run/t6187.check2
-rw-r--r--test/files/run/t6273.check2
-rw-r--r--test/files/run/t6320.check2
-rw-r--r--test/files/run/t6329_repl.check2
-rw-r--r--test/files/run/t6329_repl_bug.check2
-rw-r--r--test/files/run/t6381.check2
-rw-r--r--test/files/run/t6434.check2
-rw-r--r--test/files/run/t6439.check2
-rw-r--r--test/files/run/t6440.check9
-rw-r--r--test/files/run/t6440b.check9
-rw-r--r--test/files/run/t6507.check2
-rw-r--r--test/files/run/t6549.check2
-rw-r--r--test/files/run/t6631.scala18
-rw-r--r--test/files/run/t6937.check2
-rw-r--r--test/files/run/t7185.check2
-rw-r--r--test/files/run/t7319.check2
-rw-r--r--test/files/run/t7482a.check2
-rw-r--r--test/files/run/t7634.check2
-rw-r--r--test/files/run/t7747-repl.check2
-rw-r--r--test/files/run/t7801.check2
-rw-r--r--test/files/run/t7805-repl-i.check2
-rw-r--r--test/files/run/t8608-no-format.scala15
-rw-r--r--test/files/run/t8610.check7
-rw-r--r--test/files/run/t8610.flags1
-rw-r--r--test/files/run/t8610.scala13
-rw-r--r--test/files/run/t8738.scala16
-rw-r--r--test/files/run/t8823.scala10
-rw-r--r--test/files/run/tpeCache-tyconCache.check2
-rw-r--r--test/files/run/typetags_serialize.check5
-rw-r--r--test/files/run/typetags_serialize.scala5
-rw-r--r--test/files/run/typetags_without_scala_reflect_typetag_lookup.scala4
-rw-r--r--test/files/run/typetags_without_scala_reflect_typetag_manifest_interop.scala4
-rw-r--r--test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala7
-rw-r--r--test/junit/scala/StringContextTest.scala27
-rw-r--r--test/junit/scala/collection/StreamTest.scala18
-rw-r--r--test/junit/scala/reflect/QTest.scala23
-rw-r--r--test/junit/scala/tools/nsc/backend/jvm/BTypesTest.scala55
-rw-r--r--test/junit/scala/tools/nsc/settings/SettingsTest.scala30
-rw-r--r--test/junit/scala/util/matching/RegexTest.scala17
-rw-r--r--test/scaladoc/run/t8314.check3
-rw-r--r--test/scaladoc/run/t8314.scala16
-rw-r--r--test/scaladoc/run/t8557.check1
-rw-r--r--test/scaladoc/run/t8557.scala32
173 files changed, 1825 insertions, 196 deletions
diff --git a/test/files/jvm/innerClassAttribute.check b/test/files/jvm/innerClassAttribute.check
new file mode 100644
index 0000000000..20518aa49e
--- /dev/null
+++ b/test/files/jvm/innerClassAttribute.check
@@ -0,0 +1,54 @@
+#partest !-Ydelambdafy:method
+-- A4 --
+A4$$anonfun$f$1 / null / null / 17
+A4$$anonfun$f$1 / null / null / 17
+A4 / f / (Lscala/collection/immutable/List;)Lscala/collection/immutable/List;
+-- A19 --
+A19$$anonfun$1 / null / null / 17
+A19$$anonfun$2 / null / null / 17
+A19$$anonfun$3 / null / null / 17
+A19$$anonfun$1 / null / null / 17
+A19$$anonfun$2 / null / null / 17
+A19$$anonfun$3 / null / null / 17
+A19 / null / null
+A19 / null / null
+A19 / null / null
+-- A20 --
+A20$$anonfun$4 / null / null / 17
+fun1: attribute for itself and the two child closures `() => ()` and `() => () => 1`
+A20$$anonfun$4 / null / null / 17
+A20$$anonfun$4$$anonfun$apply$1 / null / null / 17
+A20$$anonfun$4$$anonfun$apply$3 / null / null / 17
+fun2 () => (): itself and the outer closure
+A20$$anonfun$4 / null / null / 17
+A20$$anonfun$4$$anonfun$apply$1 / null / null / 17
+fun3 () => () => (): itself, the outer closure and its child closure
+A20$$anonfun$4 / null / null / 17
+A20$$anonfun$4$$anonfun$apply$3 / null / null / 17
+A20$$anonfun$4$$anonfun$apply$3$$anonfun$apply$2 / null / null / 17
+fun4: () => 1: itself and the two outer closures
+A20$$anonfun$4 / null / null / 17
+A20$$anonfun$4$$anonfun$apply$3 / null / null / 17
+A20$$anonfun$4$$anonfun$apply$3$$anonfun$apply$2 / null / null / 17
+enclosing: nested closures have the apply method of the outer closure
+A20 / null / null
+A20$$anonfun$4 / apply / ()Lscala/Function0;
+A20$$anonfun$4 / apply / ()Lscala/Function0;
+A20$$anonfun$4$$anonfun$apply$3 / apply / ()Lscala/Function0;
+#partest -Ydelambdafy:method
+-- A4 --
+null / null / null
+-- A19 --
+null / null / null
+null / null / null
+null / null / null
+-- A20 --
+fun1: attribute for itself and the two child closures `() => ()` and `() => () => 1`
+fun2 () => (): itself and the outer closure
+fun3 () => () => (): itself, the outer closure and its child closure
+fun4: () => 1: itself and the two outer closures
+enclosing: nested closures have the apply method of the outer closure
+null / null / null
+null / null / null
+null / null / null
+null / null / null
diff --git a/test/files/jvm/innerClassAttribute/Classes_1.scala b/test/files/jvm/innerClassAttribute/Classes_1.scala
new file mode 100644
index 0000000000..9c3ea7f013
--- /dev/null
+++ b/test/files/jvm/innerClassAttribute/Classes_1.scala
@@ -0,0 +1,187 @@
+class A1 {
+ class B
+}
+
+class A2 {
+ object B
+}
+
+object A3 {
+ class B1
+ object B2
+}
+
+class A4 {
+ def f(l: List[Int]): List[Int] = {
+ l map (_ + 1)
+ }
+}
+
+class A5 {
+ def f(): Object = {
+ object B
+ B
+ }
+}
+
+trait A6 {
+ def hui = -6
+ trait TT
+}
+
+class A7 extends A6
+
+abstract class A8 extends A6 {
+ def fish: TT
+}
+
+class A9 {
+ class brick extends annotation.StaticAnnotation
+}
+
+class A10 {
+ val a9 = new A9()
+ // there's no reference to brick in the bytecode (only in the pickle), so there's no InnerClass attribute for it.
+ @a9.brick def f = -7
+}
+
+class A11 {
+ @JavaAnnot_1.Ann def f = -8
+}
+
+object A12 {
+ object B {
+ class C
+ }
+}
+
+class A13 {
+ def oak: A12.B.C = new A12.B.C
+}
+
+class A14 {
+ def f = {
+ val x: Object = {
+ class K
+ new K
+ }
+ x
+ }
+ def g = {
+ val x: Object = new A6 { }
+ }
+}
+
+object A15 {
+ def f = {
+ class B { // non-static, even though it doesn't have an outer pointer
+ class C // non-static
+ }
+ }
+}
+
+class A16 {
+ val x: A6 = {
+ class U extends A6
+ new A6 { }
+ }
+
+ {
+ class V extends A6
+ new A6 { }
+ }
+
+ new A6 { }
+}
+
+class A17 {
+ object B {
+ class C // not static, also has an outer pointer.
+ }
+}
+
+class A18 {
+ def f = {
+ def g = {
+ class A
+ new A6 { }
+ val y = {
+ if ((new Object).hashCode() == 1) {class B {} ; new B} else 2
+ if ((new Object).hashCode() == 1) new A6 { } else "haifish"
+ }
+ }
+ }
+}
+
+class A19 {
+ ((x: Int) => x + 3)
+
+ val x = {
+ ((x: Int) => x + 1)
+ }
+
+ {
+ ((x: Int) => x + 2)
+ }
+}
+
+class A20 {
+ () => {
+ {() => ()}
+ {() => () => 1}
+ }
+}
+
+class A21 {
+ class I1
+ def f = { class J1 }
+}
+object A21 {
+ class I2
+ object I3 {
+ class J2 // static
+ }
+ def g = { class J3 } // non-static
+ val x = { class J4 } // non-static
+ {
+ class J5 // non-static (!)
+ new J5
+ }
+}
+
+class A22 {
+ class C
+ object C {
+ class D // inner class of C$, not of C. Not added to the inner class table of C, only to C$
+ }
+}
+
+class A23 {
+ def f = {
+ val a = new Java_A_1()
+ val c = new Java_A_1.C()
+ val d = new Java_A_1.C.D()
+ val e = new c.E()
+ val f = new a.F()
+ val g = new f.G()
+ }
+}
+
+trait A24Sym
+
+trait A24Base {
+ // trait with concrete members: interface plus (absract) impl class
+ trait DefinitionsApi {
+ def Abs: A24Sym
+ def Conc: A24Sym = new A24Sym { }
+ }
+}
+
+trait A24 extends A24Base {
+ class DefinitionsClass extends DefinitionsApi {
+ // bridge methods are generated for Abs and Conc. there used to be a bug: the bridge symbol was a ModuleSymbol,
+ // calling companionClass would return NoSymbol. i changed erasure to make the bridge symbol is a MethodSymbol.
+ object Abs extends A24Sym
+ override object Conc extends A24Sym
+ }
+}
diff --git a/test/files/jvm/innerClassAttribute/JavaAnnot_1.java b/test/files/jvm/innerClassAttribute/JavaAnnot_1.java
new file mode 100644
index 0000000000..27c4d4e5d3
--- /dev/null
+++ b/test/files/jvm/innerClassAttribute/JavaAnnot_1.java
@@ -0,0 +1,3 @@
+public class JavaAnnot_1 {
+ public static @interface Ann {}
+}
diff --git a/test/files/jvm/innerClassAttribute/Java_A_1.java b/test/files/jvm/innerClassAttribute/Java_A_1.java
new file mode 100644
index 0000000000..3357d05e2b
--- /dev/null
+++ b/test/files/jvm/innerClassAttribute/Java_A_1.java
@@ -0,0 +1,10 @@
+public class Java_A_1 {
+ public static class C {
+ public static class D { }
+ public class E { }
+ }
+
+ public class F {
+ public class G { }
+ }
+}
diff --git a/test/files/jvm/innerClassAttribute/Test.scala b/test/files/jvm/innerClassAttribute/Test.scala
new file mode 100644
index 0000000000..882edbcdd7
--- /dev/null
+++ b/test/files/jvm/innerClassAttribute/Test.scala
@@ -0,0 +1,352 @@
+import scala.tools.partest.BytecodeTest
+import scala.tools.asm
+import asm.tree.{ClassNode, InnerClassNode}
+import asm.{Opcodes => Flags}
+import scala.collection.JavaConverters._
+
+object Test extends BytecodeTest {
+ def assertSame(a: Any, b: Any) = {
+ assert(a == b, s"\na: $a\nb: $b")
+ }
+
+ val publicStatic = Flags.ACC_PUBLIC | Flags.ACC_STATIC
+ val publicAbstractInterface = Flags.ACC_PUBLIC | Flags.ACC_ABSTRACT | Flags.ACC_INTERFACE
+
+ def innerClassNodes(className: String): List[InnerClassNode] = {
+ loadClassNode(className).innerClasses.asScala.toList.sortBy(_.name)
+ }
+
+ final case class EnclosingMethod(name: String, descriptor: String, outerClass: String)
+ def enclosingMethod(className: String) = {
+ val n = loadClassNode(className)
+ EnclosingMethod(n.outerMethod, n.outerMethodDesc, n.outerClass)
+ }
+
+ def assertMember(node: InnerClassNode, outer: String, inner: String, name: Option[String] = None, flags: Int = Flags.ACC_PUBLIC) = {
+ assertSame(node.name, name.getOrElse(s"$outer$$$inner"))
+ assertSame(node.outerName, outer)
+ assertSame(node.innerName, inner)
+ assertSame(node.access, flags)
+ }
+
+ def assertAnonymous(node: InnerClassNode, name: String, flags: Int = Flags.ACC_PUBLIC | Flags.ACC_FINAL) = {
+ assertSame(node.name, name)
+ assertSame(node.outerName, null)
+ assertSame(node.innerName, null)
+ assertSame(node.access, flags)
+ }
+
+ def assertLocal(node: InnerClassNode, name: String, inner: String, flags: Int = Flags.ACC_PUBLIC) = {
+ assertSame(node.name, name)
+ assertSame(node.outerName, null)
+ assertSame(node.innerName, inner)
+ assertSame(node.access, flags)
+ }
+
+ def assertEnclosingMethod(className: String, outerClass: String, name: String, descriptor: String) = {
+ val encl = enclosingMethod(className)
+ assertSame(encl.outerClass, outerClass)
+ assertSame(encl.name, name)
+ assertSame(encl.descriptor, descriptor)
+ }
+
+ def assertNoEnclosingMethod(className: String) = {
+ assertSame(enclosingMethod(className).outerClass, null)
+ }
+
+ def printInnerClassNodes(className: String) = {
+ for (n <- innerClassNodes(className)) {
+ println(s"${n.name} / ${n.outerName} / ${n.innerName} / ${n.access}")
+ }
+ }
+
+ def printEnclosingMethod(className: String) = {
+ val e = enclosingMethod(className)
+ println(s"${e.outerClass} / ${e.name} / ${e.descriptor}")
+ }
+
+ def lambdaClass(anonfunName: String, lambdaName: String): String = {
+ if (classpath.findClass(anonfunName).isDefined) anonfunName else lambdaName
+ }
+
+ def testA1() = {
+ val List(b1) = innerClassNodes("A1")
+ assertMember(b1, "A1", "B")
+ val List(b2) = innerClassNodes("A1$B")
+ assertMember(b2, "A1", "B")
+ }
+
+ def testA2() = {
+ val List(b1) = innerClassNodes("A2")
+ assertMember(b1, "A2", "B$")
+ val List(b2) = innerClassNodes("A2$B$")
+ assertMember(b2, "A2", "B$")
+ }
+
+ def testA3() = {
+ def t(c: String) = {
+ val List(b1, b2) = innerClassNodes(c)
+ // the outer class for classes nested inside top-level modules is not the module class, but the mirror class.
+ // this is a hack for java interop, handled in the backend. see BTypes.scala, comment on "Java Compatibility".
+ assertMember(b1, "A3", "B1", flags = publicStatic)
+ assertMember(b2, "A3", "B2$", flags = publicStatic)
+ }
+ t("A3$")
+ // the mirror class has the same inner class attributes as the module
+ // class (added when the mirror is created in the backend)
+ t("A3")
+ }
+
+ def testA4() = {
+ println("-- A4 --")
+ printInnerClassNodes("A4")
+ val fun = lambdaClass("A4$$anonfun$f$1", "A4$lambda$$f$1")
+ printInnerClassNodes(fun)
+ printEnclosingMethod(fun)
+ }
+
+ def testA5() = {
+ val List(b1) = innerClassNodes("A5")
+ assertLocal(b1, "A5$B$2$", "B$2$")
+ val List(b2) = innerClassNodes("A5$B$2$")
+ assertLocal(b2, "A5$B$2$", "B$2$")
+ assertEnclosingMethod(
+ "A5$B$2$",
+ "A5", "f", "()Ljava/lang/Object;")
+ }
+
+ def testA6() = {
+ val List(tt1) = innerClassNodes("A6")
+ assertMember(tt1, "A6", "TT", flags = publicAbstractInterface)
+ val List() = innerClassNodes("A6$class")
+ val List(tt2) = innerClassNodes("A6$TT")
+ assertMember(tt2, "A6", "TT", flags = publicAbstractInterface)
+ }
+
+ def testA7() = {
+ val List() = innerClassNodes("A7")
+ }
+
+ def testA8() = {
+ val List(tt) = innerClassNodes("A8")
+ assertMember(tt, "A6", "TT", flags = publicAbstractInterface)
+ }
+
+ def testA10() = {
+ val List() = innerClassNodes("A10")
+ }
+
+ def testA11() = {
+ val List(ann) = innerClassNodes("A11")
+ // in the java class file, the INNERCLASS attribute has more flags (public | static | abstract | interface | annotation)
+ // the scala compiler has its own interpretation of java annotations ant their flags.. it only emits publicStatic.
+ assertMember(ann, "JavaAnnot_1", "Ann", flags = publicStatic)
+ }
+
+ def testA13() = {
+ val List(b, c) = innerClassNodes("A13")
+ assertMember(b, "A12", "B$", flags = publicStatic)
+ assertMember(c, "A12$B$", "C", name = Some("A12$B$C"), flags = publicStatic)
+ }
+
+ def testA14() = {
+ val List(anon, k) = innerClassNodes("A14")
+
+ assertLocal(k, "A14$K$1", "K$1")
+ assertEnclosingMethod(
+ "A14$K$1",
+ "A14", "f", "()Ljava/lang/Object;")
+
+ assertAnonymous(anon, "A14$$anon$1")
+ assertEnclosingMethod(
+ "A14$$anon$1",
+ "A14", "g", "()V")
+ }
+
+ def testA15() = {
+ val List(b) = innerClassNodes("A15")
+ assertLocal(b, "A15$B$3", "B$3")
+
+ val List(_, c) = innerClassNodes("A15$B$3")
+ assertMember(c, "A15$B$3", "C")
+
+ assertEnclosingMethod(
+ "A15$B$3",
+ "A15$", "f", "()V")
+ assertNoEnclosingMethod("A15$B$3$C")
+ }
+
+ def testA16() = {
+ val List(anon1, anon2, anon3, u, v) = innerClassNodes("A16")
+ assertAnonymous(anon1, "A16$$anon$2")
+ assertAnonymous(anon2, "A16$$anon$3")
+ assertAnonymous(anon3, "A16$$anon$4")
+
+ assertLocal(u, "A16$U$1", "U$1")
+ assertLocal(v, "A16$V$1", "V$1")
+
+ assertEnclosingMethod(
+ "A16$$anon$2",
+ "A16", null, null)
+ assertEnclosingMethod(
+ "A16$$anon$3",
+ "A16", null, null)
+ assertEnclosingMethod(
+ "A16$$anon$4",
+ "A16", null, null)
+
+ assertEnclosingMethod(
+ "A16$U$1",
+ "A16", null, null)
+ assertEnclosingMethod(
+ "A16$V$1",
+ "A16", null, null)
+ }
+
+ def testA17() = {
+ val List(b, c) = innerClassNodes("A17$B$")
+ assertMember(b, "A17", "B$")
+ assertMember(c, "A17$B$", "C", name = Some("A17$B$C")) // not static, has an outer pointer.
+ }
+
+ def testA18() = {
+ val List(anon1, anon2, a, b) = innerClassNodes("A18")
+ assertAnonymous(anon1, "A18$$anon$5")
+ assertAnonymous(anon2, "A18$$anon$6")
+
+ assertLocal(a, "A18$A$1", "A$1")
+ assertLocal(b, "A18$B$4", "B$4")
+
+ assertEnclosingMethod(
+ "A18$$anon$5",
+ "A18", "g$1", "()V")
+ assertEnclosingMethod(
+ "A18$$anon$6",
+ "A18", "g$1", "()V")
+
+ assertEnclosingMethod(
+ "A18$A$1",
+ "A18", "g$1", "()V")
+ assertEnclosingMethod(
+ "A18$B$4",
+ "A18", "g$1", "()V")
+ }
+
+ def testA19() = {
+ println("-- A19 --")
+
+ printInnerClassNodes("A19")
+
+ val fun1 = lambdaClass("A19$$anonfun$1", "A19$lambda$1")
+ val fun2 = lambdaClass("A19$$anonfun$2", "A19$lambda$2")
+ val fun3 = lambdaClass("A19$$anonfun$3", "A19$lambda$3")
+
+ printInnerClassNodes(fun1)
+ printInnerClassNodes(fun2)
+ printInnerClassNodes(fun3)
+
+ printEnclosingMethod(fun1)
+ printEnclosingMethod(fun2)
+ printEnclosingMethod(fun3)
+ }
+
+ def testA20() = {
+ println("-- A20 --")
+
+ printInnerClassNodes("A20")
+
+ val fun1 = lambdaClass("A20$$anonfun$4", "A20$lambda$1")
+ val fun2 = lambdaClass("A20$$anonfun$4$$anonfun$apply$1", "A20$lambda$$$anonfun$5$1")
+ val fun3 = lambdaClass("A20$$anonfun$4$$anonfun$apply$3", "A20$lambda$$$anonfun$5$2")
+ val fun4 = lambdaClass("A20$$anonfun$4$$anonfun$apply$3$$anonfun$apply$2", "A20$lambda$$$anonfun$7$1")
+
+ println("fun1: attribute for itself and the two child closures `() => ()` and `() => () => 1`")
+ printInnerClassNodes(fun1)
+ println("fun2 () => (): itself and the outer closure")
+ printInnerClassNodes(fun2)
+ println("fun3 () => () => (): itself, the outer closure and its child closure")
+ printInnerClassNodes(fun3)
+ println("fun4: () => 1: itself and the two outer closures")
+ printInnerClassNodes(fun4)
+
+ println("enclosing: nested closures have the apply method of the outer closure")
+ printEnclosingMethod(fun1)
+ printEnclosingMethod(fun2)
+ printEnclosingMethod(fun3)
+ printEnclosingMethod(fun4)
+ }
+
+ def testA21() = {
+ val List(i1c, i2c, i3c, j1) = innerClassNodes("A21")
+ assertMember(i1c, "A21", "I1")
+ assertMember(i2c, "A21", "I2", flags = publicStatic)
+ assertMember(i3c, "A21", "I3$", flags = publicStatic)
+ assertLocal(j1, "A21$J1$1", "J1$1")
+
+ val List(i2m, i3m, j3, j4, j5) = innerClassNodes("A21$")
+ assertMember(i2m, "A21", "I2", flags = publicStatic)
+ assertMember(i3m, "A21", "I3$", flags = publicStatic)
+ assertLocal(j3, "A21$J3$1", "J3$1")
+ assertLocal(j4, "A21$J4$1", "J4$1")
+ assertLocal(j5, "A21$J5$1", "J5$1") // non-static!
+
+ val List(i3x, j2x) = innerClassNodes("A21$I3$J2")
+ assertMember(j2x, "A21$I3$", "J2", name = Some("A21$I3$J2"), flags = publicStatic)
+
+ assertNoEnclosingMethod("A21$I3$J2")
+ assertEnclosingMethod("A21$J3$1", "A21$", "g", "()V")
+ assertEnclosingMethod("A21$J4$1", "A21$", null, null)
+ assertEnclosingMethod("A21$J5$1", "A21$", null, null)
+ }
+
+ def testA22() = {
+ val List(cc) = innerClassNodes("A22$C")
+ assertMember(cc, "A22", "C")
+ val List(cm, d) = innerClassNodes("A22$C$")
+ assertMember(cm, "A22", "C$")
+ assertMember(d, "A22$C$", "D", name = Some("A22$C$D"))
+ }
+
+ def testA23() {
+ val List(c, d, e, f, g) = innerClassNodes("A23")
+ assertMember(c, "Java_A_1", "C", flags = publicStatic)
+ assertMember(d, "Java_A_1$C", "D", flags = publicStatic)
+ assertMember(e, "Java_A_1$C", "E")
+ assertMember(f, "Java_A_1", "F")
+ assertMember(g, "Java_A_1$F", "G")
+ }
+
+ def testA24() {
+ val List(defsCls, abs, conc, defsApi, defsApiImpl) = innerClassNodes("A24$DefinitionsClass")
+ assertMember(defsCls, "A24", "DefinitionsClass")
+ assertMember(abs, "A24$DefinitionsClass", "Abs$")
+ assertMember(conc, "A24$DefinitionsClass", "Conc$")
+ assertMember(defsApi, "A24Base", "DefinitionsApi", flags = publicAbstractInterface)
+ assertMember(defsApiImpl, "A24Base", "DefinitionsApi$class", flags = Flags.ACC_PUBLIC | Flags.ACC_ABSTRACT)
+ }
+
+ def show(): Unit = {
+ testA1()
+ testA2()
+ testA3()
+ testA4()
+ testA5()
+ testA6()
+ testA7()
+ testA8()
+ testA10()
+ testA11()
+ testA13()
+ testA14()
+ testA15()
+ testA16()
+ testA17()
+ testA18()
+ testA19()
+ testA20()
+ testA21()
+ testA22()
+ testA23()
+ testA24()
+ }
+}
diff --git a/test/files/jvm/interpreter.check b/test/files/jvm/interpreter.check
index d124794e72..d03edb638c 100644
--- a/test/files/jvm/interpreter.check
+++ b/test/files/jvm/interpreter.check
@@ -361,7 +361,7 @@ It would fail on the following inputs: Exp(), Term()
^
f: (e: Exp)Int
-scala>
+scala> :quit
plusOne: (x: Int)Int
res0: Int = 6
res0: String = after reset
diff --git a/test/files/jvm/javaReflection.check b/test/files/jvm/javaReflection.check
new file mode 100644
index 0000000000..aeb894f741
--- /dev/null
+++ b/test/files/jvm/javaReflection.check
@@ -0,0 +1,259 @@
+#partest !-Ydelambdafy:method
+A$$anonfun$$lessinit$greater$1 / null (canon) / $anonfun$$lessinit$greater$1 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class A (cls) / public A(int) (constr) / null (meth)
+- properties : true (local) / false (member)
+A$$anonfun$$lessinit$greater$1$$anonfun$apply$1 / null (canon) / $anonfun$apply$1 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class A$$anonfun$$lessinit$greater$1 (cls) / null (constr) / public final scala.Function0 A$$anonfun$$lessinit$greater$1.apply() (meth)
+- properties : true (local) / false (member)
+A$$anonfun$2 / null (canon) / $anonfun$2 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class A (cls) / null (constr) / null (meth)
+- properties : true (local) / false (member)
+A$$anonfun$3 / null (canon) / $anonfun$3 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class A (cls) / null (constr) / null (meth)
+- properties : true (local) / false (member)
+A$$anonfun$4 / null (canon) / $anonfun$4 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class A (cls) / null (constr) / null (meth)
+- properties : true (local) / false (member)
+A$$anonfun$f$1 / null (canon) / $anonfun$f$1 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class A (cls) / null (constr) / public java.lang.Object A.f() (meth)
+- properties : true (local) / false (member)
+A$$anonfun$f$2 / null (canon) / $anonfun$f$2 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class A (cls) / null (constr) / public java.lang.Object A.f() (meth)
+- properties : true (local) / false (member)
+A$D$$anonfun$1 / null (canon) / anonfun$1 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class A$D$ (cls) / null (constr) / null (meth)
+- properties : true (local) / false (member)
+AO$$anonfun$5 / null (canon) / anonfun$5 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class AO$ (cls) / null (constr) / null (meth)
+- properties : true (local) / false (member)
+AT$$anonfun$6 / null (canon) / $anonfun$6 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / interface AT (cls) / null (constr) / null (meth)
+- properties : true (local) / false (member)
+#partest -Ydelambdafy:method
+A$D$lambda$1 / A$D$lambda$1 (canon) / A$D$lambda$1 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth)
+- properties : false (local) / false (member)
+A$lambda$$$anonfun$7$1 / A$lambda$$$anonfun$7$1 (canon) / A$lambda$$$anonfun$7$1 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth)
+- properties : false (local) / false (member)
+A$lambda$$$lessinit$greater$1 / A$lambda$$$lessinit$greater$1 (canon) / A$lambda$$$lessinit$greater$1 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth)
+- properties : false (local) / false (member)
+A$lambda$$f$1 / A$lambda$$f$1 (canon) / A$lambda$$f$1 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth)
+- properties : false (local) / false (member)
+A$lambda$$f$2 / A$lambda$$f$2 (canon) / A$lambda$$f$2 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth)
+- properties : false (local) / false (member)
+A$lambda$1 / A$lambda$1 (canon) / A$lambda$1 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth)
+- properties : false (local) / false (member)
+A$lambda$2 / A$lambda$2 (canon) / A$lambda$2 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth)
+- properties : false (local) / false (member)
+A$lambda$3 / A$lambda$3 (canon) / A$lambda$3 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth)
+- properties : false (local) / false (member)
+AO$lambda$1 / AO$lambda$1 (canon) / AO$lambda$1 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth)
+- properties : false (local) / false (member)
+AT$class$lambda$1 / AT$class$lambda$1 (canon) / AT$class$lambda$1 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth)
+- properties : false (local) / false (member)
+#partest
+A / A (canon) / A (simple)
+- declared cls: List(class A$B, interface A$C, class A$D$)
+- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth)
+- properties : false (local) / false (member)
+A$$anon$1 / null (canon) / $anon$1 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class A (cls) / null (constr) / null (meth)
+- properties : true (local) / false (member)
+A$$anon$3 / null (canon) / $anon$3 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class A (cls) / null (constr) / null (meth)
+- properties : true (local) / false (member)
+A$$anon$4 / null (canon) / $anon$4 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class A (cls) / null (constr) / public java.lang.Object A.f() (meth)
+- properties : true (local) / false (member)
+A$$anon$5 / null (canon) / $anon$5 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class A (cls) / null (constr) / public java.lang.Object A.f() (meth)
+- properties : true (local) / false (member)
+A$$anon$6 / null (canon) / $anon$6 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class A (cls) / null (constr) / null (meth)
+- properties : true (local) / false (member)
+A$$anon$7 / null (canon) / $anon$7 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class A (cls) / public A(int) (constr) / null (meth)
+- properties : true (local) / false (member)
+A$B / A.B (canon) / B (simple)
+- declared cls: List()
+- enclosing : class A (declaring cls) / class A (cls) / null (constr) / null (meth)
+- properties : false (local) / true (member)
+A$C / A.C (canon) / C (simple)
+- declared cls: List()
+- enclosing : class A (declaring cls) / class A (cls) / null (constr) / null (meth)
+- properties : false (local) / true (member)
+A$D$ / A.D$ (canon) / D$ (simple)
+- declared cls: List(class A$D$B, interface A$D$C, class A$D$D$)
+- enclosing : class A (declaring cls) / class A (cls) / null (constr) / null (meth)
+- properties : false (local) / true (member)
+A$D$$anon$2 / null (canon) / anon$2 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class A$D$ (cls) / null (constr) / null (meth)
+- properties : true (local) / false (member)
+A$D$B / Malformed class name (canon) / Malformed class name (simple)
+- declared cls: List()
+- enclosing : class A$D$ (declaring cls) / class A$D$ (cls) / null (constr) / null (meth)
+- properties : false (local) / true (member)
+A$D$C / Malformed class name (canon) / Malformed class name (simple)
+- declared cls: List()
+- enclosing : class A$D$ (declaring cls) / class A$D$ (cls) / null (constr) / null (meth)
+- properties : false (local) / true (member)
+A$D$D$ / Malformed class name (canon) / Malformed class name (simple)
+- declared cls: List()
+- enclosing : class A$D$ (declaring cls) / class A$D$ (cls) / null (constr) / null (meth)
+- properties : false (local) / true (member)
+A$D$KB$1 / null (canon) / Malformed class name (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class A$D$ (cls) / null (constr) / public void A$D$.f() (meth)
+- properties : Malformed class name (local) / false (member)
+A$E$1 / null (canon) / E$1 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class A (cls) / null (constr) / public java.lang.Object A.f() (meth)
+- properties : true (local) / false (member)
+A$F$1 / null (canon) / F$1 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class A (cls) / null (constr) / public java.lang.Object A.f() (meth)
+- properties : true (local) / false (member)
+A$G$2$ / null (canon) / G$2$ (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class A (cls) / null (constr) / public java.lang.Object A.f() (meth)
+- properties : true (local) / false (member)
+A$H$1 / null (canon) / H$1 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class A (cls) / null (constr) / public java.lang.Object A.f() (meth)
+- properties : true (local) / false (member)
+A$I$1 / null (canon) / I$1 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class A (cls) / null (constr) / public java.lang.Object A.f() (meth)
+- properties : true (local) / false (member)
+A$J$2$ / null (canon) / J$2$ (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class A (cls) / null (constr) / public java.lang.Object A.f() (meth)
+- properties : true (local) / false (member)
+A$K$1 / null (canon) / K$1 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class A (cls) / null (constr) / null (meth)
+- properties : true (local) / false (member)
+A$L$1 / null (canon) / L$1 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class A (cls) / null (constr) / null (meth)
+- properties : true (local) / false (member)
+A$M$2$ / null (canon) / M$2$ (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class A (cls) / null (constr) / null (meth)
+- properties : true (local) / false (member)
+A$N$1 / null (canon) / N$1 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class A (cls) / null (constr) / null (meth)
+- properties : true (local) / false (member)
+A$O$1 / null (canon) / O$1 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class A (cls) / null (constr) / null (meth)
+- properties : true (local) / false (member)
+A$P$2$ / null (canon) / P$2$ (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class A (cls) / null (constr) / null (meth)
+- properties : true (local) / false (member)
+A$Q$1 / null (canon) / Q$1 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class A (cls) / public A(int) (constr) / null (meth)
+- properties : true (local) / false (member)
+A$R$1 / null (canon) / R$1 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class A (cls) / public A(int) (constr) / null (meth)
+- properties : true (local) / false (member)
+A$S$2$ / null (canon) / S$2$ (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class A (cls) / public A(int) (constr) / null (meth)
+- properties : true (local) / false (member)
+AO / AO (canon) / AO (simple)
+- declared cls: List(class AO$B, interface AO$C, class AO$D$)
+- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth)
+- properties : false (local) / false (member)
+AO$ / AO$ (canon) / AO$ (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth)
+- properties : false (local) / false (member)
+AO$$anon$8 / null (canon) / anon$8 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / class AO$ (cls) / null (constr) / null (meth)
+- properties : true (local) / false (member)
+AO$B / AO.B (canon) / B (simple)
+- declared cls: List()
+- enclosing : class AO (declaring cls) / class AO (cls) / null (constr) / null (meth)
+- properties : false (local) / true (member)
+AO$C / AO.C (canon) / C (simple)
+- declared cls: List()
+- enclosing : class AO (declaring cls) / class AO (cls) / null (constr) / null (meth)
+- properties : false (local) / true (member)
+AO$D$ / AO.D$ (canon) / D$ (simple)
+- declared cls: List()
+- enclosing : class AO (declaring cls) / class AO (cls) / null (constr) / null (meth)
+- properties : false (local) / true (member)
+AT / AT (canon) / AT (simple)
+- declared cls: List(class AT$B, interface AT$C, class AT$D$)
+- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth)
+- properties : false (local) / false (member)
+AT$$anon$9 / null (canon) / $anon$9 (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / interface AT (cls) / null (constr) / null (meth)
+- properties : true (local) / false (member)
+AT$B / AT.B (canon) / B (simple)
+- declared cls: List()
+- enclosing : interface AT (declaring cls) / interface AT (cls) / null (constr) / null (meth)
+- properties : false (local) / true (member)
+AT$C / AT.C (canon) / C (simple)
+- declared cls: List()
+- enclosing : interface AT (declaring cls) / interface AT (cls) / null (constr) / null (meth)
+- properties : false (local) / true (member)
+AT$D$ / AT.D$ (canon) / D$ (simple)
+- declared cls: List()
+- enclosing : interface AT (declaring cls) / interface AT (cls) / null (constr) / null (meth)
+- properties : false (local) / true (member)
+AT$class / AT$class (canon) / AT$class (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth)
+- properties : false (local) / false (member)
+T / T (canon) / T (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth)
+- properties : false (local) / false (member)
+T$class / T$class (canon) / T$class (simple)
+- declared cls: List()
+- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth)
+- properties : false (local) / false (member)
diff --git a/test/files/jvm/javaReflection/Classes_1.scala b/test/files/jvm/javaReflection/Classes_1.scala
new file mode 100644
index 0000000000..11963e2770
--- /dev/null
+++ b/test/files/jvm/javaReflection/Classes_1.scala
@@ -0,0 +1,84 @@
+// See Test.scala for comments
+
+trait T { def f = 1 }
+
+class A {
+ // member class
+ class B
+ // member trait
+ trait C
+ // member object
+ object D {
+ class B
+ trait C
+ object D
+ new T { }
+ (() => -1)
+ def f = { class KB }
+ }
+
+ // anonymous class, not a member
+ new T { }
+
+ // anonymous function, not a member
+ (() => 1)
+
+ def f = {
+ class E
+ trait F
+ object G
+ new T { }
+ (() => 2)
+
+ if (new Object().hashCode == 1) {
+ class H
+ trait I
+ object J
+ new T { }
+ (() => 3)
+ } else {
+ ()
+ }
+ }
+
+ {
+ class K
+ trait L
+ object M
+ new T { }
+ (() => 4)
+ }
+
+ val x = {
+ class N
+ trait O
+ object P
+ new T { }
+ (() => 5)
+ }
+
+ def this(x: Int) {
+ this()
+ class Q
+ trait R
+ object S
+ new T { }
+ (() => () => 5)
+ }
+}
+
+object AO {
+ class B
+ trait C
+ object D
+ new T { }
+ (() => 1)
+}
+
+trait AT {
+ class B
+ trait C
+ object D
+ new T { }
+ (() => 1)
+}
diff --git a/test/files/jvm/javaReflection/Test.scala b/test/files/jvm/javaReflection/Test.scala
new file mode 100644
index 0000000000..5b6ef1b573
--- /dev/null
+++ b/test/files/jvm/javaReflection/Test.scala
@@ -0,0 +1,137 @@
+/**
+Interesting aspects of Java reflection applied to scala classes. TL;DR: you should not use
+getSimpleName / getCanonicalName / isAnonymousClass / isLocalClass / isSynthetic.
+
+ - Some methods in Java reflection assume a certain structure in the class names. Scalac
+ can produce class files that don't respect this structure. Certain methods in reflection
+ therefore give surprising answers or may even throw an exception.
+
+ In particular, the method "getSimpleName" assumes that classes are named after the Java spec
+ http://docs.oracle.com/javase/specs/jls/se8/html/jls-13.html#jls-13.1
+
+ Consider the following Scala example:
+ class A { object B { class C } }
+
+ The classfile for C has the name "A$B$C", while the classfile for the module B has the
+ name "A$B$".
+
+ For "cClass.getSimpleName, the implementation first strips the name of the enclosing class,
+ which produces "C". The implementation then expects a "$" character, which is missing, and
+ throws an InternalError.
+
+ Consider another example:
+ trait T
+ class A { val x = new T {} }
+ object B { val x = new T {} }
+
+ The anonymous classes are named "A$$anon$1" and "B$$anon$2". If you call "getSimpleName",
+ you get "$anon$1" (leading $) and "anon$2" (no leading $).
+
+ - There are certain other methods in the Java reflection API that depend on getSimpleName.
+ These should be avoided, they yield unexpected results:
+
+ - isAnonymousClass is always false. Scala-defined classes are never anonymous for Java
+ reflection. Java reflection insepects the class name to decide whether a class is
+ anonymous, based on the name spec referenced above.
+ Also, the implementation of "isAnonymousClass" calls "getSimpleName", which may throw.
+
+ - isLocalClass: should be true true for local classes (nested classes that are not
+ members), but not for anonymous classes. Since "isAnonymousClass" is always false,
+ Java reflection thinks that all Scala-defined anonymous classes are local.
+ The implementation may also throw, since it uses "isAnonymousClass":
+ class A { object B { def f = { class KB; new KB } } }
+ (new A).B.f.getClass.isLocalClass // boom
+
+ - getCanonicalName: uses "getSimpleName" in the implementation. In the first example,
+ cClass.getCanonicalName also fails with an InternalError.
+
+ - Scala-defined classes are never synthetic for Java reflection. The implementation
+ checks for the SYNTHETEIC flag, which does not seem to be added by scalac (maybe this
+ will change some day).
+*/
+
+object Test {
+
+ def tr[T](m: => T): String = try {
+ val r = m
+ if (r == null) "null"
+ else r.toString
+ } catch { case e: InternalError => e.getMessage }
+
+ def assertNotAnonymous(c: Class[_]) = {
+ val an = try {
+ c.isAnonymousClass
+ } catch {
+ // isAnonymousClass is implemented using getSimpleName, which may throw.
+ case e: InternalError => false
+ }
+ assert(!an, c)
+ }
+
+ def ruleMemberOrLocal(c: Class[_]) = {
+ // if it throws, then it's because of the call from isLocalClass to isAnonymousClass.
+ // we know that isAnonymousClass is always false, so it has to be a local class.
+ val loc = try { c.isLocalClass } catch { case e: InternalError => true }
+ if (loc)
+ assert(!c.isMemberClass, c)
+ if (c.isMemberClass)
+ assert(!loc, c)
+ }
+
+ def ruleMemberDeclaring(c: Class[_]) = {
+ if (c.isMemberClass)
+ assert(c.getDeclaringClass.getDeclaredClasses.toList.map(_.getName) contains c.getName)
+ }
+
+ def ruleScalaAnonClassIsLocal(c: Class[_]) = {
+ if (c.getName contains "$anon$")
+ assert(c.isLocalClass, c)
+ }
+
+ def ruleScalaAnonFunInlineIsLocal(c: Class[_]) = {
+ // exclude lambda classes generated by delambdafy:method. nested closures have both "anonfun" and "lambda".
+ if (c.getName.contains("$anonfun$") && !c.getName.contains("$lambda$"))
+ assert(c.isLocalClass, c)
+ }
+
+ def ruleScalaAnonFunMethodIsToplevel(c: Class[_]) = {
+ if (c.getName.contains("$lambda$"))
+ assert(c.getEnclosingClass == null, c)
+ }
+
+ def showClass(name: String) = {
+ val c = Class.forName(name)
+
+ println(s"${c.getName} / ${tr(c.getCanonicalName)} (canon) / ${tr(c.getSimpleName)} (simple)")
+ println( "- declared cls: "+ c.getDeclaredClasses.toList.sortBy(_.getName))
+ println(s"- enclosing : ${c.getDeclaringClass} (declaring cls) / ${c.getEnclosingClass} (cls) / ${c.getEnclosingConstructor} (constr) / ${c.getEnclosingMethod} (meth)")
+ println(s"- properties : ${tr(c.isLocalClass)} (local) / ${c.isMemberClass} (member)")
+
+ assertNotAnonymous(c)
+ assert(!c.isSynthetic, c)
+
+ ruleMemberOrLocal(c)
+ ruleMemberDeclaring(c)
+ ruleScalaAnonClassIsLocal(c)
+ ruleScalaAnonFunInlineIsLocal(c)
+ ruleScalaAnonFunMethodIsToplevel(c)
+ }
+
+ def main(args: Array[String]): Unit = {
+ def isAnonFunClassName(s: String) = s.contains("$anonfun$") || s.contains("$lambda$")
+
+ val classfiles = new java.io.File(sys.props("partest.output")).listFiles().toList.map(_.getName).collect({
+ // exclude files from Test.scala, just take those from Classes_1.scala
+ case s if !s.startsWith("Test") && s.endsWith(".class") => s.substring(0, s.length - 6)
+ }).sortWith((a, b) => {
+ // sort such that first there are all anonymous funcitions, then all other classes.
+ // within those cathegories, sort lexically.
+ // this makes the check file smaller: it differs for anonymous functions between -Ydelambdafy:inline/method.
+ // the other classes are the same.
+ if (isAnonFunClassName(a)) !isAnonFunClassName(b) || a < b
+ else !isAnonFunClassName(b) && a < b
+ })
+
+ classfiles foreach showClass
+ }
+} \ No newline at end of file
diff --git a/test/files/jvm/throws-annot-from-java.check b/test/files/jvm/throws-annot-from-java.check
index be3ba412f8..c541b26fcc 100644
--- a/test/files/jvm/throws-annot-from-java.check
+++ b/test/files/jvm/throws-annot-from-java.check
@@ -44,4 +44,4 @@ bar
tp.typeParams.isEmpty: true
throws[test.PolymorphicException[_]](classOf[test.PolymorphicException])
-scala>
+scala> :quit
diff --git a/test/files/jvm/varargs.check b/test/files/jvm/varargs.check
index 8379befe93..986f98896a 100644
--- a/test/files/jvm/varargs.check
+++ b/test/files/jvm/varargs.check
@@ -1,3 +1,4 @@
7
10
-19 \ No newline at end of file
+19
+a
diff --git a/test/files/jvm/varargs/JavaClass.java b/test/files/jvm/varargs/JavaClass.java
index 9851e1b78b..6928ee5adc 100644
--- a/test/files/jvm/varargs/JavaClass.java
+++ b/test/files/jvm/varargs/JavaClass.java
@@ -11,5 +11,6 @@ public class JavaClass {
va.vi(1, 2, 3, 4);
varargz(5, 1.0, 2.0, 3.0);
va.vt(16, "", "", "");
+ System.out.println(va.vt1(16, "a", "b", "c"));
}
} \ No newline at end of file
diff --git a/test/files/jvm/varargs/VaClass.scala b/test/files/jvm/varargs/VaClass.scala
index 6343f9c6f6..e94e8a625a 100644
--- a/test/files/jvm/varargs/VaClass.scala
+++ b/test/files/jvm/varargs/VaClass.scala
@@ -9,5 +9,5 @@ class VaClass {
@varargs def vs(a: Int, b: String*) = println(a + b.length)
@varargs def vi(a: Int, b: Int*) = println(a + b.sum)
@varargs def vt[T](a: Int, b: T*) = println(a + b.length)
-
+ @varargs def vt1[T](a: Int, b: T*): T = b.head
}
diff --git a/test/files/jvm/xml05.check b/test/files/jvm/xml05.check
index 92ea995350..cad907525d 100644
--- a/test/files/jvm/xml05.check
+++ b/test/files/jvm/xml05.check
@@ -4,4 +4,4 @@ Type :help for more information.
scala> <city name="San Jos&eacute;"/>
res0: scala.xml.Elem = <city name="San Jos&eacute;"/>
-scala>
+scala> :quit
diff --git a/test/files/neg/forgot-interpolator.check b/test/files/neg/forgot-interpolator.check
index 8988458982..8e75350518 100644
--- a/test/files/neg/forgot-interpolator.check
+++ b/test/files/neg/forgot-interpolator.check
@@ -1,25 +1,25 @@
-forgot-interpolator.scala:4: warning: `$bippy` looks like an interpolated identifier! Did you forget the interpolator?
+forgot-interpolator.scala:4: warning: possible missing interpolator: detected interpolated identifier `$bippy`
def f = "Put the $bippy in the $bippy!" // warn 1
^
-forgot-interpolator.scala:14: warning: That looks like an interpolated expression! Did you forget the interpolator?
+forgot-interpolator.scala:14: warning: possible missing interpolator: detected an interpolated expression
def f = """Put the ${println("bippy")} in the bippy!""" // warn 2
^
-forgot-interpolator.scala:30: warning: `$beppo` looks like an interpolated identifier! Did you forget the interpolator?
+forgot-interpolator.scala:30: warning: possible missing interpolator: detected interpolated identifier `$beppo`
def f = "$beppo was a marx bros who saw dollars." // warn 3
^
-forgot-interpolator.scala:34: warning: `$aleppo` looks like an interpolated identifier! Did you forget the interpolator?
+forgot-interpolator.scala:34: warning: possible missing interpolator: detected interpolated identifier `$aleppo`
def f = "$aleppo is a pepper and a city." // warn 4
^
-forgot-interpolator.scala:47: warning: `$hippo` looks like an interpolated identifier! Did you forget the interpolator?
+forgot-interpolator.scala:47: warning: possible missing interpolator: detected interpolated identifier `$hippo`
def h = "$hippo takes an implicit" // warn 6
^
-forgot-interpolator.scala:88: warning: `$groucho` looks like an interpolated identifier! Did you forget the interpolator?
+forgot-interpolator.scala:88: warning: possible missing interpolator: detected interpolated identifier `$groucho`
def f2 = "I salute $groucho" // warn 7
^
-forgot-interpolator.scala:89: warning: `$dingo` looks like an interpolated identifier! Did you forget the interpolator?
+forgot-interpolator.scala:89: warning: possible missing interpolator: detected interpolated identifier `$dingo`
def f3 = "I even salute $dingo" // warn 8
^
-forgot-interpolator.scala:90: warning: `$calico` looks like an interpolated identifier! Did you forget the interpolator?
+forgot-interpolator.scala:90: warning: possible missing interpolator: detected interpolated identifier `$calico`
def f4 = "I also salute $calico" // warn 9
^
error: No warnings can be incurred under -Xfatal-warnings.
diff --git a/test/files/neg/forgot-interpolator.scala b/test/files/neg/forgot-interpolator.scala
index a53054d890..ca1ac30821 100644
--- a/test/files/neg/forgot-interpolator.scala
+++ b/test/files/neg/forgot-interpolator.scala
@@ -54,8 +54,8 @@ package test {
}
}
import annotation._
- @implicitNotFound("No Z in ${A}") // no warn
- class Z[A]
+ @implicitNotFound("No Z in ${T}") // no warn
+ class Z[T]
}
diff --git a/test/files/neg/macro-basic-mamdmi.check b/test/files/neg/macro-basic-mamdmi.check
index 61df5131cc..54743d4936 100644
--- a/test/files/neg/macro-basic-mamdmi.check
+++ b/test/files/neg/macro-basic-mamdmi.check
@@ -1,5 +1,13 @@
+Impls_Macros_Test_1.scala:33: error: macro implementation not found: foo
+(the most common reason for that is that you cannot use macro implementations in the same compilation run that defines them)
+ println(foo(2) + Macros.bar(2) * new Macros().quux(4))
+ ^
+Impls_Macros_Test_1.scala:33: error: macro implementation not found: bar
+(the most common reason for that is that you cannot use macro implementations in the same compilation run that defines them)
+ println(foo(2) + Macros.bar(2) * new Macros().quux(4))
+ ^
Impls_Macros_Test_1.scala:33: error: macro implementation not found: quux
(the most common reason for that is that you cannot use macro implementations in the same compilation run that defines them)
println(foo(2) + Macros.bar(2) * new Macros().quux(4))
^
-one error found
+three errors found
diff --git a/test/files/neg/t3909.check b/test/files/neg/t3909.check
index 7da0195607..052b49f855 100644
--- a/test/files/neg/t3909.check
+++ b/test/files/neg/t3909.check
@@ -1,4 +1,5 @@
t3909.scala:1: error: in object DO, multiple overloaded alternatives of m1 define default arguments
+Error occurred in an application involving default arguments.
object DO {
^
one error found
diff --git a/test/files/neg/t4851.check b/test/files/neg/t4851.check
index 132dd91b50..d5711a889b 100644
--- a/test/files/neg/t4851.check
+++ b/test/files/neg/t4851.check
@@ -29,13 +29,13 @@ S.scala:7: warning: Adapting argument list by creating a 3-tuple: this may not b
val y2 = new Some(1, 2, 3)
^
S.scala:9: warning: Adaptation of argument list by inserting () has been deprecated: this is unlikely to be what you want.
- signature: J2[T](x: T): J2[T]
+ signature: J2(x: T): J2[T]
given arguments: <none>
after adaptation: new J2((): Unit)
val z1 = new J2
^
S.scala:10: warning: Adaptation of argument list by inserting () has been deprecated: this is unlikely to be what you want.
- signature: J2[T](x: T): J2[T]
+ signature: J2(x: T): J2[T]
given arguments: <none>
after adaptation: new J2((): Unit)
val z2 = new J2()
diff --git a/test/files/neg/t4851.flags b/test/files/neg/t4851.flags
index ca0d0a0ba3..044ce22c84 100644
--- a/test/files/neg/t4851.flags
+++ b/test/files/neg/t4851.flags
@@ -1 +1 @@
--Ywarn-adapted-args -Xfatal-warnings -deprecation
+-Xlint:adapted-args -Xfatal-warnings -deprecation
diff --git a/test/files/neg/t4851/J2.java b/test/files/neg/t4851/J2.java
index 82954d9489..a90f48e269 100644
--- a/test/files/neg/t4851/J2.java
+++ b/test/files/neg/t4851/J2.java
@@ -1,11 +1,11 @@
public class J2<T> {
T x;
- public <T> J(T x) {
+ public J2(T x) {
this.x = x;
}
public String toString() {
return "J2:" + x.getClass();
}
-} \ No newline at end of file
+}
diff --git a/test/files/neg/t5148.check b/test/files/neg/t5148.check
index 8a667f4b88..0de4fe2d4c 100644
--- a/test/files/neg/t5148.check
+++ b/test/files/neg/t5148.check
@@ -1,5 +1,6 @@
-error: bad symbolic reference to scala.tools.nsc.interpreter.IMain.Request encountered in class file 'Imports.class'.
-Cannot access type Request in class scala.tools.nsc.interpreter.IMain. The current classpath may be
-missing a definition for scala.tools.nsc.interpreter.IMain.Request, or Imports.class may have been compiled against a version that's
-incompatible with the one found on the current classpath.
+error: missing or invalid dependency detected while loading class file 'Imports.class'.
+Could not access type Request in class scala.tools.nsc.interpreter.IMain,
+because it (or its dependencies) are missing. Check your build definition for
+missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
+A full rebuild may help if 'Imports.class' was compiled against an incompatible version of scala.tools.nsc.interpreter.IMain.
one error found
diff --git a/test/files/neg/t5691.check b/test/files/neg/t5691.check
new file mode 100644
index 0000000000..a51ca98a10
--- /dev/null
+++ b/test/files/neg/t5691.check
@@ -0,0 +1,24 @@
+t5691.scala:7: warning: type parameter D defined in method foobar shadows trait D defined in class B. You may want to rename your type parameter, or possibly remove it.
+ def foobar[D](in: D) = in.toString
+ ^
+t5691.scala:10: warning: type parameter D defined in type MySeq shadows trait D defined in class B. You may want to rename your type parameter, or possibly remove it.
+ type MySeq[D] = Seq[D]
+ ^
+t5691.scala:15: warning: type parameter T defined in method bar shadows type T defined in class Foo. You may want to rename your type parameter, or possibly remove it.
+ def bar[T](w: T) = w.toString
+ ^
+t5691.scala:13: warning: type parameter T defined in class Foo shadows type T defined in class B. You may want to rename your type parameter, or possibly remove it.
+ class Foo[T](t: T) {
+ ^
+t5691.scala:19: warning: type parameter List defined in type M shadows type List defined in package object scala. You may want to rename your type parameter, or possibly remove it.
+ class C[M[List[_]]]
+ ^
+t5691.scala:20: warning: type parameter List defined in type M shadows type List defined in package object scala. You may want to rename your type parameter, or possibly remove it.
+ type E[M[List[_]]] = Int
+ ^
+t5691.scala:21: warning: type parameter List defined in type M shadows type List defined in package object scala. You may want to rename your type parameter, or possibly remove it.
+ def foo[N[M[List[_]]]] = ???
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+7 warnings found
+one error found
diff --git a/test/files/neg/t5691.flags b/test/files/neg/t5691.flags
new file mode 100644
index 0000000000..0e09b8575b
--- /dev/null
+++ b/test/files/neg/t5691.flags
@@ -0,0 +1 @@
+-Xlint:type-parameter-shadow -language:higherKinds -Xfatal-warnings
diff --git a/test/files/neg/t5691.scala b/test/files/neg/t5691.scala
new file mode 100644
index 0000000000..e6a9bdc16a
--- /dev/null
+++ b/test/files/neg/t5691.scala
@@ -0,0 +1,27 @@
+class B {
+
+ type T = Int
+ trait D
+
+ // method parameter shadows some other type
+ def foobar[D](in: D) = in.toString
+
+ // type member's parameter shadows some other type
+ type MySeq[D] = Seq[D]
+
+ // class parameter shadows some other type
+ class Foo[T](t: T) {
+ // a type parameter shadows another type parameter
+ def bar[T](w: T) = w.toString
+ }
+
+ // even deeply nested...
+ class C[M[List[_]]]
+ type E[M[List[_]]] = Int
+ def foo[N[M[List[_]]]] = ???
+
+ // ...but not between type parameters in the same list
+ class F[A, M[L[A]]] // no warning!
+ type G[A, M[L[A]]] = Int // no warning!
+ def bar[A, N[M[L[A]]]] = ??? // no warning!
+}
diff --git a/test/files/neg/t6675b.scala b/test/files/neg/t6675b.scala
index c86c9c3955..da27e1b91f 100644
--- a/test/files/neg/t6675b.scala
+++ b/test/files/neg/t6675b.scala
@@ -13,7 +13,7 @@ object NativelyTwo {
}
-class A {
+class E {
def f1 = (Left((0, 0)): Either[(Int, Int), (Int, Int)]) match { case LeftOrRight(a) => a } // warn
def f2 = (Left((0, 0)): Either[(Int, Int), (Int, Int)]) match { case LeftOrRight((a, b)) => a } // no warn
def f3 = (Left((0, 0)): Either[(Int, Int), (Int, Int)]) match { case LeftOrRight((a, b, c)) => a } // fail
diff --git a/test/files/neg/t7848-interp-warn.check b/test/files/neg/t7848-interp-warn.check
index b7df6d8ce2..4cf9d55ffd 100644
--- a/test/files/neg/t7848-interp-warn.check
+++ b/test/files/neg/t7848-interp-warn.check
@@ -1,10 +1,10 @@
-t7848-interp-warn.scala:8: warning: `$foo` looks like an interpolated identifier! Did you forget the interpolator?
+t7848-interp-warn.scala:8: warning: possible missing interpolator: detected interpolated identifier `$foo`
"An important $foo message!"
^
-t7848-interp-warn.scala:12: warning: That looks like an interpolated expression! Did you forget the interpolator?
+t7848-interp-warn.scala:12: warning: possible missing interpolator: detected an interpolated expression
"A doubly important ${foo * 2} message!"
^
-t7848-interp-warn.scala:16: warning: `$bar` looks like an interpolated identifier! Did you forget the interpolator?
+t7848-interp-warn.scala:16: warning: possible missing interpolator: detected interpolated identifier `$bar`
def j = s"Try using '${ "something like $bar" }' instead." // warn
^
error: No warnings can be incurred under -Xfatal-warnings.
diff --git a/test/files/neg/t7848-interp-warn.flags b/test/files/neg/t7848-interp-warn.flags
index 7949c2afa2..b0d7bc25cb 100644
--- a/test/files/neg/t7848-interp-warn.flags
+++ b/test/files/neg/t7848-interp-warn.flags
@@ -1 +1 @@
--Xlint -Xfatal-warnings
+-Xlint:missing-interpolator -Xfatal-warnings
diff --git a/test/files/neg/t8035-no-adapted-args.check b/test/files/neg/t8035-no-adapted-args.check
new file mode 100644
index 0000000000..43637b2c1f
--- /dev/null
+++ b/test/files/neg/t8035-no-adapted-args.check
@@ -0,0 +1,21 @@
+t8035-no-adapted-args.scala:4: warning: No automatic adaptation here: use explicit parentheses.
+ signature: Test.f[T](x: T): Int
+ given arguments: 1, 2, 3
+ after adaptation: Test.f((1, 2, 3): (Int, Int, Int))
+ f(1, 2, 3)
+ ^
+t8035-no-adapted-args.scala:4: error: too many arguments for method f: (x: (Int, Int, Int))Int
+ f(1, 2, 3)
+ ^
+t8035-no-adapted-args.scala:5: warning: No automatic adaptation here: use explicit parentheses.
+ signature: Test.f[T](x: T): Int
+ given arguments: <none>
+ after adaptation: Test.f((): Unit)
+ f()
+ ^
+t8035-no-adapted-args.scala:5: error: not enough arguments for method f: (x: Unit)Int.
+Unspecified value parameter x.
+ f()
+ ^
+two warnings found
+two errors found
diff --git a/test/files/neg/t8035-no-adapted-args.flags b/test/files/neg/t8035-no-adapted-args.flags
new file mode 100644
index 0000000000..b3e8c505e2
--- /dev/null
+++ b/test/files/neg/t8035-no-adapted-args.flags
@@ -0,0 +1 @@
+-Yno-adapted-args \ No newline at end of file
diff --git a/test/files/neg/t8035-no-adapted-args.scala b/test/files/neg/t8035-no-adapted-args.scala
new file mode 100644
index 0000000000..82690ebe94
--- /dev/null
+++ b/test/files/neg/t8035-no-adapted-args.scala
@@ -0,0 +1,6 @@
+object Test {
+ def f[T](x: T) = 0
+
+ f(1, 2, 3)
+ f()
+}
diff --git a/test/files/neg/t8266-invalid-interp.check b/test/files/neg/t8266-invalid-interp.check
index 70dd4081b0..bb2d44a80c 100644
--- a/test/files/neg/t8266-invalid-interp.check
+++ b/test/files/neg/t8266-invalid-interp.check
@@ -1,10 +1,10 @@
t8266-invalid-interp.scala:4: error: Trailing '\' escapes nothing.
f"a\",
^
-t8266-invalid-interp.scala:5: error: invalid escape character at index 1 in "a\xc"
+t8266-invalid-interp.scala:5: error: invalid escape '\x' not one of [\b, \t, \n, \f, \r, \\, \", \'] at index 1 in "a\xc". Use \\ for literal \.
f"a\xc",
^
-t8266-invalid-interp.scala:7: error: invalid escape character at index 1 in "a\vc"
+t8266-invalid-interp.scala:7: error: invalid escape '\v' not one of [\b, \t, \n, \f, \r, \\, \", \'] at index 1 in "a\vc". Use \\ for literal \.
f"a\vc"
^
three errors found
diff --git a/test/files/neg/t8525.check b/test/files/neg/t8525.check
new file mode 100644
index 0000000000..5287e43b7a
--- /dev/null
+++ b/test/files/neg/t8525.check
@@ -0,0 +1,15 @@
+t8525.scala:7: warning: Adapting argument list by creating a 2-tuple: this may not be what you want.
+ signature: X.f(p: (Int, Int)): Int
+ given arguments: 3, 4
+ after adaptation: X.f((3, 4): (Int, Int))
+ def g = f(3, 4) // adapted
+ ^
+t8525.scala:9: warning: private[this] value name in class X shadows mutable name inherited from class Named. Changes to name will not be visible within class X - you may want to give them distinct names.
+ override def toString = name // shadowing mutable var name
+ ^
+t8525.scala:8: warning: side-effecting nullary methods are discouraged: suggest defining as `def u()` instead
+ def u: Unit = () // unitarian universalist
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+three warnings found
+one error found
diff --git a/test/files/neg/t8525.flags b/test/files/neg/t8525.flags
new file mode 100644
index 0000000000..53b2dfe7ec
--- /dev/null
+++ b/test/files/neg/t8525.flags
@@ -0,0 +1 @@
+-Xfatal-warnings -Xlint:-missing-interpolator -Xlint
diff --git a/test/files/neg/t8525.scala b/test/files/neg/t8525.scala
new file mode 100644
index 0000000000..7bed04904f
--- /dev/null
+++ b/test/files/neg/t8525.scala
@@ -0,0 +1,10 @@
+
+class Named(var name: String)
+
+class X(name: String) extends Named(name) {
+ def x = "Hi, $name" // missing interp
+ def f(p: (Int, Int)): Int = p._1 * p._2
+ def g = f(3, 4) // adapted
+ def u: Unit = () // unitarian universalist
+ override def toString = name // shadowing mutable var name
+}
diff --git a/test/files/neg/t8610-arg.check b/test/files/neg/t8610-arg.check
new file mode 100644
index 0000000000..d6fe207119
--- /dev/null
+++ b/test/files/neg/t8610-arg.check
@@ -0,0 +1,6 @@
+t8610-arg.scala:8: warning: side-effecting nullary methods are discouraged: suggest defining as `def u()` instead
+ def u: Unit = () // unitarian universalist
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/test/files/neg/t8610-arg.flags b/test/files/neg/t8610-arg.flags
new file mode 100644
index 0000000000..f331ba9383
--- /dev/null
+++ b/test/files/neg/t8610-arg.flags
@@ -0,0 +1 @@
+-Xfatal-warnings -Xlint nullary-unit
diff --git a/test/files/neg/t8610-arg.scala b/test/files/neg/t8610-arg.scala
new file mode 100644
index 0000000000..7bed04904f
--- /dev/null
+++ b/test/files/neg/t8610-arg.scala
@@ -0,0 +1,10 @@
+
+class Named(var name: String)
+
+class X(name: String) extends Named(name) {
+ def x = "Hi, $name" // missing interp
+ def f(p: (Int, Int)): Int = p._1 * p._2
+ def g = f(3, 4) // adapted
+ def u: Unit = () // unitarian universalist
+ override def toString = name // shadowing mutable var name
+}
diff --git a/test/files/neg/t8610.check b/test/files/neg/t8610.check
new file mode 100644
index 0000000000..334a947549
--- /dev/null
+++ b/test/files/neg/t8610.check
@@ -0,0 +1,18 @@
+t8610.scala:5: warning: possible missing interpolator: detected interpolated identifier `$name`
+ def x = "Hi, $name" // missing interp
+ ^
+t8610.scala:7: warning: Adapting argument list by creating a 2-tuple: this may not be what you want.
+ signature: X.f(p: (Int, Int)): Int
+ given arguments: 3, 4
+ after adaptation: X.f((3, 4): (Int, Int))
+ def g = f(3, 4) // adapted
+ ^
+t8610.scala:9: warning: private[this] value name in class X shadows mutable name inherited from class Named. Changes to name will not be visible within class X - you may want to give them distinct names.
+ override def toString = name // shadowing mutable var name
+ ^
+t8610.scala:8: warning: side-effecting nullary methods are discouraged: suggest defining as `def u()` instead
+ def u: Unit = () // unitarian universalist
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+four warnings found
+one error found
diff --git a/test/files/neg/t8610.flags b/test/files/neg/t8610.flags
new file mode 100644
index 0000000000..954eaba352
--- /dev/null
+++ b/test/files/neg/t8610.flags
@@ -0,0 +1 @@
+-Xfatal-warnings -Xlint
diff --git a/test/files/neg/t8610.scala b/test/files/neg/t8610.scala
new file mode 100644
index 0000000000..7bed04904f
--- /dev/null
+++ b/test/files/neg/t8610.scala
@@ -0,0 +1,10 @@
+
+class Named(var name: String)
+
+class X(name: String) extends Named(name) {
+ def x = "Hi, $name" // missing interp
+ def f(p: (Int, Int)): Int = p._1 * p._2
+ def g = f(3, 4) // adapted
+ def u: Unit = () // unitarian universalist
+ override def toString = name // shadowing mutable var name
+}
diff --git a/test/files/neg/t8736-c.check b/test/files/neg/t8736-c.check
new file mode 100644
index 0000000000..06b2228543
--- /dev/null
+++ b/test/files/neg/t8736-c.check
@@ -0,0 +1,11 @@
+t8736-c.scala:4: warning: higher-kinded type should be enabled
+by making the implicit value scala.language.higherKinds visible.
+This can be achieved by adding the import clause 'import scala.language.higherKinds'
+or by setting the compiler option -language:higherKinds.
+See the Scala docs for value scala.language.higherKinds for a discussion
+why the feature should be explicitly enabled.
+ def hk[M[_]] = ???
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/test/files/neg/t8736-c.flags b/test/files/neg/t8736-c.flags
new file mode 100644
index 0000000000..fde5313c96
--- /dev/null
+++ b/test/files/neg/t8736-c.flags
@@ -0,0 +1 @@
+-feature -language:-higherKinds,_ -Xfatal-warnings
diff --git a/test/files/neg/t8736-c.scala b/test/files/neg/t8736-c.scala
new file mode 100644
index 0000000000..8432775ae1
--- /dev/null
+++ b/test/files/neg/t8736-c.scala
@@ -0,0 +1,7 @@
+// scalac: -feature -language:-higherKinds,_ -Xfatal-warnings
+// showing that wildcard doesn't supersede explicit disablement
+class X {
+ def hk[M[_]] = ???
+
+ implicit def imp(x: X): Int = x.hashCode
+}
diff --git a/test/files/neg/warn-inferred-any.flags b/test/files/neg/warn-inferred-any.flags
index a3127d392a..b580dfbbe3 100644
--- a/test/files/neg/warn-inferred-any.flags
+++ b/test/files/neg/warn-inferred-any.flags
@@ -1 +1 @@
--Xfatal-warnings -Ywarn-infer-any
+-Xfatal-warnings -Xlint:infer-any
diff --git a/test/files/pos/macro-attachments/Macros_1.scala b/test/files/pos/macro-attachments/Macros_1.scala
new file mode 100644
index 0000000000..38d05d5b85
--- /dev/null
+++ b/test/files/pos/macro-attachments/Macros_1.scala
@@ -0,0 +1,19 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.whitebox.Context
+
+trait Base
+class Att extends Base
+
+object Macros {
+ def impl(c: Context) = {
+ import c.universe._
+ import c.internal._
+ import decorators._
+ val dummy = q"x"
+ dummy.updateAttachment(new Att)
+ if (dummy.attachments.get[Base].isEmpty) c.abort(c.enclosingPosition, "that's not good")
+ q"()"
+ }
+
+ def foo: Any = macro impl
+} \ No newline at end of file
diff --git a/test/files/pos/macro-attachments/Test_2.scala b/test/files/pos/macro-attachments/Test_2.scala
new file mode 100644
index 0000000000..acfddae942
--- /dev/null
+++ b/test/files/pos/macro-attachments/Test_2.scala
@@ -0,0 +1,3 @@
+object Test extends App {
+ Macros.foo
+} \ No newline at end of file
diff --git a/test/files/pos/t8013.flags b/test/files/pos/t8013.flags
index 954eaba352..3955bb6710 100644
--- a/test/files/pos/t8013.flags
+++ b/test/files/pos/t8013.flags
@@ -1 +1 @@
--Xfatal-warnings -Xlint
+-Xfatal-warnings -Xlint:-infer-any,_
diff --git a/test/files/pos/t8736-b.flags b/test/files/pos/t8736-b.flags
new file mode 100644
index 0000000000..1ad4eabe0f
--- /dev/null
+++ b/test/files/pos/t8736-b.flags
@@ -0,0 +1 @@
+-feature -language:_ -Xfatal-warnings
diff --git a/test/files/pos/t8736-b.scala b/test/files/pos/t8736-b.scala
new file mode 100644
index 0000000000..903292d232
--- /dev/null
+++ b/test/files/pos/t8736-b.scala
@@ -0,0 +1,7 @@
+// scalac: -feature -language:_ -Xfatal-warnings
+// showing that all are set
+class X {
+ def hk[M[_]] = ???
+
+ implicit def imp(x: X): Int = x.hashCode
+}
diff --git a/test/files/pos/t8736.flags b/test/files/pos/t8736.flags
new file mode 100644
index 0000000000..7fe42f7340
--- /dev/null
+++ b/test/files/pos/t8736.flags
@@ -0,0 +1 @@
+-feature -language:implicitConversions -language:higherKinds -language:-implicitConversions -Xfatal-warnings
diff --git a/test/files/pos/t8736.scala b/test/files/pos/t8736.scala
new file mode 100644
index 0000000000..46c0cdfd00
--- /dev/null
+++ b/test/files/pos/t8736.scala
@@ -0,0 +1,7 @@
+// scalac: -feature -language:implicitConversions -language:higherKinds -language:-implicitConversions -Xfatal-warnings
+// showing that multiple settings are respected, and explicit enablement has precedence
+class X {
+ def hk[M[_]] = ???
+
+ implicit def imp(x: X): Int = x.hashCode
+}
diff --git a/test/files/pos/t8743.scala b/test/files/pos/t8743.scala
new file mode 100644
index 0000000000..03b0cd7044
--- /dev/null
+++ b/test/files/pos/t8743.scala
@@ -0,0 +1,15 @@
+import annotation.varargs
+
+object VarArgs {
+ @varargs
+ def foo[A](x: A, xs: String*): A = ???
+
+ @varargs
+ def bar[A](x: List[A], xs: String*): A = ???
+
+ @varargs
+ def baz[A](x: List[A], xs: String*): A = ???
+
+ @varargs
+ def boz[A](x: A, xs: String*): Nothing = ???
+}
diff --git a/test/files/pos/t8781/Macro_1.scala b/test/files/pos/t8781/Macro_1.scala
new file mode 100644
index 0000000000..ecd9c5e8d5
--- /dev/null
+++ b/test/files/pos/t8781/Macro_1.scala
@@ -0,0 +1,13 @@
+import scala.reflect.macros.whitebox.Context
+import language.experimental.macros
+
+object Macros {
+ def impl(c: Context) = {
+ import c.universe._
+ val name = TypeName(c.freshName())
+ q"class $name extends T; new $name"
+ }
+ def fresh: Any = macro impl
+}
+
+trait T
diff --git a/test/files/pos/t8781/Test_2.flags b/test/files/pos/t8781/Test_2.flags
new file mode 100644
index 0000000000..24e2109690
--- /dev/null
+++ b/test/files/pos/t8781/Test_2.flags
@@ -0,0 +1 @@
+-Ymacro-expand:discard -Ystop-after:typer
diff --git a/test/files/pos/t8781/Test_2.scala b/test/files/pos/t8781/Test_2.scala
new file mode 100644
index 0000000000..3ca6406599
--- /dev/null
+++ b/test/files/pos/t8781/Test_2.scala
@@ -0,0 +1,5 @@
+object Test {
+ implicit class RichT(t: T) { def augmented = "" }
+
+ Macros.fresh.augmented
+}
diff --git a/test/files/pos/t8793.scala b/test/files/pos/t8793.scala
new file mode 100644
index 0000000000..1276155675
--- /dev/null
+++ b/test/files/pos/t8793.scala
@@ -0,0 +1,15 @@
+package regr
+
+trait F[A]
+
+class G(val a: F[_], val b: F[_])
+
+object G {
+ def unapply(g: G) = Option((g.a, g.b))
+}
+
+object H {
+ def unapply(g: G) = g match {
+ case G(a, _) => Option(a)
+ }
+}
diff --git a/test/files/pos/t8828.flags b/test/files/pos/t8828.flags
new file mode 100644
index 0000000000..e68991f643
--- /dev/null
+++ b/test/files/pos/t8828.flags
@@ -0,0 +1 @@
+-Xlint:inaccessible -Xfatal-warnings
diff --git a/test/files/pos/t8828.scala b/test/files/pos/t8828.scala
new file mode 100644
index 0000000000..92092b4dd4
--- /dev/null
+++ b/test/files/pos/t8828.scala
@@ -0,0 +1,20 @@
+
+package outer
+
+package inner {
+
+ private[inner] class A
+
+ // the class is final: no warning
+ private[outer] final class B {
+ def doWork(a: A): A = a
+ }
+
+ // the trait is sealed and doWork is not
+ // and cannot be overriden: no warning
+ private[outer] sealed trait C {
+ def doWork(a: A): A = a
+ }
+
+ private[outer] final class D extends C
+}
diff --git a/test/files/run/abstypetags_serialize.check b/test/files/run/abstypetags_serialize.check
index bddc4523e6..1b5e2ebddf 100644
--- a/test/files/run/abstypetags_serialize.check
+++ b/test/files/run/abstypetags_serialize.check
@@ -1,2 +1,2 @@
-java.io.NotSerializableException: Test$$typecreator1$1
-java.io.NotSerializableException: Test$$typecreator2$1
+WeakTypeTag[T]
+WeakTypeTag[U[String]]
diff --git a/test/files/run/class-symbol-contravariant.check b/test/files/run/class-symbol-contravariant.check
index 987f215bca..cbb90b52c2 100644
--- a/test/files/run/class-symbol-contravariant.check
+++ b/test/files/run/class-symbol-contravariant.check
@@ -33,4 +33,4 @@ res2: Boolean = true
scala> sym.isContravariant // was true
res3: Boolean = false
-scala>
+scala> :quit
diff --git a/test/files/run/constant-type.check b/test/files/run/constant-type.check
index 77bdf618e6..a7ba5a46c2 100644
--- a/test/files/run/constant-type.check
+++ b/test/files/run/constant-type.check
@@ -23,4 +23,4 @@ Class[String](classOf[java.lang.String])
scala> { ConstantType(Constant(s)); exitingPhase(currentRun.erasurePhase)(println(ConstantType(Constant(s)))); }
Class(classOf[java.lang.String])
-scala>
+scala> :quit
diff --git a/test/files/run/constrained-types.check b/test/files/run/constrained-types.check
index a3cd59b9fb..89a08d5ccb 100644
--- a/test/files/run/constrained-types.check
+++ b/test/files/run/constrained-types.check
@@ -148,4 +148,4 @@ scala> val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message
val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message
^
-scala>
+scala> :quit
diff --git a/test/files/run/exprs_serialize.check b/test/files/run/exprs_serialize.check
index 20ad6c110c..551823ccdc 100644
--- a/test/files/run/exprs_serialize.check
+++ b/test/files/run/exprs_serialize.check
@@ -1,2 +1,19 @@
-java.io.NotSerializableException: Test$$treecreator1$1
-java.io.NotSerializableException: Test$$treecreator2$1
+Expr[Int(2)](2)
+Expr[java.lang.String]({
+ def foo = "hello";
+ foo.$plus("world!")
+})
+Expr[Boolean]({
+ def foo(x: Int) = {
+ class Local extends AnyRef {
+ def <init>() = {
+ super.<init>();
+ ()
+ };
+ val f = 2
+ };
+ val obj = new Local();
+ x.$percent(obj.f).$eq$eq(0)
+ };
+ foo(5)
+})
diff --git a/test/files/run/exprs_serialize.scala b/test/files/run/exprs_serialize.scala
index c4310b0fe1..91027803b4 100644
--- a/test/files/run/exprs_serialize.scala
+++ b/test/files/run/exprs_serialize.scala
@@ -26,4 +26,14 @@ object Test extends App {
test(reify(2))
test(reify{def foo = "hello"; foo + "world!"})
-} \ No newline at end of file
+ test(reify {
+ def foo(x: Int) = {
+ class Local {
+ val f = 2
+ }
+ val obj = new Local
+ x % obj.f == 0
+ }
+ foo(5)
+ })
+}
diff --git a/test/files/run/kind-repl-command.check b/test/files/run/kind-repl-command.check
index 1c292572e6..586b2710e1 100644
--- a/test/files/run/kind-repl-command.check
+++ b/test/files/run/kind-repl-command.check
@@ -25,4 +25,4 @@ scala> :k Nonexisting
Nonexisting
^
-scala>
+scala> :quit
diff --git a/test/files/run/lub-visibility.check b/test/files/run/lub-visibility.check
index f76579412e..70734966f0 100644
--- a/test/files/run/lub-visibility.check
+++ b/test/files/run/lub-visibility.check
@@ -8,4 +8,4 @@ scala> // but reverted that for SI-5534.
scala> val x = List(List(), Vector())
x: List[scala.collection.immutable.Seq[Nothing] with scala.collection.AbstractSeq[Nothing] with java.io.Serializable] = List(List(), Vector())
-scala>
+scala> :quit
diff --git a/test/files/run/macro-bundle-repl.check b/test/files/run/macro-bundle-repl.check
index 4a0b421606..75c5c2adda 100644
--- a/test/files/run/macro-bundle-repl.check
+++ b/test/files/run/macro-bundle-repl.check
@@ -21,4 +21,4 @@ defined term macro foo: Unit
scala> foo
-scala>
+scala> :quit
diff --git a/test/files/run/macro-rangepos-subpatterns.check b/test/files/run/macro-rangepos-subpatterns.check
new file mode 100644
index 0000000000..760e15d019
--- /dev/null
+++ b/test/files/run/macro-rangepos-subpatterns.check
@@ -0,0 +1 @@
+The width of the subpattern is: 2
diff --git a/test/files/run/macro-rangepos-subpatterns.flags b/test/files/run/macro-rangepos-subpatterns.flags
new file mode 100644
index 0000000000..fcf951d907
--- /dev/null
+++ b/test/files/run/macro-rangepos-subpatterns.flags
@@ -0,0 +1 @@
+-Yrangepos \ No newline at end of file
diff --git a/test/files/run/macro-rangepos-subpatterns/Macros_1.scala b/test/files/run/macro-rangepos-subpatterns/Macros_1.scala
new file mode 100644
index 0000000000..0f30862347
--- /dev/null
+++ b/test/files/run/macro-rangepos-subpatterns/Macros_1.scala
@@ -0,0 +1,18 @@
+import scala.reflect.macros.whitebox.Context
+import language.experimental.macros
+
+object Extractor {
+ def unapply(x: Any): Any = macro unapplyImpl
+ def unapplyImpl(c: Context)(x: c.Tree) = {
+ import c.universe._
+ import internal._
+ val pos = subpatterns(x).get.head.pos
+ q"""
+ new {
+ def isEmpty = false
+ def get = ${"The width of the subpattern is: " + (pos.end - pos.start + 1)}
+ def unapply(x: Any) = this
+ }.unapply($x)
+ """
+ }
+}
diff --git a/test/files/run/macro-rangepos-subpatterns/Test_2.scala b/test/files/run/macro-rangepos-subpatterns/Test_2.scala
new file mode 100644
index 0000000000..7b076e6632
--- /dev/null
+++ b/test/files/run/macro-rangepos-subpatterns/Test_2.scala
@@ -0,0 +1,5 @@
+object Test extends App {
+ 42 match {
+ case Extractor(a) => println(a)
+ }
+}
diff --git a/test/files/run/macro-repl-basic.check b/test/files/run/macro-repl-basic.check
index 86b4d472ed..fab03d1558 100644
--- a/test/files/run/macro-repl-basic.check
+++ b/test/files/run/macro-repl-basic.check
@@ -49,4 +49,4 @@ import Macros.Shmacros._
scala> println(foo(2) + Macros.bar(2) * new Macros().quux(4))
31
-scala>
+scala> :quit
diff --git a/test/files/run/macro-repl-dontexpand.check b/test/files/run/macro-repl-dontexpand.check
index 20d3b2d702..6ecc9245fa 100644
--- a/test/files/run/macro-repl-dontexpand.check
+++ b/test/files/run/macro-repl-dontexpand.check
@@ -13,4 +13,4 @@ bar2: (c: scala.reflect.macros.whitebox.Context)Nothing
scala> def foo2 = macro bar2
defined term macro foo2: Nothing
-scala>
+scala> :quit
diff --git a/test/files/run/macro-system-properties.check b/test/files/run/macro-system-properties.check
index ffbd5a8aa8..e2e2bd32b9 100644
--- a/test/files/run/macro-system-properties.check
+++ b/test/files/run/macro-system-properties.check
@@ -19,4 +19,4 @@ defined object Test
scala> object Test { class C(implicit a: Any) { GrabContext.grab } }
defined object Test
-scala>
+scala> :quit
diff --git a/test/files/run/names-defaults.check b/test/files/run/names-defaults.check
index 25999c488a..c358dc5849 100644
--- a/test/files/run/names-defaults.check
+++ b/test/files/run/names-defaults.check
@@ -124,3 +124,4 @@ List(1, 2)
3
3
(1,0), (1,2)
+1 1 0
diff --git a/test/files/run/names-defaults.scala b/test/files/run/names-defaults.scala
index 05cd4a540c..b7ed490cbc 100644
--- a/test/files/run/names-defaults.scala
+++ b/test/files/run/names-defaults.scala
@@ -401,6 +401,10 @@ object Test extends App {
C4441a().copy()
C4441b()().copy()()
+ // SI-8117
+ def f8177(a: Int = 0, b: Int = 0, c: Int = 0) = s"$a $b $c"
+ println(f8177(a = 1, 1))
+
// DEFINITIONS
def test1(a: Int, b: String) = println(a +": "+ b)
def test2(u: Int, v: Int)(k: String, l: Int) = println(l +": "+ k +", "+ (u + v))
diff --git a/test/files/run/private-override.check b/test/files/run/private-override.check
deleted file mode 100644
index 00750edc07..0000000000
--- a/test/files/run/private-override.check
+++ /dev/null
@@ -1 +0,0 @@
-3
diff --git a/test/files/run/reflection-attachments.check b/test/files/run/reflection-attachments.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/run/reflection-attachments.check
diff --git a/test/files/run/reflection-equality.check b/test/files/run/reflection-equality.check
index 682326bc18..d60d861a90 100644
--- a/test/files/run/reflection-equality.check
+++ b/test/files/run/reflection-equality.check
@@ -48,4 +48,4 @@ res2: Boolean = true
scala> t2 <:< t1
res3: Boolean = true
-scala>
+scala> :quit
diff --git a/test/files/run/reflection-magicsymbols-repl.check b/test/files/run/reflection-magicsymbols-repl.check
index 72aef1d3be..ca8857ada4 100644
--- a/test/files/run/reflection-magicsymbols-repl.check
+++ b/test/files/run/reflection-magicsymbols-repl.check
@@ -34,4 +34,4 @@ scala.Null
scala.Nothing
scala.Singleton
-scala>
+scala> :quit
diff --git a/test/files/run/reflection-repl-classes.check b/test/files/run/reflection-repl-classes.check
index 03a6aef2b5..5ebf993a87 100644
--- a/test/files/run/reflection-repl-classes.check
+++ b/test/files/run/reflection-repl-classes.check
@@ -30,4 +30,4 @@ scala>
scala> mm(new A)
res0: Any = 1
-scala>
+scala> :quit
diff --git a/test/files/run/reflection-repl-elementary.check b/test/files/run/reflection-repl-elementary.check
index 4a223e8a24..e948c9fd61 100644
--- a/test/files/run/reflection-repl-elementary.check
+++ b/test/files/run/reflection-repl-elementary.check
@@ -4,4 +4,4 @@ Type :help for more information.
scala> scala.reflect.runtime.universe.typeOf[List[Nothing]]
res0: reflect.runtime.universe.Type = scala.List[Nothing]
-scala>
+scala> :quit
diff --git a/test/files/run/reify-repl-fail-gracefully.check b/test/files/run/reify-repl-fail-gracefully.check
index 29ccee3cc6..c9e69744d6 100644
--- a/test/files/run/reify-repl-fail-gracefully.check
+++ b/test/files/run/reify-repl-fail-gracefully.check
@@ -14,4 +14,4 @@ scala> reify
reify
^
-scala>
+scala> :quit
diff --git a/test/files/run/reify_newimpl_22.check b/test/files/run/reify_newimpl_22.check
index 1432d10127..952f384a1c 100644
--- a/test/files/run/reify_newimpl_22.check
+++ b/test/files/run/reify_newimpl_22.check
@@ -22,4 +22,4 @@ scala> {
^
2
-scala>
+scala> :quit
diff --git a/test/files/run/reify_newimpl_23.check b/test/files/run/reify_newimpl_23.check
index 217f0a98c7..b7e9bfdfbc 100644
--- a/test/files/run/reify_newimpl_23.check
+++ b/test/files/run/reify_newimpl_23.check
@@ -21,4 +21,4 @@ scala> def foo[T]{
^
foo: [T]=> Unit
-scala>
+scala> :quit
diff --git a/test/files/run/reify_newimpl_25.check b/test/files/run/reify_newimpl_25.check
index 93ad69defa..4f36ba10ee 100644
--- a/test/files/run/reify_newimpl_25.check
+++ b/test/files/run/reify_newimpl_25.check
@@ -12,4 +12,4 @@ scala> {
^
TypeTag[x.type]
-scala>
+scala> :quit
diff --git a/test/files/run/reify_newimpl_26.check b/test/files/run/reify_newimpl_26.check
index 8e0ad87bf2..681b862795 100644
--- a/test/files/run/reify_newimpl_26.check
+++ b/test/files/run/reify_newimpl_26.check
@@ -14,4 +14,4 @@ foo: [T]=> Unit
scala> foo[Int]
WeakTypeTag[scala.List[T]]
-scala>
+scala> :quit
diff --git a/test/files/run/reify_newimpl_35.check b/test/files/run/reify_newimpl_35.check
index f884d2c0d0..bd9b3a2fb1 100644
--- a/test/files/run/reify_newimpl_35.check
+++ b/test/files/run/reify_newimpl_35.check
@@ -10,4 +10,4 @@ foo: [T](implicit evidence$1: reflect.runtime.universe.TypeTag[T])reflect.runtim
scala> println(foo)
Expr[List[Nothing]](Nil)
-scala>
+scala> :quit
diff --git a/test/files/run/repl-assign.check b/test/files/run/repl-assign.check
index bdc7793c37..faa8a93244 100644
--- a/test/files/run/repl-assign.check
+++ b/test/files/run/repl-assign.check
@@ -13,4 +13,4 @@ x: Int = 12
scala> y = 13
y: Int = 13
-scala>
+scala> :quit
diff --git a/test/files/run/repl-bare-expr.check b/test/files/run/repl-bare-expr.check
index 97ae208ff4..07cf23412f 100644
--- a/test/files/run/repl-bare-expr.check
+++ b/test/files/run/repl-bare-expr.check
@@ -47,4 +47,4 @@ Bovine.x: List[Any] = List(Ruminant(5), Cow, Moooooo)
scala> Bovine.x
res4: List[Any] = List(Ruminant(5), Cow, Moooooo)
-scala>
+scala> :quit
diff --git a/test/files/run/repl-colon-type.check b/test/files/run/repl-colon-type.check
index 1f6d3e2b39..9898027c1d 100644
--- a/test/files/run/repl-colon-type.check
+++ b/test/files/run/repl-colon-type.check
@@ -218,4 +218,4 @@ Unit
scala> :type println("side effect!")
Unit
-scala>
+scala> :quit
diff --git a/test/files/run/repl-empty-package.check b/test/files/run/repl-empty-package.check
index ecf79c2c6d..d3b75f685e 100644
--- a/test/files/run/repl-empty-package.check
+++ b/test/files/run/repl-empty-package.check
@@ -4,4 +4,4 @@ Type :help for more information.
scala> println(Bippy.bippy)
bippy!
-scala>
+scala> :quit
diff --git a/test/files/run/repl-javap-app.check b/test/files/run/repl-javap-app.check
index 1136b415d7..eb3718f44b 100644
--- a/test/files/run/repl-javap-app.check
+++ b/test/files/run/repl-javap-app.check
@@ -15,7 +15,7 @@ public final void delayedEndpoint$MyApp$1();
Start Length Slot Name Signature
0 9 0 this LMyApp$;
-scala>
+scala> :quit
#partest java7
Welcome to Scala
Type in expressions to have them evaluated.
@@ -37,7 +37,7 @@ scala> :javap -app MyApp$
line 5: 0
}
-scala>
+scala> :quit
#partest java8
Welcome to Scala
Type in expressions to have them evaluated.
@@ -60,4 +60,4 @@ scala> :javap -app MyApp$
line 5: 0
}
-scala>
+scala> :quit
diff --git a/test/files/run/repl-out-dir.check b/test/files/run/repl-out-dir.check
index 3e51c63155..c354492898 100644
--- a/test/files/run/repl-out-dir.check
+++ b/test/files/run/repl-out-dir.check
@@ -46,4 +46,4 @@ repl-out-dir-run.obj
Test$.class
Test.class
-scala>
+scala> :quit
diff --git a/test/files/run/repl-parens.check b/test/files/run/repl-parens.check
index 15f4b4524a..74d15ff93c 100644
--- a/test/files/run/repl-parens.check
+++ b/test/files/run/repl-parens.check
@@ -81,4 +81,4 @@ scala>
scala> List(1) ++ List('a')
res16: List[AnyVal] = List(1, a)
-scala>
+scala> :quit
diff --git a/test/files/run/repl-paste-2.check b/test/files/run/repl-paste-2.check
index ab3809a2e0..6ea8e2f419 100644
--- a/test/files/run/repl-paste-2.check
+++ b/test/files/run/repl-paste-2.check
@@ -58,4 +58,4 @@ scala> x.length + res5
res3: Int = 129
-scala>
+scala> :quit
diff --git a/test/files/run/repl-paste-3.check b/test/files/run/repl-paste-3.check
index 8fae61792e..23e402852f 100644
--- a/test/files/run/repl-paste-3.check
+++ b/test/files/run/repl-paste-3.check
@@ -7,4 +7,4 @@ scala> println(3)
scala> List(1,2)
res1: List[Int] = List(1, 2)
-scala>
+scala> :quit
diff --git a/test/files/run/repl-paste-4.scala b/test/files/run/repl-paste-4.scala
index 0060dc1ff6..cb0a6aa768 100644
--- a/test/files/run/repl-paste-4.scala
+++ b/test/files/run/repl-paste-4.scala
@@ -14,7 +14,7 @@ s"""|Type in expressions to have them evaluated.
|scala> Foo(new Foo)
|res0: Int = 7
|
- |scala> """
+ |scala> :quit"""
def pastie = testPath changeExtension "pastie"
}
diff --git a/test/files/run/repl-paste-raw.scala b/test/files/run/repl-paste-raw.scala
index 2953796f99..3b41254e96 100644
--- a/test/files/run/repl-paste-raw.scala
+++ b/test/files/run/repl-paste-raw.scala
@@ -15,6 +15,6 @@ s"""|Type in expressions to have them evaluated.
|scala> favoriteThing.hasString
|res0: Boolean = true
|
- |scala> """
+ |scala> :quit"""
def pastie = testPath changeExtension "pastie"
}
diff --git a/test/files/run/repl-paste.check b/test/files/run/repl-paste.check
index 97f177ddc4..171447214f 100644
--- a/test/files/run/repl-paste.check
+++ b/test/files/run/repl-paste.check
@@ -23,4 +23,4 @@ defined class Dingus
defined object Dingus
x: Int = 110
-scala>
+scala> :quit
diff --git a/test/files/run/repl-power.check b/test/files/run/repl-power.check
index 8a8ca46012..e2318c93f2 100644
--- a/test/files/run/repl-power.check
+++ b/test/files/run/repl-power.check
@@ -27,4 +27,4 @@ m: $r.treedsl.global.Literal = 10
scala> typed(m).tpe // typed is in scope
res2: $r.treedsl.global.Type = Int(10)
-scala>
+scala> :quit
diff --git a/test/files/run/repl-reset.check b/test/files/run/repl-reset.check
index ed95c7b8ff..cd7893bbc3 100644
--- a/test/files/run/repl-reset.check
+++ b/test/files/run/repl-reset.check
@@ -54,4 +54,4 @@ defined class BippyBungus
scala> { new BippyBungus ; x1 }
res2: Int = 4
-scala>
+scala> :quit
diff --git a/test/files/run/repl-save.scala b/test/files/run/repl-save.scala
index 4539790b1a..c98e6aebc3 100644
--- a/test/files/run/repl-save.scala
+++ b/test/files/run/repl-save.scala
@@ -16,7 +16,7 @@ s"""|Type in expressions to have them evaluated.
|
|scala> :save $saveto
|
- |scala> """
+ |scala> :quit"""
def saveto = testOutput / "session.repl"
override def show() = {
super.show()
diff --git a/test/files/run/repl-term-macros.check b/test/files/run/repl-term-macros.check
index 3580bfe1f1..2cd0b93cd0 100644
--- a/test/files/run/repl-term-macros.check
+++ b/test/files/run/repl-term-macros.check
@@ -37,4 +37,4 @@ defined term macro foo3: (x: Int)(y: Int)Unit
scala> foo3(2)(3)
-scala>
+scala> :quit
diff --git a/test/files/run/repl-transcript.check b/test/files/run/repl-transcript.check
index 49891af900..b0f106387b 100644
--- a/test/files/run/repl-transcript.check
+++ b/test/files/run/repl-transcript.check
@@ -35,4 +35,4 @@ scala> res6.sum + res5
res0: Int = 5273
-scala>
+scala> :quit
diff --git a/test/files/run/repl-trim-stack-trace.scala b/test/files/run/repl-trim-stack-trace.scala
index 483659146a..a53ce3b3e4 100644
--- a/test/files/run/repl-trim-stack-trace.scala
+++ b/test/files/run/repl-trim-stack-trace.scala
@@ -32,7 +32,7 @@ java.lang.Exception
at .f(<console>:7)
... 69 elided
-scala> """
+scala> :quit"""
// normalize the "elided" lines because the frame count depends on test context
lazy val elided = """(\s+\.{3} )\d+( elided)""".r
diff --git a/test/files/run/repl-type-verbose.check b/test/files/run/repl-type-verbose.check
index e37754a060..6f6b47b86d 100644
--- a/test/files/run/repl-type-verbose.check
+++ b/test/files/run/repl-type-verbose.check
@@ -187,4 +187,4 @@ PolyType(
)
)
-scala>
+scala> :quit
diff --git a/test/files/run/stringinterpolation_macro-run.check b/test/files/run/stringinterpolation_macro-run.check
index ead61e76ac..c7f46bac87 100644
--- a/test/files/run/stringinterpolation_macro-run.check
+++ b/test/files/run/stringinterpolation_macro-run.check
@@ -63,5 +63,9 @@ She is 4 feet tall.
05/26/12
05/26/12
%
+ mind
+------
+matter
+
7 7 9
7 9 9
diff --git a/test/files/run/stringinterpolation_macro-run.scala b/test/files/run/stringinterpolation_macro-run.scala
index a6def98540..e18375d521 100644
--- a/test/files/run/stringinterpolation_macro-run.scala
+++ b/test/files/run/stringinterpolation_macro-run.scala
@@ -115,6 +115,7 @@ println(f"""${"1234"}%TD""")
// literals and arg indexes
println(f"%%")
+println(f" mind%n------%nmatter%n")
println(f"${7}%d %<d ${9}%d")
println(f"${7}%d %2$$d ${9}%d")
diff --git a/test/files/run/t3376.check b/test/files/run/t3376.check
index cc6949d326..b8fd2843f6 100644
--- a/test/files/run/t3376.check
+++ b/test/files/run/t3376.check
@@ -13,4 +13,4 @@ m2: M[Float] = mmm
scala> val m3 = new M[String]()
m3: M[String] = mmm
-scala>
+scala> :quit
diff --git a/test/files/run/t4025.check b/test/files/run/t4025.check
index 2d4f644c5a..e8c6851236 100644
--- a/test/files/run/t4025.check
+++ b/test/files/run/t4025.check
@@ -14,4 +14,4 @@ scala>
scala> def f(c: Any) = c match { case Red(_) => () }
f: (c: Any)Unit
-scala>
+scala> :quit
diff --git a/test/files/run/t4172.check b/test/files/run/t4172.check
index a748430e2e..315c1c9dbd 100644
--- a/test/files/run/t4172.check
+++ b/test/files/run/t4172.check
@@ -5,4 +5,4 @@ scala> val c = { class C { override def toString = "C" }; ((new C, new C { def f
warning: there was one feature warning; re-run with -feature for details
c: (C, C{def f: Int}) forSome { type C <: AnyRef } = (C,C)
-scala>
+scala> :quit
diff --git a/test/files/run/t4216.check b/test/files/run/t4216.check
index 091e55a0c7..e4610e87d3 100644
--- a/test/files/run/t4216.check
+++ b/test/files/run/t4216.check
@@ -34,4 +34,4 @@ res4: java.util.List[V] = [V@0]
scala> o(new V(0))
res5: java.util.List[Any] = [V@0]
-scala>
+scala> :quit
diff --git a/test/files/run/t4285.check b/test/files/run/t4285.check
index 314c8e5a35..b952cb8e1b 100644
--- a/test/files/run/t4285.check
+++ b/test/files/run/t4285.check
@@ -10,4 +10,4 @@ y: scala.collection.mutable.WrappedArray[Int] = WrappedArray(2, 4, 6, 8, 10, 12,
scala> println(y.sum)
56
-scala>
+scala> :quit
diff --git a/test/files/run/t4332.scala b/test/files/run/t4332.scala
index 5a67922911..1c7e7d73de 100644
--- a/test/files/run/t4332.scala
+++ b/test/files/run/t4332.scala
@@ -12,7 +12,7 @@ object Test extends DirectTest {
}
def isExempt(sym: Symbol) = {
- val exempt = Set("view", "repr", "sliceWithKnownDelta", "sliceWithKnownBound", "transform")
+ val exempt = Set("view", "repr", "sliceWithKnownDelta", "sliceWithKnownBound", "transform", "filterImpl")
(exempt contains sym.name.decoded)
}
diff --git a/test/files/run/t4542.check b/test/files/run/t4542.check
index a53f31a3c7..f7716dc2f0 100644
--- a/test/files/run/t4542.check
+++ b/test/files/run/t4542.check
@@ -12,4 +12,4 @@ scala> val f = new Foo
^
f: Foo = Bippy
-scala>
+scala> :quit
diff --git a/test/files/run/t4594-repl-settings.scala b/test/files/run/t4594-repl-settings.scala
index 8b8b2e3746..4202991607 100644
--- a/test/files/run/t4594-repl-settings.scala
+++ b/test/files/run/t4594-repl-settings.scala
@@ -22,5 +22,5 @@ object Test extends SessionTest {
| ^
|b: String
|
- |scala> """
+ |scala> :quit"""
}
diff --git a/test/files/run/t4671.check b/test/files/run/t4671.check
index 0c36083759..1640dac8e4 100644
--- a/test/files/run/t4671.check
+++ b/test/files/run/t4671.check
@@ -43,4 +43,4 @@ println(s.mkString(""))
}
-scala>
+scala> :quit
diff --git a/test/files/run/t4710.check b/test/files/run/t4710.check
index 6ee7198b4b..0dd49dfbd3 100644
--- a/test/files/run/t4710.check
+++ b/test/files/run/t4710.check
@@ -5,4 +5,4 @@ scala> def method : String = { implicit def f(s: Symbol) = "" ; 'symbol }
warning: there was one feature warning; re-run with -feature for details
method: String
-scala>
+scala> :quit
diff --git a/test/files/run/t5072.check b/test/files/run/t5072.check
index ddd49c71cb..ab34e49869 100644
--- a/test/files/run/t5072.check
+++ b/test/files/run/t5072.check
@@ -7,4 +7,4 @@ defined class C
scala> Thread.currentThread.getContextClassLoader.loadClass(classOf[C].getName)
res0: Class[_] = class C
-scala>
+scala> :quit
diff --git a/test/files/run/t5256c.check b/test/files/run/t5256c.check
index 7fcd0eb722..3eb7b13a97 100644
--- a/test/files/run/t5256c.check
+++ b/test/files/run/t5256c.check
@@ -2,5 +2,5 @@ class A$1
Test.A$1
java.lang.Object {
def foo(): Nothing
- def <init>(): A$1
+ def <init>(): Test.A$1
}
diff --git a/test/files/run/t5256d.check b/test/files/run/t5256d.check
index d42d234386..c2b49989ab 100644
--- a/test/files/run/t5256d.check
+++ b/test/files/run/t5256d.check
@@ -25,4 +25,4 @@ scala.AnyRef {
def foo: scala.Nothing
}
-scala>
+scala> :quit
diff --git a/test/files/run/t5535.check b/test/files/run/t5535.check
index a0c87a47f4..84097ccea9 100644
--- a/test/files/run/t5535.check
+++ b/test/files/run/t5535.check
@@ -13,4 +13,4 @@ f: Int => Int = <function1>
scala> println(f(10))
11
-scala>
+scala> :quit
diff --git a/test/files/run/t5537.check b/test/files/run/t5537.check
index b9d521f301..98265ccc92 100644
--- a/test/files/run/t5537.check
+++ b/test/files/run/t5537.check
@@ -13,4 +13,4 @@ res2: List[scala.collection.immutable.List.type] = List()
scala> List[Set.type]()
res3: List[Set.type] = List()
-scala>
+scala> :quit
diff --git a/test/files/run/t5583.check b/test/files/run/t5583.check
index af96405bdd..32d285cbb3 100644
--- a/test/files/run/t5583.check
+++ b/test/files/run/t5583.check
@@ -13,4 +13,4 @@ scala> for (i <- 1 to 10) {s += i}
scala> println(s)
165
-scala>
+scala> :quit
diff --git a/test/files/run/t5655.check b/test/files/run/t5655.check
index 06c6b32599..4bbc54b641 100644
--- a/test/files/run/t5655.check
+++ b/test/files/run/t5655.check
@@ -23,4 +23,4 @@ and import x
x
^
-scala>
+scala> :quit
diff --git a/test/files/run/t5789.check b/test/files/run/t5789.check
index bcb2382559..193abfaff0 100644
--- a/test/files/run/t5789.check
+++ b/test/files/run/t5789.check
@@ -7,4 +7,4 @@ n: Int = 2
scala> () => n
res0: () => Int = <function0>
-scala>
+scala> :quit
diff --git a/test/files/run/t6086-repl.check b/test/files/run/t6086-repl.check
index 115eff5f85..b904f118e8 100644
--- a/test/files/run/t6086-repl.check
+++ b/test/files/run/t6086-repl.check
@@ -7,4 +7,4 @@ defined class X
scala> scala.reflect.runtime.universe.typeOf[X]
res0: reflect.runtime.universe.Type = X
-scala>
+scala> :quit
diff --git a/test/files/run/t6146b.check b/test/files/run/t6146b.check
index a3b09efcd9..6998873fb7 100644
--- a/test/files/run/t6146b.check
+++ b/test/files/run/t6146b.check
@@ -60,4 +60,4 @@ res2: u.Type = O.S3
scala> memType(S4, fTpe)
res3: u.Type = S4
-scala>
+scala> :quit
diff --git a/test/files/run/t6187.check b/test/files/run/t6187.check
index 0180125809..9a9e266ec6 100644
--- a/test/files/run/t6187.check
+++ b/test/files/run/t6187.check
@@ -29,4 +29,4 @@ res1: List[Int] = List(1)
scala> List("") collect { case x => x }
res2: List[String] = List("")
-scala>
+scala> :quit
diff --git a/test/files/run/t6273.check b/test/files/run/t6273.check
index bef0b227d2..3b682800df 100644
--- a/test/files/run/t6273.check
+++ b/test/files/run/t6273.check
@@ -12,4 +12,4 @@ x: String =
y = 55
"
-scala>
+scala> :quit
diff --git a/test/files/run/t6320.check b/test/files/run/t6320.check
index 013acc1c54..af7c865690 100644
--- a/test/files/run/t6320.check
+++ b/test/files/run/t6320.check
@@ -10,4 +10,4 @@ defined class Dyn
scala> new Dyn(Map("foo" -> 10)).foo[Int]
res0: Int = 10
-scala>
+scala> :quit
diff --git a/test/files/run/t6329_repl.check b/test/files/run/t6329_repl.check
index ad0bb46e5b..ebb1aace7c 100644
--- a/test/files/run/t6329_repl.check
+++ b/test/files/run/t6329_repl.check
@@ -32,4 +32,4 @@ res6: scala.reflect.ClassTag[scala.collection.immutable.Set[_]] = scala.collecti
scala> classTag[scala.collection.immutable.Set[_]]
res7: scala.reflect.ClassTag[scala.collection.immutable.Set[_]] = scala.collection.immutable.Set
-scala>
+scala> :quit
diff --git a/test/files/run/t6329_repl_bug.check b/test/files/run/t6329_repl_bug.check
index 38a8de5606..84297a629f 100644
--- a/test/files/run/t6329_repl_bug.check
+++ b/test/files/run/t6329_repl_bug.check
@@ -14,4 +14,4 @@ res0: scala.reflect.ClassTag[List[_]] = scala.collection.immutable.List[<?>]
scala> scala.reflect.classTag[List[_]]
res1: scala.reflect.ClassTag[List[_]] = scala.collection.immutable.List
-scala>
+scala> :quit
diff --git a/test/files/run/t6381.check b/test/files/run/t6381.check
index 4ed11d59ff..49c6a784ad 100644
--- a/test/files/run/t6381.check
+++ b/test/files/run/t6381.check
@@ -16,4 +16,4 @@ defined term macro pos: String
scala> pos
res0: String = class scala.reflect.internal.util.RangePosition
-scala>
+scala> :quit
diff --git a/test/files/run/t6434.check b/test/files/run/t6434.check
index f898b6b781..0a75ae2bd5 100644
--- a/test/files/run/t6434.check
+++ b/test/files/run/t6434.check
@@ -7,4 +7,4 @@ f: (x: => Int)Int
scala> f _
res0: (=> Int) => Int = <function1>
-scala>
+scala> :quit
diff --git a/test/files/run/t6439.check b/test/files/run/t6439.check
index f8d5b3a8cd..c4b7591069 100644
--- a/test/files/run/t6439.check
+++ b/test/files/run/t6439.check
@@ -70,4 +70,4 @@ defined object lookup
scala> lookup("F") // this now works as a result of changing .typeSymbol to .typeSymbolDirect in IMain#Request#definedSymbols
res0: $r.intp.global.Symbol = type F
-scala>
+scala> :quit
diff --git a/test/files/run/t6440.check b/test/files/run/t6440.check
index 27d5d1380e..2358f08fcc 100644
--- a/test/files/run/t6440.check
+++ b/test/files/run/t6440.check
@@ -1,4 +1,5 @@
-pos: source-newSource1.scala,line-9,offset=109 bad symbolic reference to <root>.pack1 encountered in class file 'U.class'.
-Cannot access term pack1 in package <root>. The current classpath may be
-missing a definition for <root>.pack1, or U.class may have been compiled against a version that's
-incompatible with the one found on the current classpath. ERROR
+pos: source-newSource1.scala,line-9,offset=109 missing or invalid dependency detected while loading class file 'U.class'.
+Could not access term pack1 in package <root>,
+because it (or its dependencies) are missing. Check your build definition for
+missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
+A full rebuild may help if 'U.class' was compiled against an incompatible version of <root>. ERROR
diff --git a/test/files/run/t6440b.check b/test/files/run/t6440b.check
index 0b642c2c35..a6100d6d1e 100644
--- a/test/files/run/t6440b.check
+++ b/test/files/run/t6440b.check
@@ -1,4 +1,5 @@
-pos: NoPosition bad symbolic reference to pack1.T encountered in class file 'U.class'.
-Cannot access type T in package pack1. The current classpath may be
-missing a definition for pack1.T, or U.class may have been compiled against a version that's
-incompatible with the one found on the current classpath. ERROR
+pos: NoPosition missing or invalid dependency detected while loading class file 'U.class'.
+Could not access type T in package pack1,
+because it (or its dependencies) are missing. Check your build definition for
+missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
+A full rebuild may help if 'U.class' was compiled against an incompatible version of pack1. ERROR
diff --git a/test/files/run/t6507.check b/test/files/run/t6507.check
index 3536c42381..5da4aa3a24 100644
--- a/test/files/run/t6507.check
+++ b/test/files/run/t6507.check
@@ -21,4 +21,4 @@ scala> res0
!
res1: A = A
-scala>
+scala> :quit
diff --git a/test/files/run/t6549.check b/test/files/run/t6549.check
index d5dfc5ebe8..be3445927e 100644
--- a/test/files/run/t6549.check
+++ b/test/files/run/t6549.check
@@ -25,4 +25,4 @@ m(scala.Symbol("s")).xxx: Any = 's
scala> val `"` = 0
": Int = 0
-scala>
+scala> :quit
diff --git a/test/files/run/t6631.scala b/test/files/run/t6631.scala
deleted file mode 100644
index e472b83d50..0000000000
--- a/test/files/run/t6631.scala
+++ /dev/null
@@ -1,18 +0,0 @@
-import reflect.ClassTag
-
-object Test extends App {
- def intercept[T <: Throwable : ClassTag](act: => Any) = try {
- act
- } catch {
- case x: Throwable =>
- val cls = implicitly[ClassTag[T]].runtimeClass
- assert(cls.isInstance(x), (x.getClass, x, cls).toString)
- }
- assert(s"""\f\r\n\t""" == "\f\r\n\t")
-
- import StringContext.InvalidEscapeException
- intercept[InvalidEscapeException](s"""\""")
- intercept[InvalidEscapeException](s"""\x""")
- intercept[InvalidEscapeException](s"\")
-
-}
diff --git a/test/files/run/t6937.check b/test/files/run/t6937.check
index 4729dc7006..5c5d4485b6 100644
--- a/test/files/run/t6937.check
+++ b/test/files/run/t6937.check
@@ -19,4 +19,4 @@ apiru: scala.reflect.api.Universe = <lazy>
scala> apiru.typeTag[A].in(cm)
res0: reflect.runtime.universe.TypeTag[A] = TypeTag[A]
-scala>
+scala> :quit
diff --git a/test/files/run/t7185.check b/test/files/run/t7185.check
index ebf85b731f..e4f80a8ff9 100644
--- a/test/files/run/t7185.check
+++ b/test/files/run/t7185.check
@@ -29,4 +29,4 @@ res0: Any =
}
}
-scala>
+scala> :quit
diff --git a/test/files/run/t7319.check b/test/files/run/t7319.check
index 2ac4142098..e35cfc90c0 100644
--- a/test/files/run/t7319.check
+++ b/test/files/run/t7319.check
@@ -40,4 +40,4 @@ scala> Range(1,2).toArray: Seq[_]
scala> 0
res2: Int = 0
-scala>
+scala> :quit
diff --git a/test/files/run/t7482a.check b/test/files/run/t7482a.check
index 943538f352..a21ef7b68f 100644
--- a/test/files/run/t7482a.check
+++ b/test/files/run/t7482a.check
@@ -7,4 +7,4 @@ v: java.util.ArrayList[String] = []
scala> val v: java.util.ArrayList[String] = new java.util.ArrayList[String](5)
v: java.util.ArrayList[String] = []
-scala>
+scala> :quit
diff --git a/test/files/run/t7634.check b/test/files/run/t7634.check
index aea3b94da5..9c6b8b47dd 100644
--- a/test/files/run/t7634.check
+++ b/test/files/run/t7634.check
@@ -5,4 +5,4 @@ Type :help for more information.
scala> .lines
res1: List[String] = List(shello, world.)
-scala>
+scala> :quit
diff --git a/test/files/run/t7747-repl.check b/test/files/run/t7747-repl.check
index ad924f482c..105b238d01 100644
--- a/test/files/run/t7747-repl.check
+++ b/test/files/run/t7747-repl.check
@@ -283,4 +283,4 @@ object $read extends $read {
}
res3: List[Product with Serializable] = List(BippyBups(), PuppyPups(), Bingo())
-scala>
+scala> :quit
diff --git a/test/files/run/t7801.check b/test/files/run/t7801.check
index d72060c684..e0b656b784 100644
--- a/test/files/run/t7801.check
+++ b/test/files/run/t7801.check
@@ -8,4 +8,4 @@ import g.abort
scala> class C(val a: Any) extends AnyVal
defined class C
-scala>
+scala> :quit
diff --git a/test/files/run/t7805-repl-i.check b/test/files/run/t7805-repl-i.check
index eecfff079a..7f66c06a11 100644
--- a/test/files/run/t7805-repl-i.check
+++ b/test/files/run/t7805-repl-i.check
@@ -8,4 +8,4 @@ Type :help for more information.
scala> Console println Try(8)
Success(8)
-scala>
+scala> :quit
diff --git a/test/files/run/t8608-no-format.scala b/test/files/run/t8608-no-format.scala
new file mode 100644
index 0000000000..71c369a7ea
--- /dev/null
+++ b/test/files/run/t8608-no-format.scala
@@ -0,0 +1,15 @@
+
+import scala.tools.partest.JavapTest
+
+object Test extends JavapTest {
+ def code = """
+ |f"hello, world"
+ |:javap -prv -
+ """.stripMargin
+
+ // no format
+ override def yah(res: Seq[String]) = {
+ // note: avoid the word "information"
+ res forall (!_.contains("StringOps.format"))
+ }
+}
diff --git a/test/files/run/t8610.check b/test/files/run/t8610.check
new file mode 100644
index 0000000000..b3ab7a9cef
--- /dev/null
+++ b/test/files/run/t8610.check
@@ -0,0 +1,7 @@
+t8610.scala:6: warning: Adapting argument list by creating a 2-tuple: this may not be what you want.
+ signature: X.f(p: (Int, Int)): Int
+ given arguments: 3, 4
+ after adaptation: X.f((3, 4): (Int, Int))
+ def g = f(3, 4) // adapted
+ ^
+Hi, $name
diff --git a/test/files/run/t8610.flags b/test/files/run/t8610.flags
new file mode 100644
index 0000000000..4195dec383
--- /dev/null
+++ b/test/files/run/t8610.flags
@@ -0,0 +1 @@
+-Xlint:adapted-args
diff --git a/test/files/run/t8610.scala b/test/files/run/t8610.scala
new file mode 100644
index 0000000000..dd9e8e861e
--- /dev/null
+++ b/test/files/run/t8610.scala
@@ -0,0 +1,13 @@
+
+// flags don't warn on u
+case class X(name: String) {
+ def x = "Hi, $name" // missing interp
+ def f(p: (Int, Int)): Int = p._1 * p._2
+ def g = f(3, 4) // adapted
+ def u: Unit = () // unitarian universalist
+}
+
+object Test extends App {
+ // poignant demonstration
+ Console println X("Bob").x
+}
diff --git a/test/files/run/t8738.scala b/test/files/run/t8738.scala
new file mode 100644
index 0000000000..6898301db7
--- /dev/null
+++ b/test/files/run/t8738.scala
@@ -0,0 +1,16 @@
+object Test {
+ def check(a: Range, b: Range) = (a == b) == (a.toList == b.toList)
+ def main(args: Array[String]) {
+ val lo = -2 to 2
+ val hi = lo
+ val step = List(-6,-2,-1,1,2,6)
+ for (i <- lo; j <- hi; n <- step; k <- lo; l <- hi; m <- step) {
+ assert(
+ check(i until j by n, k until l by m) &&
+ check(i until j by n, k to l by m) &&
+ check(i to j by n, k until l by m) &&
+ check(i to j by n, k to l by m)
+ )
+ }
+ }
+}
diff --git a/test/files/run/t8823.scala b/test/files/run/t8823.scala
new file mode 100644
index 0000000000..0ac653566a
--- /dev/null
+++ b/test/files/run/t8823.scala
@@ -0,0 +1,10 @@
+class Tuple2Int(val encoding: Long) extends AnyVal with Product2[Int, Int] {
+ def canEqual(that: Any) = false
+ def _1: Int = 1
+ def _2: Int = 2
+}
+
+object Test extends App {
+ assert(new Tuple2Int(0)._1 == 1)
+ assert(new Tuple2Int(0)._2 == 2)
+}
diff --git a/test/files/run/tpeCache-tyconCache.check b/test/files/run/tpeCache-tyconCache.check
index a892f5477a..ff604819e0 100644
--- a/test/files/run/tpeCache-tyconCache.check
+++ b/test/files/run/tpeCache-tyconCache.check
@@ -16,4 +16,4 @@ res0: Boolean = true
scala> AnyRefClass.tpe eq AnyRefClass.typeConstructor
res1: Boolean = true
-scala>
+scala> :quit
diff --git a/test/files/run/typetags_serialize.check b/test/files/run/typetags_serialize.check
index f79436ea5d..22928a2e94 100644
--- a/test/files/run/typetags_serialize.check
+++ b/test/files/run/typetags_serialize.check
@@ -1,2 +1,3 @@
-java.io.NotSerializableException: scala.reflect.api.TypeTags$PredefTypeCreator
-java.io.NotSerializableException: Test$$typecreator1$1
+TypeTag[Int]
+TypeTag[String]
+TypeTag[Test.C[Double]]
diff --git a/test/files/run/typetags_serialize.scala b/test/files/run/typetags_serialize.scala
index 3c842e6cc9..a7a7845232 100644
--- a/test/files/run/typetags_serialize.scala
+++ b/test/files/run/typetags_serialize.scala
@@ -4,6 +4,10 @@ import scala.reflect.runtime.{universe => ru}
import scala.reflect.runtime.{currentMirror => cm}
object Test extends App {
+ class C[A] {
+ def m(a: A): Int = 5
+ }
+
def test(tag: TypeTag[_]) =
try {
val fout = new ByteArrayOutputStream()
@@ -26,4 +30,5 @@ object Test extends App {
test(implicitly[TypeTag[Int]])
test(implicitly[TypeTag[String]])
+ test(implicitly[TypeTag[C[Double]]])
} \ No newline at end of file
diff --git a/test/files/run/typetags_without_scala_reflect_typetag_lookup.scala b/test/files/run/typetags_without_scala_reflect_typetag_lookup.scala
index 1fbdc62a1e..3d2b9f77be 100644
--- a/test/files/run/typetags_without_scala_reflect_typetag_lookup.scala
+++ b/test/files/run/typetags_without_scala_reflect_typetag_lookup.scala
@@ -36,8 +36,8 @@ object Test extends StoreReporterDirectTest {
println(filteredInfos.mkString("\n"))
storeReporter.infos.clear()
compileApp();
- // we should get bad symbolic reference errors, because we're trying to use an implicit that can't be unpickled
+ // we should get "missing or invalid dependency detected" errors, because we're trying to use an implicit that can't be unpickled
// but we don't know the number of these errors and their order, so I just ignore them all
- println(filteredInfos.filterNot(_.msg.contains("bad symbolic reference")).mkString("\n"))
+ println(filteredInfos.filterNot(_.msg.contains("missing or invalid dependency detected")).mkString("\n"))
}
}
diff --git a/test/files/run/typetags_without_scala_reflect_typetag_manifest_interop.scala b/test/files/run/typetags_without_scala_reflect_typetag_manifest_interop.scala
index 6804baa0c3..a865f4d137 100644
--- a/test/files/run/typetags_without_scala_reflect_typetag_manifest_interop.scala
+++ b/test/files/run/typetags_without_scala_reflect_typetag_manifest_interop.scala
@@ -40,8 +40,8 @@ object Test extends StoreReporterDirectTest {
println(filteredInfos.mkString("\n"))
storeReporter.infos.clear()
compileApp();
- // we should get bad symbolic reference errors, because we're trying to use an implicit that can't be unpickled
+ // we should get "missing or invalid dependency detected" errors, because we're trying to use an implicit that can't be unpickled
// but we don't know the number of these errors and their order, so I just ignore them all
- println(filteredInfos.filterNot (_.msg.contains("bad symbolic reference")).mkString("\n"))
+ println(filteredInfos.filterNot (_.msg.contains("missing or invalid dependency detected")).mkString("\n"))
}
}
diff --git a/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala b/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala
index 49ffaff630..07e8f3faac 100644
--- a/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala
@@ -246,4 +246,11 @@ object TermDeconstructionProps extends QuasiquoteProperties("term deconstruction
assert(f ≈ `new`)
assert(argss.isEmpty)
}
+
+ property("SI-8703 extract block with single expression") = test {
+ val q"{ $a }" = Block(Nil, q"1")
+ val Literal(Constant(1)) = a
+ val q"{ $b }" = q"2"
+ val Literal(Constant(2)) = b
+ }
}
diff --git a/test/junit/scala/StringContextTest.scala b/test/junit/scala/StringContextTest.scala
index 5abfe90cd1..608b82bd96 100644
--- a/test/junit/scala/StringContextTest.scala
+++ b/test/junit/scala/StringContextTest.scala
@@ -48,4 +48,31 @@ class StringContextTest {
val res = processEscapes(s)
assertEquals("Scala", res)
}
+
+ @Test def t6631_baseline() = assertEquals("\f\r\n\t", s"""\f\r\n\t""")
+
+ @Test def t6631_badEscape() = assertThrows[InvalidEscapeException] {
+ s"""\x"""
+ }
+
+ // verifying that the standard interpolators can be supplanted
+ @Test def antiHijack_?() = {
+ object AllYourStringsAreBelongToMe { case class StringContext(args: Any*) { def s(args: Any) = "!!!!" } }
+ import AllYourStringsAreBelongToMe._
+ //assertEquals("????", s"????")
+ assertEquals("!!!!", s"????") // OK to hijack core interpolator ids
+ }
+
+ @Test def fIf() = {
+ val res = f"${if (true) 2.5 else 2.5}%.2f"
+ assertEquals("2.50", res)
+ }
+ @Test def fIfNot() = {
+ val res = f"${if (false) 2.5 else 3.5}%.2f"
+ assertEquals("3.50", res)
+ }
+ @Test def fHeteroArgs() = {
+ val res = f"${3.14}%.2f rounds to ${3}%d"
+ assertEquals("3.14 rounds to 3", res)
+ }
}
diff --git a/test/junit/scala/collection/StreamTest.scala b/test/junit/scala/collection/StreamTest.scala
new file mode 100644
index 0000000000..6dc1c79a48
--- /dev/null
+++ b/test/junit/scala/collection/StreamTest.scala
@@ -0,0 +1,18 @@
+package scala.collection.immutable
+
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+import org.junit.Test
+import org.junit.Assert._
+
+@RunWith(classOf[JUnit4])
+class StreamTest {
+
+ @Test
+ def t6727_and_t6440(): Unit = {
+ assertTrue(Stream.continually(()).filter(_ => true).take(2) == Seq((), ()))
+ assertTrue(Stream.continually(()).filterNot(_ => false).take(2) == Seq((), ()))
+ assertTrue(Stream(1,2,3,4,5).filter(_ < 4) == Seq(1,2,3))
+ assertTrue(Stream(1,2,3,4,5).filterNot(_ > 4) == Seq(1,2,3,4))
+ }
+}
diff --git a/test/junit/scala/reflect/QTest.scala b/test/junit/scala/reflect/QTest.scala
new file mode 100644
index 0000000000..24c35dc401
--- /dev/null
+++ b/test/junit/scala/reflect/QTest.scala
@@ -0,0 +1,23 @@
+
+package scala.reflect
+
+import org.junit.Test
+import org.junit.Assert._
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+import scala.tools.testing.AssertUtil._
+
+@RunWith(classOf[JUnit4])
+class QTest {
+
+ import reflect.runtime._
+ import universe._
+ @Test def qConstantsNotHomogenized() = {
+ //Apply(Select(Literal(Constant(1.0)), TermName("$plus")), List(Literal(Constant(1.0))))
+ val t = q"${1} + ${1.0}"
+ val Apply(Select(Literal(Constant(i)), TermName("$plus")), List(Literal(Constant(j)))) = t
+ assertEquals(1, i)
+ assertEquals(1.0, j)
+ }
+}
diff --git a/test/junit/scala/tools/nsc/backend/jvm/BTypesTest.scala b/test/junit/scala/tools/nsc/backend/jvm/BTypesTest.scala
index b592d06501..cb7e7050b0 100644
--- a/test/junit/scala/tools/nsc/backend/jvm/BTypesTest.scala
+++ b/test/junit/scala/tools/nsc/backend/jvm/BTypesTest.scala
@@ -10,29 +10,33 @@ import org.junit.Assert._
@RunWith(classOf[JUnit4])
class BTypesTest {
- val g: Global = new Global(new Settings())
+ val settings = new Settings()
+ settings.processArgumentString("-usejavacp")
+ val g: Global = new Global(settings)
+ val run = new g.Run() // initializes some compiler internals
+ import g.{definitions => d, Symbol}
- val btypes = new BTypes[g.type](g) {
- def chrs = g.chrs
- override type BTypeName = g.TypeName
- override def createNewName(s: String) = g.newTypeName(s)
- }
+ def duringBackend[T](f: => T) = g.exitingDelambdafy(f)
+ val btypes = new BTypesFromSymbols[g.type](g)
import btypes._
+ duringBackend(btypes.intializeCoreBTypes())
+
+ def classBTypeFromSymbol(sym: Symbol) = duringBackend(btypes.classBTypeFromSymbol(sym))
- val jls = "java/lang/String"
- val jlo = "java/lang/Object"
+ val jlo = d.ObjectClass
+ val jls = d.StringClass
- val o = ClassBType(jlo)
- val s = ClassBType(jls)
+ val o = classBTypeFromSymbol(jlo)
+ val s = classBTypeFromSymbol(jls)
val oArr = ArrayBType(o)
val method = MethodBType(List(oArr, INT, DOUBLE, s), UNIT)
@Test
def classBTypesEquality() {
- val s1 = ClassBType(jls)
- val s2 = ClassBType(jls)
- val o = ClassBType(jlo)
+ val s1 = classBTypeFromSymbol(jls)
+ val s2 = classBTypeFromSymbol(jls)
+ val o = classBTypeFromSymbol(jlo)
assertEquals(s1, s2)
assertEquals(s1.hashCode, s2.hashCode)
assert(s1 != o)
@@ -40,11 +44,6 @@ class BTypesTest {
}
@Test
- def classBTypeRequiresInternalName() {
- assertThrows[AssertionError](ClassBType(s"L$jls;"), _ contains "Descriptor instead of internal name")
- }
-
- @Test
def typedOpcodes() {
assert(UNIT.typedOpcode(Opcodes.IALOAD) == Opcodes.IALOAD)
assert(INT.typedOpcode(Opcodes.IALOAD) == Opcodes.IALOAD)
@@ -55,7 +54,7 @@ class BTypesTest {
assert(FLOAT.typedOpcode(Opcodes.IALOAD) == Opcodes.FALOAD)
assert(LONG.typedOpcode(Opcodes.IALOAD) == Opcodes.LALOAD)
assert(DOUBLE.typedOpcode(Opcodes.IALOAD) == Opcodes.DALOAD)
- assert(ClassBType(jls).typedOpcode(Opcodes.IALOAD) == Opcodes.AALOAD)
+ assert(classBTypeFromSymbol(jls).typedOpcode(Opcodes.IALOAD) == Opcodes.AALOAD)
assert(UNIT.typedOpcode(Opcodes.IRETURN) == Opcodes.RETURN)
assert(BOOL.typedOpcode(Opcodes.IRETURN) == Opcodes.IRETURN)
@@ -66,7 +65,7 @@ class BTypesTest {
assert(FLOAT.typedOpcode(Opcodes.IRETURN) == Opcodes.FRETURN)
assert(LONG.typedOpcode(Opcodes.IRETURN) == Opcodes.LRETURN)
assert(DOUBLE.typedOpcode(Opcodes.IRETURN) == Opcodes.DRETURN)
- assert(ClassBType(jls).typedOpcode(Opcodes.IRETURN) == Opcodes.ARETURN)
+ assert(classBTypeFromSymbol(jls).typedOpcode(Opcodes.IRETURN) == Opcodes.ARETURN)
}
@Test
@@ -84,21 +83,9 @@ class BTypesTest {
}
}
+ // TODO @lry do more tests
@Test
- def parseMethodDescriptorTest() {
- val descriptors = List(
- "()V",
- "(ID)I",
- "([[I[D)[D",
- s"(L$jls;[L$jlo;)[[L$jls;",
- s"(IL$jlo;)L$jls;"
- )
- for (d <- descriptors) {
- assertEquals(d, MethodBType(d).descriptor)
- }
+ def maxTypeTest() {
- // class types in method descriptor need surrounding 'L' and ';'
- assertThrows[MatchError](MethodBType("(java/lang/String)V"), _ == "j (of class java.lang.Character)")
- assertThrows[AssertionError](MethodBType("I"), _ contains "Not a valid method descriptor")
}
}
diff --git a/test/junit/scala/tools/nsc/settings/SettingsTest.scala b/test/junit/scala/tools/nsc/settings/SettingsTest.scala
index e4b5ecc7c3..960d7f8ac1 100644
--- a/test/junit/scala/tools/nsc/settings/SettingsTest.scala
+++ b/test/junit/scala/tools/nsc/settings/SettingsTest.scala
@@ -26,7 +26,7 @@ class SettingsTest {
assertThrows[IllegalArgumentException](check("-Ytest-setting:rubbish"))
}
- @Test def userSettingsHavePredecenceOverOptimize() {
+ @Test def userSettingsHavePrecedenceOverOptimize() {
def check(args: String*): MutableSettings#BooleanSetting = {
val s = new MutableSettings(msg => throw new IllegalArgumentException(msg))
val (ok, residual) = s.processArguments(args.toList, processAll = true)
@@ -38,15 +38,23 @@ class SettingsTest {
assertFalse(check("-Yinline:false", "-optimise").value)
}
- @Test def userSettingsHavePredecenceOverLint() {
- def check(args: String*): MutableSettings#BooleanSetting = {
- val s = new MutableSettings(msg => throw new IllegalArgumentException(msg))
- val (ok, residual) = s.processArguments(args.toList, processAll = true)
- assert(residual.isEmpty)
- s.warnAdaptedArgs // among Xlint
- }
- assertTrue(check("-Xlint").value)
- assertFalse(check("-Xlint", "-Ywarn-adapted-args:false").value)
- assertFalse(check("-Ywarn-adapted-args:false", "-Xlint").value)
+ // for the given args, select the desired setting
+ private def check(args: String*)(b: MutableSettings => MutableSettings#BooleanSetting): MutableSettings#BooleanSetting = {
+ val s = new MutableSettings(msg => throw new IllegalArgumentException(msg))
+ val (ok, residual) = s.processArguments(args.toList, processAll = true)
+ assert(residual.isEmpty)
+ b(s)
+ }
+ @Test def userSettingsHavePrecedenceOverLint() {
+ assertTrue(check("-Xlint")(_.warnAdaptedArgs))
+ assertFalse(check("-Xlint", "-Ywarn-adapted-args:false")(_.warnAdaptedArgs))
+ assertFalse(check("-Ywarn-adapted-args:false", "-Xlint")(_.warnAdaptedArgs))
+ }
+
+ @Test def anonymousLintersCanBeNamed() {
+ assertTrue(check("-Xlint")(_.warnMissingInterpolator)) // among Xlint
+ assertFalse(check("-Xlint:-missing-interpolator")(_.warnMissingInterpolator))
+ assertFalse(check("-Xlint:-missing-interpolator", "-Xlint")(_.warnMissingInterpolator))
+ assertFalse(check("-Xlint", "-Xlint:-missing-interpolator")(_.warnMissingInterpolator))
}
}
diff --git a/test/junit/scala/util/matching/RegexTest.scala b/test/junit/scala/util/matching/RegexTest.scala
index d25842cc57..5b13397d6a 100644
--- a/test/junit/scala/util/matching/RegexTest.scala
+++ b/test/junit/scala/util/matching/RegexTest.scala
@@ -27,4 +27,21 @@ class RegexTest {
assertEquals("1", x)
assertEquals("1", y)
}
+
+ @Test def t8787nullMatch() = {
+ val r = """\d+""".r
+ val s: String = null
+ val x = s match { case r() => 1 ; case _ => 2 }
+ assertEquals(2, x)
+ }
+
+ @Test def t8787nullMatcher() = {
+ val r = """(\d+):(\d+)""".r
+ val s = "1:2 3:4 5:6"
+ val z = ((r findAllMatchIn s).toList :+ null) flatMap {
+ case r(x, y) => Some((x.toInt, y.toInt))
+ case _ => None
+ }
+ assertEquals(List((1,2),(3,4),(5,6)), z)
+ }
}
diff --git a/test/scaladoc/run/t8314.check b/test/scaladoc/run/t8314.check
new file mode 100644
index 0000000000..aa04c12c8f
--- /dev/null
+++ b/test/scaladoc/run/t8314.check
@@ -0,0 +1,3 @@
+Body(List(Paragraph(Chain(List(Summary(Chain(List(Text(This should be ), Monospace(Text(monospaced))))))))))
+
+Done.
diff --git a/test/scaladoc/run/t8314.scala b/test/scaladoc/run/t8314.scala
new file mode 100644
index 0000000000..7f6d6fdb00
--- /dev/null
+++ b/test/scaladoc/run/t8314.scala
@@ -0,0 +1,16 @@
+import scala.tools.nsc.doc.model._
+import scala.tools.partest.ScaladocModelTest
+
+object Test extends ScaladocModelTest {
+ override def code = """
+ /** This should be `monospaced` */
+ class A
+ """
+
+ def scaladocSettings = ""
+
+ def testModel(root: Package) = {
+ import access._
+ root._class("A").comment foreach println
+ }
+}
diff --git a/test/scaladoc/run/t8557.check b/test/scaladoc/run/t8557.check
new file mode 100644
index 0000000000..619c56180b
--- /dev/null
+++ b/test/scaladoc/run/t8557.check
@@ -0,0 +1 @@
+Done.
diff --git a/test/scaladoc/run/t8557.scala b/test/scaladoc/run/t8557.scala
new file mode 100644
index 0000000000..451f004d7d
--- /dev/null
+++ b/test/scaladoc/run/t8557.scala
@@ -0,0 +1,32 @@
+import scala.tools.nsc.doc.base._
+import scala.tools.nsc.doc.model._
+import scala.tools.partest.ScaladocModelTest
+
+object Test extends ScaladocModelTest {
+
+ override def code = """
+ package scala.test.scaladoc.T8857
+
+ /**
+ * A link:
+ *
+ * [[scala.Option$ object Option]].
+ */
+ class A
+ """
+
+ // a non-canonical path to scala-library.jar should still work
+ // this is a bit fragile (depends on the current directory being the root of the repo ;
+ // ant & partest seem to do that properly)
+ def scaladocSettings = "-doc-external-doc build/pack/bin/../lib/scala-library.jar#http://www.scala-lang.org/api/current/"
+
+ def testModel(rootPackage: Package) = {
+ // get the quick access implicit defs in scope (_package(s), _class(es), _trait(s), object(s) _method(s), _value(s))
+ import access._
+
+ val a = rootPackage._package("scala")._package("test")._package("scaladoc")._package("T8857")._class("A")
+
+ val links = countLinks(a.comment.get, _.link.isInstanceOf[LinkToExternal])
+ assert(links == 1, links + " == 1 (the links to external in class A)")
+ }
+}