summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/build-partest.xml24
-rw-r--r--test/files/jvm/t7253.check1
-rw-r--r--test/files/jvm/t7253/Base_1.scala5
-rw-r--r--test/files/jvm/t7253/JavaClient_1.java9
-rw-r--r--test/files/jvm/t7253/ScalaClient_1.scala9
-rw-r--r--test/files/jvm/t7253/test.scala28
-rw-r--r--test/files/neg/choices.check2
-rw-r--r--test/files/neg/choices.flags2
-rw-r--r--test/files/neg/javac-error.check10
-rw-r--r--test/files/neg/javac-error.flags1
-rw-r--r--test/files/neg/javac-error/J.java5
-rw-r--r--test/files/neg/javac-error/SUT_5.scala5
-rw-r--r--test/files/neg/t3631.check4
-rw-r--r--test/files/neg/t5580b.check6
-rw-r--r--test/files/neg/t5580b.scala (renamed from test/files/pos/t5580b.scala)6
-rw-r--r--test/files/neg/t7110.check6
-rw-r--r--test/files/neg/t7110.flags1
-rw-r--r--test/files/neg/t7110.scala6
-rw-r--r--test/files/neg/t7251.check4
-rw-r--r--test/files/neg/t7251/A_1.scala10
-rw-r--r--test/files/neg/t7251/B_2.scala7
-rw-r--r--test/files/neg/t7259.check7
-rw-r--r--test/files/neg/t7259.scala9
-rw-r--r--test/files/neg/t7285.check15
-rw-r--r--test/files/neg/t7285.flags1
-rw-r--r--test/files/neg/t7285.scala55
-rw-r--r--test/files/neg/t7290.check12
-rw-r--r--test/files/neg/t7290.flags1
-rw-r--r--test/files/neg/t7290.scala10
-rw-r--r--test/files/neg/t7299.check7
-rw-r--r--test/files/neg/t7299.scala6
-rw-r--r--test/files/pos/t3120/J1.java4
-rw-r--r--test/files/pos/t3120/J2.java4
-rw-r--r--test/files/pos/t3120/Q.java3
-rw-r--r--test/files/pos/t3120/Test.scala3
-rw-r--r--test/files/pos/t3631.scala (renamed from test/files/neg/t3631.scala)0
-rw-r--r--test/files/pos/t6210.flags1
-rw-r--r--test/files/pos/t6210.scala21
-rw-r--r--test/files/pos/t6921.scala11
-rw-r--r--test/files/pos/t7232.flags1
-rw-r--r--test/files/pos/t7232/Foo.java9
-rw-r--r--test/files/pos/t7232/List.java4
-rw-r--r--test/files/pos/t7232/Test.scala5
-rw-r--r--test/files/pos/t7232b.flags1
-rw-r--r--test/files/pos/t7232b/Foo.java8
-rw-r--r--test/files/pos/t7232b/List.java5
-rw-r--r--test/files/pos/t7232b/Test.scala5
-rw-r--r--test/files/pos/t7232c.flags1
-rw-r--r--test/files/pos/t7232c/Foo.java10
-rw-r--r--test/files/pos/t7232c/Test.scala4
-rw-r--r--test/files/pos/t7232d.flags1
-rw-r--r--test/files/pos/t7232d/Entry.java4
-rw-r--r--test/files/pos/t7232d/Foo.java8
-rw-r--r--test/files/pos/t7232d/Test.scala4
-rw-r--r--test/files/pos/t7233.scala14
-rw-r--r--test/files/pos/t7233b.scala8
-rw-r--r--test/files/pos/t7239.scala38
-rw-r--r--test/files/pos/t7285a.flags1
-rw-r--r--test/files/pos/t7285a.scala83
-rw-r--r--test/files/pos/t7296.scala6
-rwxr-xr-xtest/files/presentation/doc/doc.scala7
-rwxr-xr-xtest/files/presentation/doc/src/p/Base.scala2
-rw-r--r--test/files/run/blame_eye_triple_eee-double.check (renamed from test/files/run/blame_eye_triple_eee.check)0
-rw-r--r--test/files/run/blame_eye_triple_eee-double.flags (renamed from test/files/run/blame_eye_triple_eee.flags)0
-rw-r--r--test/files/run/blame_eye_triple_eee-double.scala (renamed from test/files/run/blame_eye_triple_eee.scala)0
-rw-r--r--test/files/run/blame_eye_triple_eee-float.check9
-rw-r--r--test/files/run/blame_eye_triple_eee-float.flags1
-rw-r--r--test/files/run/blame_eye_triple_eee-float.scala61
-rw-r--r--test/files/run/case-class-23.check2
-rw-r--r--test/files/run/case-class-23.scala33
-rw-r--r--test/files/run/classfile-format-51.scala126
-rw-r--r--test/files/run/existentials3-new.check6
-rw-r--r--test/files/run/inline-ex-handlers.check919
-rw-r--r--test/files/run/iterator-concat.check4
-rw-r--r--test/files/run/iterator-concat.scala15
-rw-r--r--test/files/run/outertest.scala47
-rw-r--r--test/files/run/reify_this.scala6
-rw-r--r--test/files/run/t3994.scala20
-rwxr-xr-xtest/files/run/t5699.check11
-rwxr-xr-xtest/files/run/t5699.scala24
-rw-r--r--test/files/run/t6028.check14
-rw-r--r--test/files/run/t6146b.check11
-rw-r--r--test/files/run/t6146b.scala3
-rw-r--r--test/files/run/t6168/Context.java34
-rw-r--r--test/files/run/t6168/JavaTest.java8
-rw-r--r--test/files/run/t6168/SomeClass.java14
-rw-r--r--test/files/run/t6168/SomeClass2.java12
-rw-r--r--test/files/run/t6168/main.scala15
-rw-r--r--test/files/run/t6168b/Context.java34
-rw-r--r--test/files/run/t6168b/JavaTest.java6
-rw-r--r--test/files/run/t6168b/SomeClass.java11
-rw-r--r--test/files/run/t6168b/main.scala8
-rw-r--r--test/files/run/t6223.scala4
-rw-r--r--test/files/run/t6387.check1
-rw-r--r--test/files/run/t6387.scala16
-rw-r--r--test/files/run/t6715.scala15
-rw-r--r--test/files/run/t6725-1.check2
-rw-r--r--test/files/run/t6725-1.scala5
-rw-r--r--test/files/run/t6725-2.check8
-rw-r--r--test/files/run/t6725-2.scala6
-rw-r--r--test/files/run/t6793.scala9
-rw-r--r--test/files/run/t6793b.scala11
-rw-r--r--test/files/run/t6793c.scala11
-rw-r--r--test/files/run/t6900.scala36
-rw-r--r--test/files/run/t7240.check0
-rw-r--r--test/files/run/t7240/Macros_1.scala48
-rw-r--r--test/files/run/t7240/Test_2.scala3
-rw-r--r--test/files/run/t7242.scala71
-rwxr-xr-xtest/files/run/t7246.check1
-rwxr-xr-xtest/files/run/t7246/Outer.java4
-rwxr-xr-xtest/files/run/t7246/Test.scala16
-rwxr-xr-xtest/files/run/t7246b.check2
-rwxr-xr-xtest/files/run/t7246b/Base.scala7
-rwxr-xr-xtest/files/run/t7246b/Outer.java4
-rwxr-xr-xtest/files/run/t7246b/Test.scala14
-rw-r--r--test/files/run/t7249.check1
-rw-r--r--test/files/run/t7249.scala7
-rw-r--r--test/files/run/t7290.scala9
-rw-r--r--test/files/run/t7300.check2
-rw-r--r--test/files/run/t7300.scala11
-rw-r--r--test/files/run/test-cpp.check146
-rw-r--r--test/files/scalap/abstractClass.check (renamed from test/files/scalap/abstractClass/result.test)0
-rw-r--r--test/files/scalap/abstractClass.scala (renamed from test/files/scalap/abstractClass/A.scala)0
-rw-r--r--test/files/scalap/abstractMethod.check (renamed from test/files/scalap/abstractMethod/result.test)0
-rw-r--r--test/files/scalap/abstractMethod.scala (renamed from test/files/scalap/abstractMethod/A.scala)0
-rw-r--r--test/files/scalap/caseClass.check (renamed from test/files/scalap/caseClass/result.test)0
-rw-r--r--test/files/scalap/caseClass.scala (renamed from test/files/scalap/caseClass/A.scala)0
-rw-r--r--test/files/scalap/caseObject.check (renamed from test/files/scalap/caseObject/result.test)0
-rw-r--r--test/files/scalap/caseObject.scala (renamed from test/files/scalap/caseObject/A.scala)0
-rw-r--r--test/files/scalap/cbnParam.check (renamed from test/files/scalap/cbnParam/result.test)0
-rw-r--r--test/files/scalap/cbnParam.scala (renamed from test/files/scalap/cbnParam/A.scala)0
-rw-r--r--test/files/scalap/classPrivate.check (renamed from test/files/scalap/classPrivate/result.test)0
-rw-r--r--test/files/scalap/classPrivate.scala (renamed from test/files/scalap/classPrivate/A.scala)0
-rw-r--r--test/files/scalap/classWithExistential.check (renamed from test/files/scalap/classWithExistential/result.test)0
-rw-r--r--test/files/scalap/classWithExistential.scala (renamed from test/files/scalap/classWithExistential/A.scala)0
-rw-r--r--test/files/scalap/classWithSelfAnnotation.check (renamed from test/files/scalap/classWithSelfAnnotation/result.test)0
-rw-r--r--test/files/scalap/classWithSelfAnnotation.scala (renamed from test/files/scalap/classWithSelfAnnotation/A.scala)0
-rw-r--r--test/files/scalap/covariantParam.check (renamed from test/files/scalap/covariantParam/result.test)0
-rw-r--r--test/files/scalap/covariantParam.scala (renamed from test/files/scalap/covariantParam/A.scala)0
-rw-r--r--test/files/scalap/defaultParameter.check (renamed from test/files/scalap/defaultParameter/result.test)0
-rw-r--r--test/files/scalap/defaultParameter.scala (renamed from test/files/scalap/defaultParameter/A.scala)0
-rw-r--r--test/files/scalap/implicitParam.check (renamed from test/files/scalap/implicitParam/result.test)0
-rw-r--r--test/files/scalap/implicitParam.scala (renamed from test/files/scalap/implicitParam/A.scala)0
-rw-r--r--test/files/scalap/packageObject.check (renamed from test/files/scalap/packageObject/result.test)0
-rw-r--r--test/files/scalap/packageObject.scala (renamed from test/files/scalap/packageObject/A.scala)0
-rw-r--r--test/files/scalap/paramClauses.check (renamed from test/files/scalap/paramClauses/result.test)0
-rw-r--r--test/files/scalap/paramClauses.scala (renamed from test/files/scalap/paramClauses/A.scala)0
-rw-r--r--test/files/scalap/paramNames.check (renamed from test/files/scalap/paramNames/result.test)0
-rw-r--r--test/files/scalap/paramNames.scala (renamed from test/files/scalap/paramNames/A.scala)0
-rw-r--r--test/files/scalap/sequenceParam.check (renamed from test/files/scalap/sequenceParam/result.test)0
-rw-r--r--test/files/scalap/sequenceParam.scala (renamed from test/files/scalap/sequenceParam/A.scala)0
-rw-r--r--test/files/scalap/simpleClass.check (renamed from test/files/scalap/simpleClass/result.test)0
-rw-r--r--test/files/scalap/simpleClass.scala (renamed from test/files/scalap/simpleClass/A.scala)0
-rw-r--r--test/files/scalap/traitObject.check (renamed from test/files/scalap/traitObject/result.test)0
-rw-r--r--test/files/scalap/traitObject.scala (renamed from test/files/scalap/traitObject/A.scala)0
-rw-r--r--test/files/scalap/typeAnnotations.check (renamed from test/files/scalap/typeAnnotations/result.test)0
-rw-r--r--test/files/scalap/typeAnnotations.scala (renamed from test/files/scalap/typeAnnotations/A.scala)0
-rw-r--r--test/files/scalap/valAndVar.check (renamed from test/files/scalap/valAndVar/result.test)0
-rw-r--r--test/files/scalap/valAndVar.scala (renamed from test/files/scalap/valAndVar/A.scala)0
-rw-r--r--test/files/scalap/wildcardType.check (renamed from test/files/scalap/wildcardType/result.test)0
-rw-r--r--test/files/scalap/wildcardType.scala (renamed from test/files/scalap/wildcardType/A.scala)0
-rwxr-xr-xtest/partest20
-rw-r--r--test/scaladoc/run/SI-6580.check11
-rw-r--r--test/scaladoc/run/SI-6580.scala32
-rw-r--r--test/scaladoc/run/SI-6715.check1
-rw-r--r--test/scaladoc/run/SI-6715.scala15
166 files changed, 2015 insertions, 538 deletions
diff --git a/test/build-partest.xml b/test/build-partest.xml
new file mode 100755
index 0000000000..44502ffa61
--- /dev/null
+++ b/test/build-partest.xml
@@ -0,0 +1,24 @@
+<project name="partest" basedir=".">
+ <dirname property="partest.basedir" file="${ant.file.partest}"/>
+ <property file="${partest.basedir}/included.properties"/>
+
+ <macrodef name="testSuite">
+ <attribute name="dir" default="${partest.basedir}/test"/>
+ <attribute name="srcdir" default="files"/> <!-- TODO: make targets for `pending` and other subdirs -->
+ <attribute name="colors" default="${partest.colors}"/>
+ <attribute name="scalacOpts" default="${scalac.args.optimise}"/>
+ <attribute name="kinds" default="pos neg run jvm res scalap scalacheck specialized instrumented presentation"/>
+ <sequential>
+ <property name="partest.dir" value="@{dir}" />
+ <partest srcdir="@{srcdir}"
+ kinds="@{kinds}"
+ colors="@{colors}"
+ scalacOpts="@{scalacOpts}"
+ compilationpathref="partest.classpath">
+ <compilationpath>
+ <fileset dir="${partest.dir}/files/lib" includes="*.jar" />
+ </compilationpath>
+ </partest>
+ </sequential>
+ </macrodef>
+</project>
diff --git a/test/files/jvm/t7253.check b/test/files/jvm/t7253.check
new file mode 100644
index 0000000000..43f53aba12
--- /dev/null
+++ b/test/files/jvm/t7253.check
@@ -0,0 +1 @@
+bytecode identical
diff --git a/test/files/jvm/t7253/Base_1.scala b/test/files/jvm/t7253/Base_1.scala
new file mode 100644
index 0000000000..a531ebb69d
--- /dev/null
+++ b/test/files/jvm/t7253/Base_1.scala
@@ -0,0 +1,5 @@
+trait A { def f(): Int }
+trait B1 extends A
+abstract class B2 extends A
+class B3 extends A { def f(): Int = 1 }
+class B4 extends B3
diff --git a/test/files/jvm/t7253/JavaClient_1.java b/test/files/jvm/t7253/JavaClient_1.java
new file mode 100644
index 0000000000..43475de2f5
--- /dev/null
+++ b/test/files/jvm/t7253/JavaClient_1.java
@@ -0,0 +1,9 @@
+public class JavaClient_1 {
+ int foo() {
+ ((A) null).f();
+ ((B1) null).f();
+ ((B2) null).f();
+ ((B3) null).f();
+ return ((B4) null).f();
+ }
+}
diff --git a/test/files/jvm/t7253/ScalaClient_1.scala b/test/files/jvm/t7253/ScalaClient_1.scala
new file mode 100644
index 0000000000..d244b326a8
--- /dev/null
+++ b/test/files/jvm/t7253/ScalaClient_1.scala
@@ -0,0 +1,9 @@
+class ScalaClient_1 {
+ def foo() = {
+ (null: A).f()
+ (null: B1).f()
+ (null: B2).f()
+ (null: B3).f()
+ (null: B4).f()
+ }
+}
diff --git a/test/files/jvm/t7253/test.scala b/test/files/jvm/t7253/test.scala
new file mode 100644
index 0000000000..7fe08e8813
--- /dev/null
+++ b/test/files/jvm/t7253/test.scala
@@ -0,0 +1,28 @@
+import scala.tools.partest.BytecodeTest
+
+import scala.tools.nsc.util.JavaClassPath
+import java.io.InputStream
+import scala.tools.asm
+import asm.ClassReader
+import asm.tree.{ClassNode, InsnList}
+import scala.collection.JavaConverters._
+
+object Test extends BytecodeTest {
+ import instructions._
+
+ def show: Unit = {
+ val instrBaseSeqs = Seq("ScalaClient_1", "JavaClient_1") map (name => instructions.fromMethod(getMethod(loadClassNode(name), "foo")))
+ val instrSeqs = instrBaseSeqs map (_ filter isInvoke)
+ cmpInstructions(instrSeqs(0), instrSeqs(1))
+ }
+
+ def cmpInstructions(isa: List[Instruction], isb: List[Instruction]) = {
+ if (isa == isb) println("bytecode identical")
+ else diffInstructions(isa, isb)
+ }
+
+ def isInvoke(node: Instruction): Boolean = {
+ val opcode = node.opcode
+ (opcode == "INVOKEVIRTUAL") || (opcode == "INVOKEINTERFACE")
+ }
+}
diff --git a/test/files/neg/choices.check b/test/files/neg/choices.check
index 3e63f9999d..b114394e96 100644
--- a/test/files/neg/choices.check
+++ b/test/files/neg/choices.check
@@ -1,2 +1,2 @@
-partest error: bad flags: -Ylinearizer
+error: bad options: -Yresolve-term-conflict
one error found
diff --git a/test/files/neg/choices.flags b/test/files/neg/choices.flags
index 5464a18c5d..9718467d4c 100644
--- a/test/files/neg/choices.flags
+++ b/test/files/neg/choices.flags
@@ -1 +1 @@
--Ylinearizer \ No newline at end of file
+-Yresolve-term-conflict
diff --git a/test/files/neg/javac-error.check b/test/files/neg/javac-error.check
new file mode 100644
index 0000000000..e7d1ccc1a1
--- /dev/null
+++ b/test/files/neg/javac-error.check
@@ -0,0 +1,10 @@
+#partest java6
+javac-error/J.java:2: method does not override or implement a method from a supertype
+ @Override public void foo() { }
+ ^
+1 error
+#partest java7
+javac-error/J.java:2: error: method does not override or implement a method from a supertype
+ @Override public void foo() { }
+ ^
+1 error
diff --git a/test/files/neg/javac-error.flags b/test/files/neg/javac-error.flags
new file mode 100644
index 0000000000..85d8eb2ba2
--- /dev/null
+++ b/test/files/neg/javac-error.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/test/files/neg/javac-error/J.java b/test/files/neg/javac-error/J.java
new file mode 100644
index 0000000000..83f50c9ae2
--- /dev/null
+++ b/test/files/neg/javac-error/J.java
@@ -0,0 +1,5 @@
+public class J {
+ @Override public void foo() { }
+
+ public void bar() { foo(); }
+}
diff --git a/test/files/neg/javac-error/SUT_5.scala b/test/files/neg/javac-error/SUT_5.scala
new file mode 100644
index 0000000000..0a996352c0
--- /dev/null
+++ b/test/files/neg/javac-error/SUT_5.scala
@@ -0,0 +1,5 @@
+
+/** The System Under Test.
+ * We bail on the earlier round that generates the first error.
+ */
+class SUT extends J
diff --git a/test/files/neg/t3631.check b/test/files/neg/t3631.check
deleted file mode 100644
index 6d8feca1ed..0000000000
--- a/test/files/neg/t3631.check
+++ /dev/null
@@ -1,4 +0,0 @@
-t3631.scala:3: error: Implementation restriction: case classes cannot have more than 22 parameters.
-case class X23(x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, x7: Int, x8: Int, x9: Int, x10: Int, x11: Int, x12: Int, x13: Int, x14: Int, x15: Int, x16: Int, x17: Int, x18: Int, x19: Int, x20: Int, x21: Int, x22: Int, x23: Int) { }
- ^
-one error found
diff --git a/test/files/neg/t5580b.check b/test/files/neg/t5580b.check
new file mode 100644
index 0000000000..45fde46ff9
--- /dev/null
+++ b/test/files/neg/t5580b.check
@@ -0,0 +1,6 @@
+t5580b.scala:11: error: polymorphic expression cannot be instantiated to expected type;
+ found : [A]scala.collection.mutable.Set[A]
+ required: scala.collection.mutable.Map[bar,scala.collection.mutable.Set[bar]]
+ if (map.get(tmp).isEmpty) map.put(tmp,collection.mutable.Set())
+ ^
+one error found
diff --git a/test/files/pos/t5580b.scala b/test/files/neg/t5580b.scala
index d5a4a0a2b2..2161da4584 100644
--- a/test/files/pos/t5580b.scala
+++ b/test/files/neg/t5580b.scala
@@ -1,9 +1,3 @@
-/** It's a pos test because it does indeed compile,
- * not so much because I'm glad it does. Testing
- * that error messages created and discarded during
- * implicit search don't blow it up.
- */
-
import scala.collection.mutable.WeakHashMap
import scala.collection.JavaConversions._
diff --git a/test/files/neg/t7110.check b/test/files/neg/t7110.check
new file mode 100644
index 0000000000..e484dc4325
--- /dev/null
+++ b/test/files/neg/t7110.check
@@ -0,0 +1,6 @@
+t7110.scala:2: warning: A try without a catch or finally is equivalent to putting its body in a block; no exceptions are handled.
+ try { ??? } // warn
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/test/files/neg/t7110.flags b/test/files/neg/t7110.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/neg/t7110.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/t7110.scala b/test/files/neg/t7110.scala
new file mode 100644
index 0000000000..79ac325216
--- /dev/null
+++ b/test/files/neg/t7110.scala
@@ -0,0 +1,6 @@
+object Test {
+ try { ??? } // warn
+
+ try { ??? } finally ??? // no warn
+ try { ??? } catch { case _: Throwable => } // no warn
+}
diff --git a/test/files/neg/t7251.check b/test/files/neg/t7251.check
new file mode 100644
index 0000000000..8df8984d63
--- /dev/null
+++ b/test/files/neg/t7251.check
@@ -0,0 +1,4 @@
+B_2.scala:5: error: object s.Outer$Triple$ is not a value
+ println( s.Outer$Triple$ )
+ ^
+one error found
diff --git a/test/files/neg/t7251/A_1.scala b/test/files/neg/t7251/A_1.scala
new file mode 100644
index 0000000000..d05373ed28
--- /dev/null
+++ b/test/files/neg/t7251/A_1.scala
@@ -0,0 +1,10 @@
+package s
+
+object Outer {
+ type Triple[+A, +B, +C] = Tuple3[A, B, C]
+ object Triple {
+ def apply[A, B, C](x: A, y: B, z: C) = Tuple3(x, y, z)
+ def unapply[A, B, C](x: Tuple3[A, B, C]): Option[Tuple3[A, B, C]] = Some(x)
+ }
+}
+
diff --git a/test/files/neg/t7251/B_2.scala b/test/files/neg/t7251/B_2.scala
new file mode 100644
index 0000000000..eb59b30902
--- /dev/null
+++ b/test/files/neg/t7251/B_2.scala
@@ -0,0 +1,7 @@
+package s
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ println( s.Outer$Triple$ )
+ }
+}
diff --git a/test/files/neg/t7259.check b/test/files/neg/t7259.check
new file mode 100644
index 0000000000..0ad627fc3b
--- /dev/null
+++ b/test/files/neg/t7259.check
@@ -0,0 +1,7 @@
+t7259.scala:1: error: not found: type xxxxx
+@xxxxx // error: not found: type xxxx
+ ^
+t7259.scala:8: error: type xxxxx is not a member of package annotation
+@annotation.xxxxx // error: not found: type scala
+ ^
+two errors found
diff --git a/test/files/neg/t7259.scala b/test/files/neg/t7259.scala
new file mode 100644
index 0000000000..0fdfe18822
--- /dev/null
+++ b/test/files/neg/t7259.scala
@@ -0,0 +1,9 @@
+@xxxxx // error: not found: type xxxx
+class Ok
+
+//
+// This had the wrong error message in 2.9 and 2.10.
+//
+
+@annotation.xxxxx // error: not found: type scala
+class WrongErrorMessage
diff --git a/test/files/neg/t7285.check b/test/files/neg/t7285.check
new file mode 100644
index 0000000000..a38772bead
--- /dev/null
+++ b/test/files/neg/t7285.check
@@ -0,0 +1,15 @@
+t7285.scala:15: warning: match may not be exhaustive.
+It would fail on the following input: (Up, Down)
+ (d1, d2) match {
+ ^
+t7285.scala:33: warning: match may not be exhaustive.
+It would fail on the following input: Down
+ (d1) match {
+ ^
+t7285.scala:51: warning: match may not be exhaustive.
+It would fail on the following input: (Up, Down)
+ (d1, d2) match {
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+three warnings found
+one error found
diff --git a/test/files/neg/t7285.flags b/test/files/neg/t7285.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/neg/t7285.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/t7285.scala b/test/files/neg/t7285.scala
new file mode 100644
index 0000000000..14121d92b1
--- /dev/null
+++ b/test/files/neg/t7285.scala
@@ -0,0 +1,55 @@
+sealed abstract class Base
+
+
+object Test1 {
+ sealed abstract class Base
+
+ object Base {
+ case object Down extends Base {
+ }
+
+ case object Up extends Base {
+ }
+
+ (d1: Base, d2: Base) =>
+ (d1, d2) match {
+ case (Up, Up) | (Down, Down) => false
+ case (Down, Up) => true
+ }
+ }
+}
+
+object Test2 {
+ sealed abstract class Base
+
+ object Base {
+ case object Down extends Base {
+ }
+
+ case object Up extends Base {
+ }
+
+ (d1: Base, d2: Base) =>
+ (d1) match {
+ case Test2.Base.Up => false
+ }
+ }
+}
+
+
+object Test4 {
+ sealed abstract class Base
+
+ object Base {
+ case object Down extends Base
+
+ case object Up extends Base
+ }
+
+ import Test4.Base._
+ (d1: Base, d2: Base) =>
+ (d1, d2) match {
+ case (Up, Up) | (Down, Down) => false
+ case (Down, Test4.Base.Up) => true
+ }
+}
diff --git a/test/files/neg/t7290.check b/test/files/neg/t7290.check
new file mode 100644
index 0000000000..ad2d0e25b0
--- /dev/null
+++ b/test/files/neg/t7290.check
@@ -0,0 +1,12 @@
+t7290.scala:4: warning: Pattern contains duplicate alternatives: 0
+ case 0 | 0 => 0
+ ^
+t7290.scala:5: warning: Pattern contains duplicate alternatives: 2, 3
+ case 2 | 2 | 2 | 3 | 2 | 3 => 0
+ ^
+t7290.scala:6: warning: Pattern contains duplicate alternatives: 4
+ case 4 | (_ @ 4) => 0
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+three warnings found
+one error found
diff --git a/test/files/neg/t7290.flags b/test/files/neg/t7290.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/neg/t7290.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/t7290.scala b/test/files/neg/t7290.scala
new file mode 100644
index 0000000000..b9db7f7e8a
--- /dev/null
+++ b/test/files/neg/t7290.scala
@@ -0,0 +1,10 @@
+object Test extends App {
+ val y = (0: Int) match {
+ case 1 => 1
+ case 0 | 0 => 0
+ case 2 | 2 | 2 | 3 | 2 | 3 => 0
+ case 4 | (_ @ 4) => 0
+ case _ => -1
+ }
+ assert(y == 0, y)
+}
diff --git a/test/files/neg/t7299.check b/test/files/neg/t7299.check
new file mode 100644
index 0000000000..74340c4841
--- /dev/null
+++ b/test/files/neg/t7299.check
@@ -0,0 +1,7 @@
+t7299.scala:4: error: implementation restricts functions to 22 parameters
+ val eta1 = f _
+ ^
+t7299.scala:5: error: implementation restricts functions to 22 parameters
+ val eta2 = g[Any] _
+ ^
+two errors found
diff --git a/test/files/neg/t7299.scala b/test/files/neg/t7299.scala
new file mode 100644
index 0000000000..f3aae5ce5d
--- /dev/null
+++ b/test/files/neg/t7299.scala
@@ -0,0 +1,6 @@
+object Test {
+ def f(a1: Int, a2: Int, a3: Int, a4: Int, a5: Int, a6: Int, a7: Int, a8: Int, a9: Int, a10: Int, a11: Int, a12: Int, a13: Int, a14: Int, a15: Int, a16: Int, a17: Int, a18: Int, a19: Int, a20: Int, a21: Int, a22: Int, a23: Int) = 0
+ def g[A](a1: Int, a2: Int, a3: Int, a4: Int, a5: Int, a6: Int, a7: Int, a8: Int, a9: Int, a10: Int, a11: Int, a12: Int, a13: Int, a14: Int, a15: Int, a16: Int, a17: Int, a18: Int, a19: Int, a20: Int, a21: Int, a22: Int, a23: Int) = 0
+ val eta1 = f _
+ val eta2 = g[Any] _
+}
diff --git a/test/files/pos/t3120/J1.java b/test/files/pos/t3120/J1.java
new file mode 100644
index 0000000000..12b23c1c98
--- /dev/null
+++ b/test/files/pos/t3120/J1.java
@@ -0,0 +1,4 @@
+class J1 {
+ public class Inner1 { }
+ public static class Inner2 { }
+}
diff --git a/test/files/pos/t3120/J2.java b/test/files/pos/t3120/J2.java
new file mode 100644
index 0000000000..db6e859020
--- /dev/null
+++ b/test/files/pos/t3120/J2.java
@@ -0,0 +1,4 @@
+public class J2 {
+ public void f1(J1.Inner1 p) { }
+ public void f2(J1.Inner2 p) { }
+}
diff --git a/test/files/pos/t3120/Q.java b/test/files/pos/t3120/Q.java
new file mode 100644
index 0000000000..fe2269308a
--- /dev/null
+++ b/test/files/pos/t3120/Q.java
@@ -0,0 +1,3 @@
+public class Q {
+ public static void passInner(J1.Inner1 myInner) {}
+}
diff --git a/test/files/pos/t3120/Test.scala b/test/files/pos/t3120/Test.scala
new file mode 100644
index 0000000000..c02146fba1
--- /dev/null
+++ b/test/files/pos/t3120/Test.scala
@@ -0,0 +1,3 @@
+object Test {
+ Q.passInner(null)
+}
diff --git a/test/files/neg/t3631.scala b/test/files/pos/t3631.scala
index bcf91619ee..bcf91619ee 100644
--- a/test/files/neg/t3631.scala
+++ b/test/files/pos/t3631.scala
diff --git a/test/files/pos/t6210.flags b/test/files/pos/t6210.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/pos/t6210.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/pos/t6210.scala b/test/files/pos/t6210.scala
new file mode 100644
index 0000000000..1ce8493872
--- /dev/null
+++ b/test/files/pos/t6210.scala
@@ -0,0 +1,21 @@
+abstract sealed trait AST
+abstract sealed trait AExpr extends AST
+case class AAssign(name: String, v: AExpr) extends AExpr
+case class AConstBool(v: Boolean) extends AExpr
+
+trait Ty {}
+case class TInt() extends Ty
+case class TBool() extends Ty
+
+object Foo {
+ def checkExpr(ast: AExpr): Ty = {
+ var astTy:Ty = ast match {
+ case AAssign(nm: String, v:AExpr) => TBool()
+
+ case AConstBool(v: Boolean) => TBool()
+
+ case _ => throw new Exception(s"Unhandled case check(ast: ${ast.getClass})")
+ }
+ astTy
+ }
+}
diff --git a/test/files/pos/t6921.scala b/test/files/pos/t6921.scala
new file mode 100644
index 0000000000..36e70e5d2c
--- /dev/null
+++ b/test/files/pos/t6921.scala
@@ -0,0 +1,11 @@
+class Message(messageType: String, reason: Option[String])
+
+class ReproForSI6921 {
+
+ private[this] var reason = ""
+
+ def decideElection = {
+ val explanation = None
+ new Message("", reason = explanation)
+ }
+}
diff --git a/test/files/pos/t7232.flags b/test/files/pos/t7232.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/pos/t7232.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/pos/t7232/Foo.java b/test/files/pos/t7232/Foo.java
new file mode 100644
index 0000000000..3478301b30
--- /dev/null
+++ b/test/files/pos/t7232/Foo.java
@@ -0,0 +1,9 @@
+package pack;
+
+import java.util.List;
+
+public class Foo {
+ public static java.util.List okay() { throw new Error(); }
+
+ public static List wrong() { throw new Error(); }
+}
diff --git a/test/files/pos/t7232/List.java b/test/files/pos/t7232/List.java
new file mode 100644
index 0000000000..e42c63aa67
--- /dev/null
+++ b/test/files/pos/t7232/List.java
@@ -0,0 +1,4 @@
+package pack;
+
+public class List {
+}
diff --git a/test/files/pos/t7232/Test.scala b/test/files/pos/t7232/Test.scala
new file mode 100644
index 0000000000..49c3c12aed
--- /dev/null
+++ b/test/files/pos/t7232/Test.scala
@@ -0,0 +1,5 @@
+object Test {
+ import pack._
+ Foo.okay().size()
+ Foo.wrong().size()
+}
diff --git a/test/files/pos/t7232b.flags b/test/files/pos/t7232b.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/pos/t7232b.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/pos/t7232b/Foo.java b/test/files/pos/t7232b/Foo.java
new file mode 100644
index 0000000000..94f08d545e
--- /dev/null
+++ b/test/files/pos/t7232b/Foo.java
@@ -0,0 +1,8 @@
+package pack;
+
+import java.util.*;
+
+public class Foo {
+ // should be pack.List.
+ public static List list() { throw new Error(); }
+}
diff --git a/test/files/pos/t7232b/List.java b/test/files/pos/t7232b/List.java
new file mode 100644
index 0000000000..ce977152b9
--- /dev/null
+++ b/test/files/pos/t7232b/List.java
@@ -0,0 +1,5 @@
+package pack;
+
+public class List {
+ public void packList() {}
+}
diff --git a/test/files/pos/t7232b/Test.scala b/test/files/pos/t7232b/Test.scala
new file mode 100644
index 0000000000..6377e26bec
--- /dev/null
+++ b/test/files/pos/t7232b/Test.scala
@@ -0,0 +1,5 @@
+object Test {
+ import pack._
+
+ Foo.list().packList()
+}
diff --git a/test/files/pos/t7232c.flags b/test/files/pos/t7232c.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/pos/t7232c.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/pos/t7232c/Foo.java b/test/files/pos/t7232c/Foo.java
new file mode 100644
index 0000000000..bbda09a2da
--- /dev/null
+++ b/test/files/pos/t7232c/Foo.java
@@ -0,0 +1,10 @@
+package pack;
+
+import java.util.List;
+
+public class Foo {
+ public static class List {
+ public void isInnerList() {}
+ }
+ public static List innerList() { throw new Error(); }
+}
diff --git a/test/files/pos/t7232c/Test.scala b/test/files/pos/t7232c/Test.scala
new file mode 100644
index 0000000000..aa7c710948
--- /dev/null
+++ b/test/files/pos/t7232c/Test.scala
@@ -0,0 +1,4 @@
+object Test {
+ import pack._
+ Foo.innerList().isInnerList()
+}
diff --git a/test/files/pos/t7232d.flags b/test/files/pos/t7232d.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/pos/t7232d.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/pos/t7232d/Entry.java b/test/files/pos/t7232d/Entry.java
new file mode 100644
index 0000000000..0cfb6fb25b
--- /dev/null
+++ b/test/files/pos/t7232d/Entry.java
@@ -0,0 +1,4 @@
+package pack;
+
+public class Entry {
+}
diff --git a/test/files/pos/t7232d/Foo.java b/test/files/pos/t7232d/Foo.java
new file mode 100644
index 0000000000..df7114a0f0
--- /dev/null
+++ b/test/files/pos/t7232d/Foo.java
@@ -0,0 +1,8 @@
+package pack;
+
+import java.util.Map.Entry;
+
+public class Foo {
+ public static Entry mapEntry() { throw new Error(); }
+ public static void javaTest() { mapEntry().getKey(); }
+}
diff --git a/test/files/pos/t7232d/Test.scala b/test/files/pos/t7232d/Test.scala
new file mode 100644
index 0000000000..89a8063b3c
--- /dev/null
+++ b/test/files/pos/t7232d/Test.scala
@@ -0,0 +1,4 @@
+object Test {
+ import pack._
+ Foo.mapEntry().getKey()
+}
diff --git a/test/files/pos/t7233.scala b/test/files/pos/t7233.scala
new file mode 100644
index 0000000000..ae15c08c35
--- /dev/null
+++ b/test/files/pos/t7233.scala
@@ -0,0 +1,14 @@
+object Foo {
+ def bar(i: Int) = i
+
+ def ol(i: Int) = i
+ def ol(i: String) = i
+}
+object Test {
+ import Foo.{ bar => quux, toString => bar, ol => olRenamed}
+
+ val f1 = quux _
+ val f1Typed: (Int => Int) = f1
+
+ val f2: String => String = olRenamed _
+}
diff --git a/test/files/pos/t7233b.scala b/test/files/pos/t7233b.scala
new file mode 100644
index 0000000000..927c7fcfd1
--- /dev/null
+++ b/test/files/pos/t7233b.scala
@@ -0,0 +1,8 @@
+object Test {
+ // crash
+ def foo(a: Any) = { import a.{toString => toS}; toS }
+
+ // okay
+ def ok1(a: String) = { import a.{isInstanceOf => iio}; iio[String] }
+ def ok2(a: Int) = { import a.{toInt => ti}; ti }
+}
diff --git a/test/files/pos/t7239.scala b/test/files/pos/t7239.scala
new file mode 100644
index 0000000000..16e9d00f17
--- /dev/null
+++ b/test/files/pos/t7239.scala
@@ -0,0 +1,38 @@
+object Test {
+ def BrokenMethod(): HasFilter[(Int, String)] = ???
+
+ trait HasFilter[B] {
+ def filter(p: B => Boolean) = ???
+ }
+
+ trait HasWithFilter {
+ def withFilter = ???
+ }
+
+ object addWithFilter {
+ trait NoImplicit
+ implicit def enrich(v: Any)
+ (implicit F0: NoImplicit): HasWithFilter = ???
+ }
+
+ BrokenMethod().withFilter(_ => true) // okay
+ BrokenMethod().filter(_ => true) // okay
+
+ locally {
+ import addWithFilter._
+ BrokenMethod().withFilter((_: (Int, String)) => true) // okay
+ }
+
+ locally {
+ import addWithFilter._
+ // adaptToMemberWithArgs sets the type of the tree `x`
+ // to ErrorType (while in silent mode, so the error is not
+ // reported. Later, when the fallback from `withFilter`
+ // to `filter` is attempted, the closure is taken to have
+ // have the type `<error> => Boolean`, which conforms to
+ // `(B => Boolean)`. Only later during pickling does the
+ // defensive check for erroneous types in the tree pick up
+ // the problem.
+ BrokenMethod().withFilter(x => true) // erroneous or inaccessible type.
+ }
+}
diff --git a/test/files/pos/t7285a.flags b/test/files/pos/t7285a.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/pos/t7285a.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/pos/t7285a.scala b/test/files/pos/t7285a.scala
new file mode 100644
index 0000000000..34e79c741b
--- /dev/null
+++ b/test/files/pos/t7285a.scala
@@ -0,0 +1,83 @@
+sealed abstract class Base
+
+object Test {
+ case object Up extends Base
+
+ def foo(d1: Base) =
+ d1 match {
+ case Up =>
+ }
+
+ // Sealed subtype: ModuleTypeRef <empty>.this.Test.Up.type
+ // Pattern: UniqueThisType Test.this.type
+}
+
+
+object Test1 {
+ sealed abstract class Base
+
+ object Base {
+ case object Down extends Base {
+ }
+
+ case object Up extends Base {
+ }
+
+ (d1: Base, d2: Base) =>
+ (d1, d2) match {
+ case (Up, Up) | (Down, Down) => false
+ case (Down, Up) => true
+ case (Up, Down) => false
+ }
+ }
+}
+
+object Test2 {
+ sealed abstract class Base
+
+ object Base {
+ case object Down extends Base {
+ }
+
+ case object Up extends Base {
+ }
+
+ (d1: Base, d2: Base) =>
+ (d1) match {
+ case Up | Down => false
+ }
+ }
+}
+
+object Test3 {
+ sealed abstract class Base
+
+ object Base {
+ case object Down extends Base
+
+ (d1: Base, d2: Base) =>
+ (d1, d2) match {
+ case (Down, Down) => false
+ }
+ }
+}
+
+object Test4 {
+ sealed abstract class Base
+
+ object Base {
+ case object Down extends Base {
+ }
+
+ case object Up extends Base {
+ }
+
+ }
+ import Test4.Base._
+ (d1: Base, d2: Base) =>
+ (d1, d2) match {
+ case (Up, Up) | (Down, Down) => false
+ case (Down, Test4.Base.Up) => true
+ case (Up, Down) => false
+ }
+}
diff --git a/test/files/pos/t7296.scala b/test/files/pos/t7296.scala
new file mode 100644
index 0000000000..0c078d3657
--- /dev/null
+++ b/test/files/pos/t7296.scala
@@ -0,0 +1,6 @@
+object Test {
+ type A = Int
+ // Emits the implementation restriction but then proceeds to crash
+ // when creating the Foo.unapply.
+ case class Foo(a: A, b: A, c: A, d: A, e: A, f: A, g: A, h: A, i: A, j: A, k: A, l: A, m: A, n: A, o: A, p: A, q: A, r: A, s: A, t: A, u: A, v: A, w: A, x: A, y: A, Z: A)
+}
diff --git a/test/files/presentation/doc/doc.scala b/test/files/presentation/doc/doc.scala
index 7a2eb9a588..916b7832f4 100755
--- a/test/files/presentation/doc/doc.scala
+++ b/test/files/presentation/doc/doc.scala
@@ -127,16 +127,17 @@ object Test extends InteractiveTest {
val baseSource = findSource("Base.scala")
val derivedSource = findSource("Derived.scala")
def existsText(where: Any, text: String): Boolean = where match {
- case `text` => true
+ case s: String => s contains text
case s: Seq[_] => s exists (existsText(_, text))
case p: Product => p.productIterator exists (existsText(_, text))
+ case c: Comment => existsText(c.body, text)
}
val (derived, base) = compiler.ask { () =>
val derived = definitions.RootPackage.info.decl(newTermName("p")).info.decl(newTypeName("Derived"))
(derived, derived.ancestors(0))
}
val cmt1 = getComment(derived, derivedSource, (base, baseSource)::(derived, derivedSource)::Nil)
- if (!existsText(cmt1, "Derived comment."))
+ if (!existsText(cmt1, "This is Derived comment"))
println("Unexpected Derived class comment:"+cmt1)
val (fooDerived, fooBase) = compiler.ask { () =>
@@ -145,7 +146,7 @@ object Test extends InteractiveTest {
}
val cmt2 = getComment(fooDerived, derivedSource, (fooBase, baseSource)::(fooDerived, derivedSource)::Nil)
- if (!existsText(cmt2, "Base method has documentation."))
+ if (!existsText(cmt2, "Base method has documentation"))
println("Unexpected foo method comment:"+cmt2)
}
}
diff --git a/test/files/presentation/doc/src/p/Base.scala b/test/files/presentation/doc/src/p/Base.scala
index 9031de3e3e..d91632b6f6 100755
--- a/test/files/presentation/doc/src/p/Base.scala
+++ b/test/files/presentation/doc/src/p/Base.scala
@@ -1,7 +1,7 @@
package p
/**
- * @define BaseComment $BaseVar comment.
+ * @define BaseComment This is $BaseVar comment.
*/
trait Base {
/**
diff --git a/test/files/run/blame_eye_triple_eee.check b/test/files/run/blame_eye_triple_eee-double.check
index 5e46d91a8f..5e46d91a8f 100644
--- a/test/files/run/blame_eye_triple_eee.check
+++ b/test/files/run/blame_eye_triple_eee-double.check
diff --git a/test/files/run/blame_eye_triple_eee.flags b/test/files/run/blame_eye_triple_eee-double.flags
index c9b68d70dc..c9b68d70dc 100644
--- a/test/files/run/blame_eye_triple_eee.flags
+++ b/test/files/run/blame_eye_triple_eee-double.flags
diff --git a/test/files/run/blame_eye_triple_eee.scala b/test/files/run/blame_eye_triple_eee-double.scala
index 1640aead40..1640aead40 100644
--- a/test/files/run/blame_eye_triple_eee.scala
+++ b/test/files/run/blame_eye_triple_eee-double.scala
diff --git a/test/files/run/blame_eye_triple_eee-float.check b/test/files/run/blame_eye_triple_eee-float.check
new file mode 100644
index 0000000000..5e46d91a8f
--- /dev/null
+++ b/test/files/run/blame_eye_triple_eee-float.check
@@ -0,0 +1,9 @@
+if (NaN == NaN) is good
+if (x == x) is good
+if (x == NaN) is good
+if (NaN != NaN) is good
+if (x != x) is good
+if (NaN != x) is good
+x matching was good
+NaN matching was good
+loop with NaN was goood
diff --git a/test/files/run/blame_eye_triple_eee-float.flags b/test/files/run/blame_eye_triple_eee-float.flags
new file mode 100644
index 0000000000..c9b68d70dc
--- /dev/null
+++ b/test/files/run/blame_eye_triple_eee-float.flags
@@ -0,0 +1 @@
+-optimise
diff --git a/test/files/run/blame_eye_triple_eee-float.scala b/test/files/run/blame_eye_triple_eee-float.scala
new file mode 100644
index 0000000000..4deb9f3d60
--- /dev/null
+++ b/test/files/run/blame_eye_triple_eee-float.scala
@@ -0,0 +1,61 @@
+object Test extends App {
+ import Float.NaN
+
+ // NaN must not equal NaN no matter what optimizations are applied
+ // All the following will seem redundant, but to an optimizer
+ // they can appear different
+
+ val x = NaN
+
+ if (NaN == NaN)
+ println("if (NaN == NaN) is broken")
+ else
+ println("if (NaN == NaN) is good")
+
+ if (x == x)
+ println("if (x == x) is broken")
+ else
+ println("if (x == x) is good")
+
+ if (x == NaN)
+ println("if (x == NaN) is broken")
+ else
+ println("if (x == NaN) is good")
+
+ if (NaN != NaN)
+ println("if (NaN != NaN) is good")
+ else
+ println("if (NaN != NaN) broken")
+
+ if (x != x)
+ println("if (x != x) is good")
+ else
+ println("if (x != x) broken")
+
+ if (NaN != x)
+ println("if (NaN != x) is good")
+ else
+ println("if (NaN != x) is broken")
+
+ x match {
+ case 0.0f => println("x matched 0!")
+ case NaN => println("x matched NaN!")
+ case _ => println("x matching was good")
+ }
+
+ NaN match {
+ case 0.0f => println("NaN matched 0!")
+ case NaN => println("NaN matched NaN!")
+ case _ => println("NaN matching was good")
+ }
+
+ var z = 0.0f
+ var i = 0
+ while (i < 10) {
+ if (i % 2 == 0) z = NaN
+ else z = NaN
+ i += 1
+ }
+ if (z.isNaN && i == 10) println("loop with NaN was goood")
+ else println("loop with NaN was broken")
+}
diff --git a/test/files/run/case-class-23.check b/test/files/run/case-class-23.check
new file mode 100644
index 0000000000..888ed2c9eb
--- /dev/null
+++ b/test/files/run/case-class-23.check
@@ -0,0 +1,2 @@
+23
+(1,23)
diff --git a/test/files/run/case-class-23.scala b/test/files/run/case-class-23.scala
new file mode 100644
index 0000000000..92b719574a
--- /dev/null
+++ b/test/files/run/case-class-23.scala
@@ -0,0 +1,33 @@
+case class TwentyThree(
+ _1: Int,
+ _2: Int,
+ _3: Int,
+ _4: Int,
+ _5: Int,
+ _6: Int,
+ _7: Int,
+ _8: Int,
+ _9: Int,
+ _10: Int,
+ _11: Int,
+ _12: Int,
+ _13: Int,
+ _14: Int,
+ _15: Int,
+ _16: Int,
+ _17: Int,
+ _18: Int,
+ _19: Int,
+ _20: Int,
+ _21: Int,
+ _22: Int,
+ _23: Int
+)
+
+object Test extends App {
+ val x = new TwentyThree(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23)
+ println(x._23)
+ assert(x.copy(_1 = 1) == x)
+ val TwentyThree(a, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, b) = x
+ println((a, b))
+}
diff --git a/test/files/run/classfile-format-51.scala b/test/files/run/classfile-format-51.scala
new file mode 100644
index 0000000000..9b1e612f4f
--- /dev/null
+++ b/test/files/run/classfile-format-51.scala
@@ -0,0 +1,126 @@
+import java.io.{File, FileOutputStream}
+
+import scala.tools.nsc.settings.ScalaVersion
+import scala.tools.partest._
+import scala.tools.asm
+import asm.{AnnotationVisitor, ClassWriter, FieldVisitor, Handle, MethodVisitor, Opcodes}
+import Opcodes._
+
+// This test ensures that we can read JDK 7 (classfile format 51) files, including those
+// with invokeDynamic instructions and associated constant pool entries
+// to do that it first uses ASM to generate a class called DynamicInvoker. Then
+// it runs a normal compile on the source in the 'code' field that refers to
+// DynamicInvoker. Any failure will be dumped to std out.
+//
+// By it's nature the test can only work on JDK 7+ because under JDK 6 some of the
+// classes referred to by DynamicInvoker won't be available and DynamicInvoker won't
+// verify. So the test includes a version check that short-circuites the whole test
+// on JDK 6
+object Test extends DirectTest {
+ override def extraSettings: String = "-optimise -usejavacp -d " + testOutput.path + " -cp " + testOutput.path
+
+ def generateClass() {
+ val invokerClassName = "DynamicInvoker"
+ val bootstrapMethodName = "bootstrap"
+ val bootStrapMethodType = "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;"
+ val targetMethodName = "target"
+ val targetMethodType = "()Ljava/lang/String;"
+
+ val cw = new ClassWriter(0)
+ cw.visit(V1_7, ACC_PUBLIC + ACC_SUPER, invokerClassName, null, "java/lang/Object", null)
+
+ val constructor = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null)
+ constructor.visitCode()
+ constructor.visitVarInsn(ALOAD, 0)
+ constructor.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V")
+ constructor.visitInsn(RETURN)
+ constructor.visitMaxs(1, 1)
+ constructor.visitEnd()
+
+ val target = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, targetMethodName, targetMethodType, null, null)
+ target.visitCode()
+ target.visitLdcInsn("hello")
+ target.visitInsn(ARETURN)
+ target.visitMaxs(1, 1)
+ target.visitEnd()
+
+ val bootstrap = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, bootstrapMethodName, bootStrapMethodType, null, null)
+ bootstrap.visitCode()
+// val lookup = MethodHandles.lookup();
+ bootstrap.visitMethodInsn(INVOKESTATIC, "java/lang/invoke/MethodHandles", "lookup", "()Ljava/lang/invoke/MethodHandles$Lookup;")
+ bootstrap.visitVarInsn(ASTORE, 3) // lookup
+
+// val clazz = lookup.lookupClass();
+ bootstrap.visitVarInsn(ALOAD, 3) // lookup
+ bootstrap.visitMethodInsn(INVOKEVIRTUAL, "java/lang/invoke/MethodHandles$Lookup", "lookupClass", "()Ljava/lang/Class;")
+ bootstrap.visitVarInsn(ASTORE, 4) // clazz
+
+// val methodType = MethodType.fromMethodDescriptorString("()Ljava/lang/String, clazz.getClassLoader()")
+ bootstrap.visitLdcInsn("()Ljava/lang/String;")
+ bootstrap.visitVarInsn(ALOAD, 4) // CLAZZ
+ bootstrap.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Class", "getClassLoader", "()Ljava/lang/ClassLoader;")
+ bootstrap.visitMethodInsn(INVOKESTATIC, "java/lang/invoke/MethodType", "fromMethodDescriptorString", "(Ljava/lang/String;Ljava/lang/ClassLoader;)Ljava/lang/invoke/MethodType;")
+ bootstrap.visitVarInsn(ASTORE, 5) // methodType
+
+// val methodHandle = lookup.findStatic(thisClass, "target", methodType)
+ bootstrap.visitVarInsn(ALOAD, 3) // lookup
+ bootstrap.visitVarInsn(ALOAD, 4) // clazz
+ bootstrap.visitLdcInsn("target")
+ bootstrap.visitVarInsn(ALOAD, 5) // methodType
+ bootstrap.visitMethodInsn(INVOKEVIRTUAL, "java/lang/invoke/MethodHandles$Lookup", "findStatic", "(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/MethodHandle;")
+ bootstrap.visitVarInsn(ASTORE, 6) // methodHandle
+
+// new ConstantCallSite(methodHandle)
+ bootstrap.visitTypeInsn(NEW, "java/lang/invoke/ConstantCallSite")
+ bootstrap.visitInsn(DUP)
+ bootstrap.visitVarInsn(ALOAD, 6) // methodHandle
+ bootstrap.visitMethodInsn(INVOKESPECIAL, "java/lang/invoke/ConstantCallSite", "<init>", "(Ljava/lang/invoke/MethodHandle;)V")
+ bootstrap.visitInsn(ARETURN)
+ bootstrap.visitMaxs(4,7)
+ bootstrap.visitEnd()
+
+ val test = cw.visitMethod(ACC_PUBLIC + ACC_FINAL, "test", s"()Ljava/lang/String;", null, null)
+ test.visitCode()
+ val bootstrapHandle = new Handle(H_INVOKESTATIC, invokerClassName, bootstrapMethodName, bootStrapMethodType)
+ test.visitInvokeDynamicInsn("invoke", targetMethodType, bootstrapHandle)
+ test.visitInsn(ARETURN)
+ test.visitMaxs(1, 1)
+ test.visitEnd()
+
+ cw.visitEnd()
+ val bytes = cw.toByteArray()
+
+ val fos = new FileOutputStream(new File(s"${testOutput.path}/$invokerClassName.class"))
+ try
+ fos write bytes
+ finally
+ fos.close()
+
+ }
+
+ def code =
+"""
+object Driver {
+ val invoker = new DynamicInvoker()
+ println(invoker.test())
+}
+"""
+
+ override def show(): Unit = {
+ // redirect err to out, for logging
+ val prevErr = System.err
+ System.setErr(System.out)
+ try {
+ // this test is only valid under JDK 1.7+
+ // cheat a little by using 'ScalaVersion' because it can parse java versions just as well
+ val requiredJavaVersion = ScalaVersion("1.7")
+ val executingJavaVersion = ScalaVersion(System.getProperty("java.specification.version"))
+ if (executingJavaVersion >= requiredJavaVersion) {
+ generateClass()
+ compile()
+ }
+ }
+ finally
+ System.setErr(prevErr)
+ }
+}
diff --git a/test/files/run/existentials3-new.check b/test/files/run/existentials3-new.check
index 8f7dd701ac..c0233d2267 100644
--- a/test/files/run/existentials3-new.check
+++ b/test/files/run/existentials3-new.check
@@ -12,9 +12,9 @@ List[Seq[Int]], t=TypeRef, s=class List
List[Seq[U forSome { type U <: Int }]], t=TypeRef, s=class List
Bar.type, t=TypeRef, s=type Bar.type
Bar, t=TypeRef, s=type Bar
-Test.ToS, t=RefinedType, s=g3
-Test.ToS, t=RefinedType, s=g4
-Test.ToS, t=RefinedType, s=g5
+Test.ToS, t=RefinedType, s=g3
+Test.ToS, t=RefinedType, s=g4
+Test.ToS, t=RefinedType, s=g5
() => Test.ToS, t=TypeRef, s=trait Function0
() => Test.ToS, t=TypeRef, s=trait Function0
$anon, t=TypeRef, s=type $anon
diff --git a/test/files/run/inline-ex-handlers.check b/test/files/run/inline-ex-handlers.check
index abcc8bf42d..7c885d2cc9 100644
--- a/test/files/run/inline-ex-handlers.check
+++ b/test/files/run/inline-ex-handlers.check
@@ -1,427 +1,492 @@
-172c172
-< locals: value x$1, value x1
----
-> locals: value x$1, value x1, variable boxed1
-174c174
-< blocks: [1,2,3,4]
----
-> blocks: [1,3,4]
-186a187,188
-> 92 STORE_LOCAL(variable boxed1)
-> 92 LOAD_LOCAL(variable boxed1)
-195,197d196
-< 92 JUMP 2
-<
-< 2:
-247c246
-< blocks: [1,2,3,4,5,6,7,8,11,12,13,14,15,16,17,18]
----
-> blocks: [1,2,3,4,5,6,8,11,12,13,14,15,16,17,18]
-258,260d256
-< 92 JUMP 7
-<
-< 7:
-391c387
-< locals: value args, variable result, value ex6, value x4, value x5, value message, value x
----
-> locals: value args, variable result, value ex6, value x4, value x5, value x
-393c389
-< blocks: [1,2,3,4,5,8,10,11,13]
----
-> blocks: [1,2,3,5,8,10,11,13,14]
-417c413,422
-< 103 THROW(MyException)
----
-> ? STORE_LOCAL(value ex6)
-> ? JUMP 14
->
-> 14:
-> 101 LOAD_LOCAL(value ex6)
-> 101 STORE_LOCAL(value x4)
-> 101 SCOPE_ENTER value x4
-> 106 LOAD_LOCAL(value x4)
-> 106 IS_INSTANCE REF(class MyException)
-> 106 CZJUMP (BOOL)NE ? 5 : 8
-430,432d434
-< 101 JUMP 4
-<
-< 4:
-442,445d443
-< 106 LOAD_LOCAL(value x5)
-< 106 CALL_METHOD MyException.message (dynamic)
-< 106 STORE_LOCAL(value message)
-< 106 SCOPE_ENTER value message
-447c445,446
-< 106 LOAD_LOCAL(value message)
----
-> ? LOAD_LOCAL(value x5)
-> 106 CALL_METHOD MyException.message (dynamic)
-519c518
-< blocks: [1,2,3,4,6,7,9,10]
----
-> blocks: [1,3,4,6,7,9,10,11,12,13]
-548c547,552
-< 306 THROW(MyException)
----
-> ? JUMP 11
->
-> 11:
-> ? LOAD_LOCAL(variable monitor4)
-> 305 MONITOR_EXIT
-> ? JUMP 12
-554c558
-< ? THROW(Throwable)
----
-> ? JUMP 12
-560c564,571
-< ? THROW(Throwable)
----
-> ? STORE_LOCAL(value t)
-> ? JUMP 13
->
-> 12:
-> ? LOAD_LOCAL(variable monitor3)
-> 304 MONITOR_EXIT
-> ? STORE_LOCAL(value t)
-> ? JUMP 13
-574c585
-< 310 JUMP 2
----
-> 300 RETURN(UNIT)
-576c587,596
-< 2:
----
-> 13:
-> 310 LOAD_MODULE object Predef
-> 310 CALL_PRIMITIVE(StartConcat)
-> 310 CONSTANT("Caught crash: ")
-> 310 CALL_PRIMITIVE(StringConcat(REF(class String)))
-> 310 LOAD_LOCAL(value t)
-> 310 CALL_METHOD java.lang.Throwable.toString (dynamic)
-> 310 CALL_PRIMITIVE(StringConcat(REF(class String)))
-> 310 CALL_PRIMITIVE(EndConcat)
-> 310 CALL_METHOD scala.Predef.println (dynamic)
-584c604
-< catch (Throwable) in ArrayBuffer(7, 9, 10) starting at: 6
----
-> catch (Throwable) in ArrayBuffer(7, 9, 10, 11) starting at: 6
-587c607
-< catch (Throwable) in ArrayBuffer(4, 6, 7, 9, 10) starting at: 3
----
-> catch (Throwable) in ArrayBuffer(4, 6, 7, 9, 10, 11, 12) starting at: 3
-619c639
-< blocks: [1,3,4,5,6,8,9]
----
-> blocks: [1,3,4,5,6,8,9,10,11]
-643c663,669
-< 78 THROW(IllegalArgumentException)
----
-> ? STORE_LOCAL(value e)
-> ? JUMP 10
->
-> 10:
-> 81 LOAD_LOCAL(value e)
-> ? STORE_LOCAL(variable exc1)
-> ? JUMP 11
-669c695,696
-< 81 THROW(Exception)
----
-> ? STORE_LOCAL(variable exc1)
-> ? JUMP 11
-685a713,725
-> 11:
-> 83 LOAD_MODULE object Predef
-> 83 CONSTANT("finally")
-> 83 CALL_METHOD scala.Predef.println (dynamic)
-> 84 LOAD_LOCAL(variable result)
-> 84 CONSTANT(1)
-> 84 CALL_PRIMITIVE(Arithmetic(SUB,INT))
-> 84 CONSTANT(2)
-> 84 CALL_PRIMITIVE(Arithmetic(DIV,INT))
-> 84 STORE_LOCAL(variable result)
-> 84 LOAD_LOCAL(variable exc1)
-> 84 THROW(Throwable)
->
-691c731
-< catch (<none>) in ArrayBuffer(4, 5, 6, 8) starting at: 3
----
-> catch (<none>) in ArrayBuffer(4, 5, 6, 8, 10) starting at: 3
-715c755
-< locals: value args, variable result, value ex6, variable exc2, value x4, value x5, value message, value x, value ex6, value x4, value x5, value message, value x
----
-> locals: value args, variable result, value ex6, variable exc2, value x4, value x5, value x, value ex6, value x4, value x5, value x
-717c757
-< blocks: [1,3,4,5,6,9,13,14,15,18,20,21,23,24]
----
-> blocks: [1,3,4,5,6,9,13,14,15,18,20,21,23,24,25,26,27]
-741c781,788
-< 172 THROW(MyException)
----
-> ? STORE_LOCAL(value ex6)
-> ? JUMP 25
->
-> 25:
-> 170 LOAD_LOCAL(value ex6)
-> 170 STORE_LOCAL(value x4)
-> 170 SCOPE_ENTER value x4
-> 170 JUMP 14
-781,784d827
-< 175 LOAD_LOCAL(value x5)
-< 175 CALL_METHOD MyException.message (dynamic)
-< 175 STORE_LOCAL(value message)
-< 175 SCOPE_ENTER value message
-786c829,830
-< 176 LOAD_LOCAL(value message)
----
-> ? LOAD_LOCAL(value x5)
-> 176 CALL_METHOD MyException.message (dynamic)
-790c834,835
-< 177 LOAD_LOCAL(value message)
----
-> ? LOAD_LOCAL(value x5)
-> 177 CALL_METHOD MyException.message (dynamic)
-792c837,838
-< 177 THROW(MyException)
----
-> ? STORE_LOCAL(value ex6)
-> ? JUMP 26
-796c842,843
-< 170 THROW(Throwable)
----
-> ? STORE_LOCAL(value ex6)
-> ? JUMP 26
-805a853,858
-> 26:
-> 169 LOAD_LOCAL(value ex6)
-> 169 STORE_LOCAL(value x4)
-> 169 SCOPE_ENTER value x4
-> 169 JUMP 5
->
-816,819d868
-< 180 LOAD_LOCAL(value x5)
-< 180 CALL_METHOD MyException.message (dynamic)
-< 180 STORE_LOCAL(value message)
-< 180 SCOPE_ENTER value message
-821c870,871
-< 181 LOAD_LOCAL(value message)
----
-> ? LOAD_LOCAL(value x5)
-> 181 CALL_METHOD MyException.message (dynamic)
-825c875,876
-< 182 LOAD_LOCAL(value message)
----
-> ? LOAD_LOCAL(value x5)
-> 182 CALL_METHOD MyException.message (dynamic)
-827c878,879
-< 182 THROW(MyException)
----
-> ? STORE_LOCAL(variable exc2)
-> ? JUMP 27
-831c883,884
-< 169 THROW(Throwable)
----
-> ? STORE_LOCAL(variable exc2)
-> ? JUMP 27
-847a901,913
-> 27:
-> 184 LOAD_MODULE object Predef
-> 184 CONSTANT("finally")
-> 184 CALL_METHOD scala.Predef.println (dynamic)
-> 185 LOAD_LOCAL(variable result)
-> 185 CONSTANT(1)
-> 185 CALL_PRIMITIVE(Arithmetic(SUB,INT))
-> 185 CONSTANT(2)
-> 185 CALL_PRIMITIVE(Arithmetic(DIV,INT))
-> 185 STORE_LOCAL(variable result)
-> 185 LOAD_LOCAL(variable exc2)
-> 185 THROW(Throwable)
->
-853c919
-< catch (Throwable) in ArrayBuffer(13, 14, 15, 18, 20, 21, 23) starting at: 4
----
-> catch (Throwable) in ArrayBuffer(13, 14, 15, 18, 20, 21, 23, 25) starting at: 4
-856c922
-< catch (<none>) in ArrayBuffer(4, 5, 6, 9, 13, 14, 15, 18, 20, 21, 23) starting at: 3
----
-> catch (<none>) in ArrayBuffer(4, 5, 6, 9, 13, 14, 15, 18, 20, 21, 23, 25, 26) starting at: 3
-880c946
-< locals: value args, variable result, value e, value ex6, value x4, value x5, value message, value x
----
-> locals: value args, variable result, value e, value ex6, value x4, value x5, value x
-882c948
-< blocks: [1,2,3,6,7,8,11,13,14,16]
----
-> blocks: [1,2,3,6,7,8,11,13,14,16,17]
-906c972,979
-< 124 THROW(MyException)
----
-> ? STORE_LOCAL(value ex6)
-> ? JUMP 17
->
-> 17:
-> 122 LOAD_LOCAL(value ex6)
-> 122 STORE_LOCAL(value x4)
-> 122 SCOPE_ENTER value x4
-> 122 JUMP 7
-931,934d1003
-< 127 LOAD_LOCAL(value x5)
-< 127 CALL_METHOD MyException.message (dynamic)
-< 127 STORE_LOCAL(value message)
-< 127 SCOPE_ENTER value message
-936c1005,1006
-< 127 LOAD_LOCAL(value message)
----
-> ? LOAD_LOCAL(value x5)
-> 127 CALL_METHOD MyException.message (dynamic)
-965c1035
-< catch (IllegalArgumentException) in ArrayBuffer(6, 7, 8, 11, 13, 14, 16) starting at: 3
----
-> catch (IllegalArgumentException) in ArrayBuffer(6, 7, 8, 11, 13, 14, 16, 17) starting at: 3
-989c1059
-< locals: value args, variable result, value ex6, value x4, value x5, value message, value x, value e
----
-> locals: value args, variable result, value ex6, value x4, value x5, value x, value e
-991c1061
-< blocks: [1,2,3,4,5,8,12,13,14,16]
----
-> blocks: [1,2,3,5,8,12,13,14,16,17]
-1015c1085,1094
-< 148 THROW(MyException)
----
-> ? STORE_LOCAL(value ex6)
-> ? JUMP 17
->
-> 17:
-> 145 LOAD_LOCAL(value ex6)
-> 145 STORE_LOCAL(value x4)
-> 145 SCOPE_ENTER value x4
-> 154 LOAD_LOCAL(value x4)
-> 154 IS_INSTANCE REF(class MyException)
-> 154 CZJUMP (BOOL)NE ? 5 : 8
-1036,1038d1114
-< 145 JUMP 4
-<
-< 4:
-1048,1051d1123
-< 154 LOAD_LOCAL(value x5)
-< 154 CALL_METHOD MyException.message (dynamic)
-< 154 STORE_LOCAL(value message)
-< 154 SCOPE_ENTER value message
-1053c1125,1126
-< 154 LOAD_LOCAL(value message)
----
-> ? LOAD_LOCAL(value x5)
-> 154 CALL_METHOD MyException.message (dynamic)
-1270c1343
-< blocks: [1,2,3,4,5,7]
----
-> blocks: [1,2,3,4,5,7,8]
-1294c1367,1374
-< 38 THROW(IllegalArgumentException)
----
-> ? STORE_LOCAL(value e)
-> ? JUMP 8
->
-> 8:
-> 42 LOAD_MODULE object Predef
-> 42 CONSTANT("IllegalArgumentException")
-> 42 CALL_METHOD scala.Predef.println (dynamic)
-> 42 JUMP 2
-1341c1421
-< locals: value args, variable result, value ex6, value x4, value x5, value message, value x
----
-> locals: value args, variable result, value ex6, value x4, value x5, value x
-1343c1423
-< blocks: [1,2,3,4,5,8,10,11,13,14,16]
----
-> blocks: [1,2,3,5,8,10,11,13,14,16,17]
-1367c1447,1448
-< 203 THROW(MyException)
----
-> ? STORE_LOCAL(value ex6)
-> ? JUMP 17
-1387c1468,1477
-< 209 THROW(MyException)
----
-> ? STORE_LOCAL(value ex6)
-> ? JUMP 17
->
-> 17:
-> 200 LOAD_LOCAL(value ex6)
-> 200 STORE_LOCAL(value x4)
-> 200 SCOPE_ENTER value x4
-> 212 LOAD_LOCAL(value x4)
-> 212 IS_INSTANCE REF(class MyException)
-> 212 CZJUMP (BOOL)NE ? 5 : 8
-1400,1402d1489
-< 200 JUMP 4
-<
-< 4:
-1412,1415d1498
-< 212 LOAD_LOCAL(value x5)
-< 212 CALL_METHOD MyException.message (dynamic)
-< 212 STORE_LOCAL(value message)
-< 212 SCOPE_ENTER value message
-1417c1500,1501
-< 213 LOAD_LOCAL(value message)
----
-> ? LOAD_LOCAL(value x5)
-> 213 CALL_METHOD MyException.message (dynamic)
-1461c1545
-< blocks: [1,2,3,4,5,7]
----
-> blocks: [1,2,3,4,5,7,8]
-1485c1569,1570
-< 58 THROW(IllegalArgumentException)
----
-> ? STORE_LOCAL(value e)
-> ? JUMP 8
-1486a1572,1577
-> 8:
-> 62 LOAD_MODULE object Predef
-> 62 CONSTANT("RuntimeException")
-> 62 CALL_METHOD scala.Predef.println (dynamic)
-> 62 JUMP 2
->
-1534c1625
-< blocks: [1,3,4]
----
-> blocks: [1,3,4,5]
-1554c1645,1650
-< 229 THROW(MyException)
----
-> ? JUMP 5
->
-> 5:
-> ? LOAD_LOCAL(variable monitor1)
-> 228 MONITOR_EXIT
-> 228 THROW(Throwable)
-1560c1656
-< ? THROW(Throwable)
----
-> 228 THROW(Throwable)
-1588c1684
-< locals: value args, variable result, variable monitor2, variable monitorResult1
----
-> locals: value exception$1, value args, variable result, variable monitor2, variable monitorResult1
-1590c1686
-< blocks: [1,3,4]
----
-> blocks: [1,3,4,5]
-1613c1709,1717
-< 245 THROW(MyException)
----
-> ? STORE_LOCAL(value exception$1)
-> ? DROP ConcatClass
-> ? LOAD_LOCAL(value exception$1)
-> ? JUMP 5
->
-> 5:
-> ? LOAD_LOCAL(variable monitor2)
-> 244 MONITOR_EXIT
-> 244 THROW(Throwable)
-1619c1723
-< ? THROW(Throwable)
----
-> 244 THROW(Throwable)
-
+--- a
++++ b
+@@ -171,5 +171,5 @@
+ def productElement(x$1: Int (INT)): Object {
+- locals: value x$1, value x1
++ locals: value x$1, value x1, variable boxed1
+ startBlock: 1
+- blocks: [1,2,3,4]
++ blocks: [1,3,4]
+
+@@ -186,2 +186,4 @@
+ 92 LOAD_LOCAL(value x$1)
++ 92 STORE_LOCAL(variable boxed1)
++ 92 LOAD_LOCAL(variable boxed1)
+ 92 BOX INT
+@@ -194,5 +196,2 @@
+ 92 CALL_METHOD MyException.message (dynamic)
+- 92 JUMP 2
+-
+- 2:
+ 92 RETURN(REF(class Object))
+@@ -246,3 +245,3 @@
+ startBlock: 1
+- blocks: [1,2,3,4,5,6,7,8,11,12,13,14,15,16,17,18]
++ blocks: [1,2,3,4,5,6,8,11,12,13,14,15,16,17,18]
+
+@@ -257,5 +256,2 @@
+ 92 SCOPE_ENTER value x1
+- 92 JUMP 7
+-
+- 7:
+ 92 LOAD_LOCAL(value x1)
+@@ -390,5 +386,5 @@
+ def main(args: Array[String] (ARRAY[REF(class String)])): Unit {
+- locals: value args, variable result, value ex6, value x4, value x5, value message, value x
++ locals: value args, variable result, value ex6, value x4, value x5, value x
+ startBlock: 1
+- blocks: [1,2,3,4,5,8,10,11,13]
++ blocks: [1,2,3,5,8,10,11,13,14]
+
+@@ -416,4 +412,13 @@
+ 103 CALL_METHOD MyException.<init> (static-instance)
+- 103 THROW(MyException)
++ ? STORE_LOCAL(value ex6)
++ ? JUMP 14
+
++ 14:
++ 101 LOAD_LOCAL(value ex6)
++ 101 STORE_LOCAL(value x4)
++ 101 SCOPE_ENTER value x4
++ 106 LOAD_LOCAL(value x4)
++ 106 IS_INSTANCE REF(class MyException)
++ 106 CZJUMP (BOOL)NE ? 5 : 8
++
+ 13:
+@@ -429,5 +434,2 @@
+ 101 SCOPE_ENTER value x4
+- 101 JUMP 4
+-
+- 4:
+ 106 LOAD_LOCAL(value x4)
+@@ -441,8 +443,5 @@
+ 106 SCOPE_ENTER value x5
+- 106 LOAD_LOCAL(value x5)
+- 106 CALL_METHOD MyException.message (dynamic)
+- 106 STORE_LOCAL(value message)
+- 106 SCOPE_ENTER value message
+ 106 LOAD_MODULE object Predef
+- 106 LOAD_LOCAL(value message)
++ ? LOAD_LOCAL(value x5)
++ 106 CALL_METHOD MyException.message (dynamic)
+ 106 CALL_METHOD scala.Predef.println (dynamic)
+@@ -518,3 +517,3 @@
+ startBlock: 1
+- blocks: [1,2,3,4,6,7,9,10]
++ blocks: [1,3,4,6,7,9,10,11,12,13]
+
+@@ -547,4 +546,9 @@
+ 306 CALL_METHOD MyException.<init> (static-instance)
+- 306 THROW(MyException)
++ ? JUMP 11
+
++ 11:
++ ? LOAD_LOCAL(variable monitor4)
++ 305 MONITOR_EXIT
++ ? JUMP 12
++
+ 9:
+@@ -553,3 +557,3 @@
+ 305 MONITOR_EXIT
+- ? THROW(Throwable)
++ ? JUMP 12
+
+@@ -559,4 +563,11 @@
+ 304 MONITOR_EXIT
+- ? THROW(Throwable)
++ ? STORE_LOCAL(value t)
++ ? JUMP 13
+
++ 12:
++ ? LOAD_LOCAL(variable monitor3)
++ 304 MONITOR_EXIT
++ ? STORE_LOCAL(value t)
++ ? JUMP 13
++
+ 3:
+@@ -573,5 +584,14 @@
+ 310 CALL_METHOD scala.Predef.println (dynamic)
+- 310 JUMP 2
++ 300 RETURN(UNIT)
+
+- 2:
++ 13:
++ 310 LOAD_MODULE object Predef
++ 310 CALL_PRIMITIVE(StartConcat)
++ 310 CONSTANT("Caught crash: ")
++ 310 CALL_PRIMITIVE(StringConcat(REF(class String)))
++ 310 LOAD_LOCAL(value t)
++ 310 CALL_METHOD java.lang.Throwable.toString (dynamic)
++ 310 CALL_PRIMITIVE(StringConcat(REF(class String)))
++ 310 CALL_PRIMITIVE(EndConcat)
++ 310 CALL_METHOD scala.Predef.println (dynamic)
+ 300 RETURN(UNIT)
+@@ -583,6 +603,6 @@
+ with finalizer: null
+- catch (Throwable) in ArrayBuffer(7, 9, 10) starting at: 6
++ catch (Throwable) in ArrayBuffer(7, 9, 10, 11) starting at: 6
+ consisting of blocks: List(6)
+ with finalizer: null
+- catch (Throwable) in ArrayBuffer(4, 6, 7, 9, 10) starting at: 3
++ catch (Throwable) in ArrayBuffer(4, 6, 7, 9, 10, 11, 12) starting at: 3
+ consisting of blocks: List(3)
+@@ -618,3 +638,3 @@
+ startBlock: 1
+- blocks: [1,3,4,5,6,8,9]
++ blocks: [1,3,4,5,6,8,9,10,11]
+
+@@ -642,4 +662,10 @@
+ 78 CALL_METHOD java.lang.IllegalArgumentException.<init> (static-instance)
+- 78 THROW(IllegalArgumentException)
++ ? STORE_LOCAL(value e)
++ ? JUMP 10
+
++ 10:
++ 81 LOAD_LOCAL(value e)
++ ? STORE_LOCAL(variable exc1)
++ ? JUMP 11
++
+ 8:
+@@ -668,3 +694,4 @@
+ 81 LOAD_LOCAL(value e)
+- 81 THROW(Exception)
++ ? STORE_LOCAL(variable exc1)
++ ? JUMP 11
+
+@@ -685,2 +712,15 @@
+
++ 11:
++ 83 LOAD_MODULE object Predef
++ 83 CONSTANT("finally")
++ 83 CALL_METHOD scala.Predef.println (dynamic)
++ 84 LOAD_LOCAL(variable result)
++ 84 CONSTANT(1)
++ 84 CALL_PRIMITIVE(Arithmetic(SUB,INT))
++ 84 CONSTANT(2)
++ 84 CALL_PRIMITIVE(Arithmetic(DIV,INT))
++ 84 STORE_LOCAL(variable result)
++ 84 LOAD_LOCAL(variable exc1)
++ 84 THROW(Throwable)
++
+ }
+@@ -690,3 +730,3 @@
+ with finalizer: null
+- catch (<none>) in ArrayBuffer(4, 5, 6, 8) starting at: 3
++ catch (<none>) in ArrayBuffer(4, 5, 6, 8, 10) starting at: 3
+ consisting of blocks: List(3)
+@@ -714,5 +754,5 @@
+ def main(args: Array[String] (ARRAY[REF(class String)])): Unit {
+- locals: value args, variable result, value ex6, variable exc2, value x4, value x5, value message, value x, value ex6, value x4, value x5, value message, value x
++ locals: value args, variable result, value ex6, variable exc2, value x4, value x5, value x, value ex6, value x4, value x5, value x
+ startBlock: 1
+- blocks: [1,3,4,5,6,9,13,14,15,18,20,21,23,24]
++ blocks: [1,3,4,5,6,9,13,14,15,18,20,21,23,24,25,26,27]
+
+@@ -740,4 +780,11 @@
+ 172 CALL_METHOD MyException.<init> (static-instance)
+- 172 THROW(MyException)
++ ? STORE_LOCAL(value ex6)
++ ? JUMP 25
+
++ 25:
++ 170 LOAD_LOCAL(value ex6)
++ 170 STORE_LOCAL(value x4)
++ 170 SCOPE_ENTER value x4
++ 170 JUMP 14
++
+ 23:
+@@ -780,8 +827,5 @@
+ 175 SCOPE_ENTER value x5
+- 175 LOAD_LOCAL(value x5)
+- 175 CALL_METHOD MyException.message (dynamic)
+- 175 STORE_LOCAL(value message)
+- 175 SCOPE_ENTER value message
+ 176 LOAD_MODULE object Predef
+- 176 LOAD_LOCAL(value message)
++ ? LOAD_LOCAL(value x5)
++ 176 CALL_METHOD MyException.message (dynamic)
+ 176 CALL_METHOD scala.Predef.println (dynamic)
+@@ -789,5 +833,7 @@
+ 177 DUP(REF(class MyException))
+- 177 LOAD_LOCAL(value message)
++ ? LOAD_LOCAL(value x5)
++ 177 CALL_METHOD MyException.message (dynamic)
+ 177 CALL_METHOD MyException.<init> (static-instance)
+- 177 THROW(MyException)
++ ? STORE_LOCAL(value ex6)
++ ? JUMP 26
+
+@@ -795,3 +841,4 @@
+ 170 LOAD_LOCAL(value ex6)
+- 170 THROW(Throwable)
++ ? STORE_LOCAL(value ex6)
++ ? JUMP 26
+
+@@ -805,2 +852,8 @@
+
++ 26:
++ 169 LOAD_LOCAL(value ex6)
++ 169 STORE_LOCAL(value x4)
++ 169 SCOPE_ENTER value x4
++ 169 JUMP 5
++
+ 5:
+@@ -815,8 +868,5 @@
+ 180 SCOPE_ENTER value x5
+- 180 LOAD_LOCAL(value x5)
+- 180 CALL_METHOD MyException.message (dynamic)
+- 180 STORE_LOCAL(value message)
+- 180 SCOPE_ENTER value message
+ 181 LOAD_MODULE object Predef
+- 181 LOAD_LOCAL(value message)
++ ? LOAD_LOCAL(value x5)
++ 181 CALL_METHOD MyException.message (dynamic)
+ 181 CALL_METHOD scala.Predef.println (dynamic)
+@@ -824,5 +874,7 @@
+ 182 DUP(REF(class MyException))
+- 182 LOAD_LOCAL(value message)
++ ? LOAD_LOCAL(value x5)
++ 182 CALL_METHOD MyException.message (dynamic)
+ 182 CALL_METHOD MyException.<init> (static-instance)
+- 182 THROW(MyException)
++ ? STORE_LOCAL(variable exc2)
++ ? JUMP 27
+
+@@ -830,3 +882,4 @@
+ 169 LOAD_LOCAL(value ex6)
+- 169 THROW(Throwable)
++ ? STORE_LOCAL(variable exc2)
++ ? JUMP 27
+
+@@ -847,2 +900,15 @@
+
++ 27:
++ 184 LOAD_MODULE object Predef
++ 184 CONSTANT("finally")
++ 184 CALL_METHOD scala.Predef.println (dynamic)
++ 185 LOAD_LOCAL(variable result)
++ 185 CONSTANT(1)
++ 185 CALL_PRIMITIVE(Arithmetic(SUB,INT))
++ 185 CONSTANT(2)
++ 185 CALL_PRIMITIVE(Arithmetic(DIV,INT))
++ 185 STORE_LOCAL(variable result)
++ 185 LOAD_LOCAL(variable exc2)
++ 185 THROW(Throwable)
++
+ }
+@@ -852,6 +918,6 @@
+ with finalizer: null
+- catch (Throwable) in ArrayBuffer(13, 14, 15, 18, 20, 21, 23) starting at: 4
++ catch (Throwable) in ArrayBuffer(13, 14, 15, 18, 20, 21, 23, 25) starting at: 4
+ consisting of blocks: List(9, 8, 6, 5, 4)
+ with finalizer: null
+- catch (<none>) in ArrayBuffer(4, 5, 6, 9, 13, 14, 15, 18, 20, 21, 23) starting at: 3
++ catch (<none>) in ArrayBuffer(4, 5, 6, 9, 13, 14, 15, 18, 20, 21, 23, 25, 26) starting at: 3
+ consisting of blocks: List(3)
+@@ -879,5 +945,5 @@
+ def main(args: Array[String] (ARRAY[REF(class String)])): Unit {
+- locals: value args, variable result, value e, value ex6, value x4, value x5, value message, value x
++ locals: value args, variable result, value e, value ex6, value x4, value x5, value x
+ startBlock: 1
+- blocks: [1,2,3,6,7,8,11,13,14,16]
++ blocks: [1,2,3,6,7,8,11,13,14,16,17]
+
+@@ -905,4 +971,11 @@
+ 124 CALL_METHOD MyException.<init> (static-instance)
+- 124 THROW(MyException)
++ ? STORE_LOCAL(value ex6)
++ ? JUMP 17
+
++ 17:
++ 122 LOAD_LOCAL(value ex6)
++ 122 STORE_LOCAL(value x4)
++ 122 SCOPE_ENTER value x4
++ 122 JUMP 7
++
+ 16:
+@@ -930,8 +1003,5 @@
+ 127 SCOPE_ENTER value x5
+- 127 LOAD_LOCAL(value x5)
+- 127 CALL_METHOD MyException.message (dynamic)
+- 127 STORE_LOCAL(value message)
+- 127 SCOPE_ENTER value message
+ 127 LOAD_MODULE object Predef
+- 127 LOAD_LOCAL(value message)
++ ? LOAD_LOCAL(value x5)
++ 127 CALL_METHOD MyException.message (dynamic)
+ 127 CALL_METHOD scala.Predef.println (dynamic)
+@@ -964,3 +1034,3 @@
+ with finalizer: null
+- catch (IllegalArgumentException) in ArrayBuffer(6, 7, 8, 11, 13, 14, 16) starting at: 3
++ catch (IllegalArgumentException) in ArrayBuffer(6, 7, 8, 11, 13, 14, 16, 17) starting at: 3
+ consisting of blocks: List(3)
+@@ -988,5 +1058,5 @@
+ def main(args: Array[String] (ARRAY[REF(class String)])): Unit {
+- locals: value args, variable result, value ex6, value x4, value x5, value message, value x, value e
++ locals: value args, variable result, value ex6, value x4, value x5, value x, value e
+ startBlock: 1
+- blocks: [1,2,3,4,5,8,12,13,14,16]
++ blocks: [1,2,3,5,8,12,13,14,16,17]
+
+@@ -1014,4 +1084,13 @@
+ 148 CALL_METHOD MyException.<init> (static-instance)
+- 148 THROW(MyException)
++ ? STORE_LOCAL(value ex6)
++ ? JUMP 17
+
++ 17:
++ 145 LOAD_LOCAL(value ex6)
++ 145 STORE_LOCAL(value x4)
++ 145 SCOPE_ENTER value x4
++ 154 LOAD_LOCAL(value x4)
++ 154 IS_INSTANCE REF(class MyException)
++ 154 CZJUMP (BOOL)NE ? 5 : 8
++
+ 16:
+@@ -1035,5 +1114,2 @@
+ 145 SCOPE_ENTER value x4
+- 145 JUMP 4
+-
+- 4:
+ 154 LOAD_LOCAL(value x4)
+@@ -1047,8 +1123,5 @@
+ 154 SCOPE_ENTER value x5
+- 154 LOAD_LOCAL(value x5)
+- 154 CALL_METHOD MyException.message (dynamic)
+- 154 STORE_LOCAL(value message)
+- 154 SCOPE_ENTER value message
+ 154 LOAD_MODULE object Predef
+- 154 LOAD_LOCAL(value message)
++ ? LOAD_LOCAL(value x5)
++ 154 CALL_METHOD MyException.message (dynamic)
+ 154 CALL_METHOD scala.Predef.println (dynamic)
+@@ -1269,3 +1342,3 @@
+ startBlock: 1
+- blocks: [1,2,3,4,5,7]
++ blocks: [1,2,3,4,5,7,8]
+
+@@ -1293,4 +1366,11 @@
+ 38 CALL_METHOD java.lang.IllegalArgumentException.<init> (static-instance)
+- 38 THROW(IllegalArgumentException)
++ ? STORE_LOCAL(value e)
++ ? JUMP 8
+
++ 8:
++ 42 LOAD_MODULE object Predef
++ 42 CONSTANT("IllegalArgumentException")
++ 42 CALL_METHOD scala.Predef.println (dynamic)
++ 42 JUMP 2
++
+ 7:
+@@ -1340,5 +1420,5 @@
+ def main(args: Array[String] (ARRAY[REF(class String)])): Unit {
+- locals: value args, variable result, value ex6, value x4, value x5, value message, value x
++ locals: value args, variable result, value ex6, value x4, value x5, value x
+ startBlock: 1
+- blocks: [1,2,3,4,5,8,10,11,13,14,16]
++ blocks: [1,2,3,5,8,10,11,13,14,16,17]
+
+@@ -1366,3 +1446,4 @@
+ 203 CALL_METHOD MyException.<init> (static-instance)
+- 203 THROW(MyException)
++ ? STORE_LOCAL(value ex6)
++ ? JUMP 17
+
+@@ -1386,4 +1467,13 @@
+ 209 CALL_METHOD MyException.<init> (static-instance)
+- 209 THROW(MyException)
++ ? STORE_LOCAL(value ex6)
++ ? JUMP 17
+
++ 17:
++ 200 LOAD_LOCAL(value ex6)
++ 200 STORE_LOCAL(value x4)
++ 200 SCOPE_ENTER value x4
++ 212 LOAD_LOCAL(value x4)
++ 212 IS_INSTANCE REF(class MyException)
++ 212 CZJUMP (BOOL)NE ? 5 : 8
++
+ 16:
+@@ -1399,5 +1489,2 @@
+ 200 SCOPE_ENTER value x4
+- 200 JUMP 4
+-
+- 4:
+ 212 LOAD_LOCAL(value x4)
+@@ -1411,8 +1498,5 @@
+ 212 SCOPE_ENTER value x5
+- 212 LOAD_LOCAL(value x5)
+- 212 CALL_METHOD MyException.message (dynamic)
+- 212 STORE_LOCAL(value message)
+- 212 SCOPE_ENTER value message
+ 213 LOAD_MODULE object Predef
+- 213 LOAD_LOCAL(value message)
++ ? LOAD_LOCAL(value x5)
++ 213 CALL_METHOD MyException.message (dynamic)
+ 213 CALL_METHOD scala.Predef.println (dynamic)
+@@ -1460,3 +1544,3 @@
+ startBlock: 1
+- blocks: [1,2,3,4,5,7]
++ blocks: [1,2,3,4,5,7,8]
+
+@@ -1484,4 +1568,11 @@
+ 58 CALL_METHOD java.lang.IllegalArgumentException.<init> (static-instance)
+- 58 THROW(IllegalArgumentException)
++ ? STORE_LOCAL(value e)
++ ? JUMP 8
+
++ 8:
++ 62 LOAD_MODULE object Predef
++ 62 CONSTANT("RuntimeException")
++ 62 CALL_METHOD scala.Predef.println (dynamic)
++ 62 JUMP 2
++
+ 7:
+@@ -1533,3 +1624,3 @@
+ startBlock: 1
+- blocks: [1,3,4]
++ blocks: [1,3,4,5]
+
+@@ -1553,4 +1644,9 @@
+ 229 CALL_METHOD MyException.<init> (static-instance)
+- 229 THROW(MyException)
++ ? JUMP 5
+
++ 5:
++ ? LOAD_LOCAL(variable monitor1)
++ 228 MONITOR_EXIT
++ 228 THROW(Throwable)
++
+ 3:
+@@ -1559,3 +1655,3 @@
+ 228 MONITOR_EXIT
+- ? THROW(Throwable)
++ 228 THROW(Throwable)
+
+@@ -1587,5 +1683,5 @@
+ def main(args: Array[String] (ARRAY[REF(class String)])): Unit {
+- locals: value args, variable result, variable monitor2, variable monitorResult1
++ locals: value exception$1, value args, variable result, variable monitor2, variable monitorResult1
+ startBlock: 1
+- blocks: [1,3,4]
++ blocks: [1,3,4,5]
+
+@@ -1612,4 +1708,12 @@
+ 245 CALL_METHOD MyException.<init> (static-instance)
+- 245 THROW(MyException)
++ ? STORE_LOCAL(value exception$1)
++ ? DROP ConcatClass
++ ? LOAD_LOCAL(value exception$1)
++ ? JUMP 5
+
++ 5:
++ ? LOAD_LOCAL(variable monitor2)
++ 244 MONITOR_EXIT
++ 244 THROW(Throwable)
++
+ 3:
+@@ -1618,3 +1722,3 @@
+ 244 MONITOR_EXIT
+- ? THROW(Throwable)
++ 244 THROW(Throwable)
+
diff --git a/test/files/run/iterator-concat.check b/test/files/run/iterator-concat.check
new file mode 100644
index 0000000000..23835b07ae
--- /dev/null
+++ b/test/files/run/iterator-concat.check
@@ -0,0 +1,4 @@
+100
+1000
+10000
+100000
diff --git a/test/files/run/iterator-concat.scala b/test/files/run/iterator-concat.scala
new file mode 100644
index 0000000000..f11363410f
--- /dev/null
+++ b/test/files/run/iterator-concat.scala
@@ -0,0 +1,15 @@
+object Test {
+ // Create `size` Function0s, each of which evaluates to an Iterator
+ // which produces 1. Then fold them over ++ to get a single iterator,
+ // which should sum to "size".
+ def mk(size: Int): Iterator[Int] = {
+ val closures = (1 to size).toList.map(x => (() => Iterator(1)))
+ closures.foldLeft(Iterator.empty: Iterator[Int])((res, f) => res ++ f())
+ }
+ def main(args: Array[String]): Unit = {
+ println(mk(100).sum)
+ println(mk(1000).sum)
+ println(mk(10000).sum)
+ println(mk(100000).sum)
+ }
+}
diff --git a/test/files/run/outertest.scala b/test/files/run/outertest.scala
index 3cc96afa5b..fa0443f669 100644
--- a/test/files/run/outertest.scala
+++ b/test/files/run/outertest.scala
@@ -1,26 +1,57 @@
// A test for the case where the outer field of class B#J should be eliminated.
-// You can verify this by running a javap on B.J
+
+import reflect.ClassTag
+
abstract class A {
+ abstract class I
- abstract class I {
+ val foo = this
+}
+class B extends A {
+ class J extends I {
+ val bar = foo
}
- val foo = "foo"
+ type II = I
+ class K extends II {
+ val bar = foo
+ }
+ class L extends (I @annotation.tailrec) {
+ val bar = foo
+ }
}
-class B extends A {
- class J extends I {
+class C extends A {
+ val c: C = this
+
+ class M extends c.I {
val bar = foo
}
-
}
-object Test extends App {
+object Test extends App {
val b = new B
- assert((new b.J).bar == b.foo)
+ val c0 = new C
+ val c = new { override val c = c0 } with C
+
+ assert((new b.J).bar eq b)
+ assert((new b.K).bar eq b)
+ assert((new b.L).bar eq b)
+ assert((new c.M).bar eq c)
+
+ def checkOuterFields[C: ClassTag](expected: Int) {
+ val cls = implicitly[ClassTag[C]].runtimeClass
+ val outerFields = cls.getDeclaredFields().filter(_.getName.contains("$outer"))
+ assert(outerFields.size == expected, outerFields.map(_.getName))
+ }
+ checkOuterFields[A#I](1) // the base class must have the $outer pointer
+ checkOuterFields[B#J](0) // reuse parent class' $outer pointer
+ checkOuterFields[B#K](0) // ... through an alias
+ checkOuterFields[B#L](0) // ... through the annotated type
+ checkOuterFields[C#M](1) // different prefix, can't share.
}
diff --git a/test/files/run/reify_this.scala b/test/files/run/reify_this.scala
index ecbf394bba..c385da6360 100644
--- a/test/files/run/reify_this.scala
+++ b/test/files/run/reify_this.scala
@@ -1,11 +1,11 @@
import scala.reflect.runtime.universe._
import scala.tools.reflect.Eval
-trait Eval {
+trait Transvaal {
def eval(tree: Expr[_]) = tree.eval
}
-object Test extends App with Eval {
+object Test extends App with Transvaal {
// select a value from package
eval(reify{println("foo")})
eval(reify{println((new Object).toString == (new Object).toString)})
@@ -17,4 +17,4 @@ object Test extends App with Eval {
// select a value from module
val x = 2
eval(reify{println(x)})
-} \ No newline at end of file
+}
diff --git a/test/files/run/t3994.scala b/test/files/run/t3994.scala
new file mode 100644
index 0000000000..0ee1d9d966
--- /dev/null
+++ b/test/files/run/t3994.scala
@@ -0,0 +1,20 @@
+trait T {
+ trait Default { def foo = this }
+ object Default extends Default
+}
+
+class Crash { // if you change this to a `trait` it keeps failing, though if it is an `object` it compiles just fine!
+ class Element
+
+ /* declare this as a class, and the crash goes away */
+ trait ElementOrdering extends Ordering[Element] {
+ def compare(a: Element, b: Element): Int = 0
+ }
+
+ implicit object ElementOrdering extends ElementOrdering
+}
+
+object Test extends App {
+ (new T {}).Default
+ (new Crash).ElementOrdering
+}
diff --git a/test/files/run/t5699.check b/test/files/run/t5699.check
new file mode 100755
index 0000000000..df19644ae6
--- /dev/null
+++ b/test/files/run/t5699.check
@@ -0,0 +1,11 @@
+[[syntax trees at end of parser]] // annodef.java
+package <empty> {
+ object MyAnnotation extends {
+ def <init>() = _
+ };
+ class MyAnnotation extends scala.annotation.Annotation with _root_.java.lang.annotation.Annotation with scala.annotation.ClassfileAnnotation {
+ def <init>() = _;
+ def value(): String
+ }
+}
+
diff --git a/test/files/run/t5699.scala b/test/files/run/t5699.scala
new file mode 100755
index 0000000000..5cef67e3b1
--- /dev/null
+++ b/test/files/run/t5699.scala
@@ -0,0 +1,24 @@
+import scala.tools.partest.DirectTest
+import scala.tools.nsc.util.BatchSourceFile
+
+object Test extends DirectTest {
+ // Java code
+ override def code = """
+ |public @interface MyAnnotation { String value(); }
+ """.stripMargin
+
+ override def extraSettings: String = "-usejavacp -Ystop-after:typer -Xprint:parser"
+
+ override def show(): Unit = {
+ // redirect err to out, for logging
+ val prevErr = System.err
+ System.setErr(System.out)
+ compile()
+ System.setErr(prevErr)
+ }
+
+ override def newSources(sourceCodes: String*) = {
+ assert(sourceCodes.size == 1)
+ List(new BatchSourceFile("annodef.java", sourceCodes(0)))
+ }
+}
diff --git a/test/files/run/t6028.check b/test/files/run/t6028.check
index 67c30e35c6..2ec639fce2 100644
--- a/test/files/run/t6028.check
+++ b/test/files/run/t6028.check
@@ -1,7 +1,7 @@
[[syntax trees at end of lambdalift]] // newSource1
package <empty> {
class T extends Object {
- <paramaccessor> val T$$classParam: Int = _;
+ <paramaccessor> val classParam: Int = _;
def <init>(classParam: Int): T = {
T.super.<init>();
()
@@ -30,15 +30,15 @@ package <empty> {
()
};
final def apply(): Int = $anonfun$foo$1.this.apply$mcI$sp();
- <specialized> def apply$mcI$sp(): Int = $anonfun$foo$1.this.$outer.T$$classParam.+($anonfun$foo$1.this.$outer.field()).+($anonfun$foo$1.this.methodParam$1).+($anonfun$foo$1.this.methodLocal$1);
+ <specialized> def apply$mcI$sp(): Int = $anonfun$foo$1.this.$outer.classParam.+($anonfun$foo$1.this.$outer.field()).+($anonfun$foo$1.this.methodParam$1).+($anonfun$foo$1.this.methodLocal$1);
<synthetic> <paramaccessor> <artifact> private[this] val $outer: T = _;
- <synthetic> <stable> <artifact> def T$$anonfun$$$outer(): T = $anonfun$foo$1.this.$outer;
+ <synthetic> <stable> <artifact> def $outer(): T = $anonfun$foo$1.this.$outer;
final <bridge> <artifact> def apply(): Object = scala.Int.box($anonfun$foo$1.this.apply());
<synthetic> <paramaccessor> private[this] val methodParam$1: Int = _;
<synthetic> <paramaccessor> private[this] val methodLocal$1: Int = _
};
abstract trait MethodLocalTrait$1 extends Object {
- <synthetic> <stable> <artifact> def T$MethodLocalTrait$$$outer(): T
+ <synthetic> <stable> <artifact> def $outer(): T
};
object MethodLocalObject$2 extends Object with T#MethodLocalTrait$1 {
def <init>($outer: T, barParam$1: Int): T#MethodLocalObject$2.type = {
@@ -47,8 +47,8 @@ package <empty> {
()
};
<synthetic> <paramaccessor> <artifact> private[this] val $outer: T = _;
- <synthetic> <stable> <artifact> def T$MethodLocalObject$$$outer(): T = MethodLocalObject$2.this.$outer;
- <synthetic> <stable> <artifact> def T$MethodLocalTrait$$$outer(): T = MethodLocalObject$2.this.$outer
+ <synthetic> <stable> <artifact> def $outer(): T = MethodLocalObject$2.this.$outer;
+ <synthetic> <stable> <artifact> def $outer(): T = MethodLocalObject$2.this.$outer
};
final <stable> private[this] def MethodLocalObject$1(barParam$1: Int, MethodLocalObject$module$1: runtime.VolatileObjectRef): T#MethodLocalObject$2.type = {
MethodLocalObject$module$1.elem = new T#MethodLocalObject$2.type(T.this, barParam$1);
@@ -70,7 +70,7 @@ package <empty> {
$anonfun$tryy$1.this.tryyLocal$1.elem = $anonfun$tryy$1.this.tryyParam$1
} finally ();
<synthetic> <paramaccessor> <artifact> private[this] val $outer: T = _;
- <synthetic> <stable> <artifact> def T$$anonfun$$$outer(): T = $anonfun$tryy$1.this.$outer;
+ <synthetic> <stable> <artifact> def $outer(): T = $anonfun$tryy$1.this.$outer;
final <bridge> <artifact> def apply(): Object = {
$anonfun$tryy$1.this.apply();
scala.runtime.BoxedUnit.UNIT
diff --git a/test/files/run/t6146b.check b/test/files/run/t6146b.check
index b664d1152a..49ff70697e 100644
--- a/test/files/run/t6146b.check
+++ b/test/files/run/t6146b.check
@@ -37,8 +37,15 @@ memType: (sub: u.Type, scrut: u.Type)u.Type
scala>
-scala> memType(S1, fTpe)
-res0: u.Type = O.X.S1.type
+scala> val mt1 = memType(S1, fTpe)
+mt1: u.Type = O.X.S1.type
+
+scala> global.typeDeconstruct.show(mt1)
+res0: String =
+TypeRef(
+ pre = SingleType(pre = ThisType(object O), object X)
+ TypeSymbol(class S1 extends C.this.F[T])
+)
scala> memType(S2, fTpe)
res1: u.Type = O.S2
diff --git a/test/files/run/t6146b.scala b/test/files/run/t6146b.scala
index adcd40d2ee..e63709aa9d 100644
--- a/test/files/run/t6146b.scala
+++ b/test/files/run/t6146b.scala
@@ -31,7 +31,8 @@ val fTpe = typeOf[O.type].decl(newTermName("foo")).paramss.head.head.tpe
def memType(sub: Type, scrut: Type): Type =
nestedMemberType(sub.typeSymbol, scrut.prefix, scrut.typeSymbol.owner)
-memType(S1, fTpe)
+val mt1 = memType(S1, fTpe)
+global.typeDeconstruct.show(mt1)
memType(S2, fTpe)
memType(S3, fTpe)
memType(S4, fTpe)
diff --git a/test/files/run/t6168/Context.java b/test/files/run/t6168/Context.java
new file mode 100644
index 0000000000..e527844563
--- /dev/null
+++ b/test/files/run/t6168/Context.java
@@ -0,0 +1,34 @@
+public class Context<ParentType> {
+ private ParentType parent;
+
+ public Context() {}
+
+ public ParentType getParent() {
+ return parent;
+ }
+
+ public void setParent(ParentType parent) {
+ this.parent = parent;
+ }
+
+ public Field<Integer> intField() {
+ return new Field<Integer>() {
+ @Override
+ public Integer get() {
+ return 0;
+ }
+
+ @Override
+ public ParentType set(Integer t) {
+ return parent;
+ }
+ };
+ }
+
+ public abstract class Field<T> { //Note this is a path dependent type
+
+ public abstract T get();
+
+ public abstract ParentType set(T t);
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t6168/JavaTest.java b/test/files/run/t6168/JavaTest.java
new file mode 100644
index 0000000000..94ae91661d
--- /dev/null
+++ b/test/files/run/t6168/JavaTest.java
@@ -0,0 +1,8 @@
+public class JavaTest {
+ public static void main(String[] args) {
+ SomeClass a = new SomeClass();
+ SomeClass2 a2 = new SomeClass2();
+ SomeClass b = a.f.set(23).f.set(23);
+ SomeClass2 b2 = a2.f.set(23).f.set(23);
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t6168/SomeClass.java b/test/files/run/t6168/SomeClass.java
new file mode 100644
index 0000000000..6f76b829bb
--- /dev/null
+++ b/test/files/run/t6168/SomeClass.java
@@ -0,0 +1,14 @@
+public class SomeClass {
+ private final Context<SomeClass> context = new Context<SomeClass>();
+ {
+ context.setParent(this);
+ }
+
+ public final Context<SomeClass>.Field<Integer> f = context.intField();
+
+ public SomeClass() {
+ f.set(23).f.set(23);
+ }
+}
+
+
diff --git a/test/files/run/t6168/SomeClass2.java b/test/files/run/t6168/SomeClass2.java
new file mode 100644
index 0000000000..b2c7a7540b
--- /dev/null
+++ b/test/files/run/t6168/SomeClass2.java
@@ -0,0 +1,12 @@
+public class SomeClass2 {
+ private final Context<SomeClass2> context = new Context<SomeClass2>();
+ {
+ context.setParent(this);
+ }
+
+ public final Context<SomeClass2>.Field<Integer> f = context.intField();
+
+ public SomeClass2() {
+ f.set(23).f.set(23);
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t6168/main.scala b/test/files/run/t6168/main.scala
new file mode 100644
index 0000000000..c7ad37830b
--- /dev/null
+++ b/test/files/run/t6168/main.scala
@@ -0,0 +1,15 @@
+
+
+object Test extends App {
+ JavaTest.main(null)
+
+ var a1 : SomeClass = new SomeClass
+ var a2 : SomeClass2 = new SomeClass2
+ //import language.implicitConversions
+ //implicit def setParentType2SomeClass(x:Any) = x.asInstanceOf[SomeClass]
+ //implicit def setParentType2SomeClass2(x:Any) = x.asInstanceOf[SomeClass2]
+ //var b : SomeClass = a.f.set(23).asInstanceOf[SomeClass].f.set(23).asInstanceOf[SomeClass]
+ //var b2 : SomeClass2 = a2.f.set(23).asInstanceOf[SomeClass2].f.set(23).asInstanceOf[SomeClass2]
+ var b1 : SomeClass = a1.f.set(23).f.set(23)
+ var b2 : SomeClass2 = a2.f.set(23).f.set(23)
+}
diff --git a/test/files/run/t6168b/Context.java b/test/files/run/t6168b/Context.java
new file mode 100644
index 0000000000..b3ea22126f
--- /dev/null
+++ b/test/files/run/t6168b/Context.java
@@ -0,0 +1,34 @@
+public class Context<ParentType> {
+ private ParentType parent;
+
+ public Context() {}
+
+ public ParentType getParent() {
+ return parent;
+ }
+
+ public void setParent(ParentType parent) {
+ this.parent = parent;
+ }
+
+ public Field<Integer> intField() {
+ return new Field<Integer>() {
+ @Override
+ public Integer get() {
+ return 0;
+ }
+
+ @Override
+ public ParentType set(Integer t) {
+ return parent;
+ }
+ };
+ }
+
+ public static abstract class Field<T> {
+
+ public abstract T get();
+
+ public abstract Object set(T t);
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t6168b/JavaTest.java b/test/files/run/t6168b/JavaTest.java
new file mode 100644
index 0000000000..a09fa0382d
--- /dev/null
+++ b/test/files/run/t6168b/JavaTest.java
@@ -0,0 +1,6 @@
+public class JavaTest {
+ public static void main(String[] args) {
+ SomeClass a = new SomeClass();
+ Object b = a.f.set(23);
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t6168b/SomeClass.java b/test/files/run/t6168b/SomeClass.java
new file mode 100644
index 0000000000..566c55e1c5
--- /dev/null
+++ b/test/files/run/t6168b/SomeClass.java
@@ -0,0 +1,11 @@
+public class SomeClass {
+ private final Context<SomeClass> context = new Context<SomeClass>();
+ {
+ context.setParent(this);
+ }
+
+ public final Context.Field<Integer> f = context.intField();
+
+}
+
+
diff --git a/test/files/run/t6168b/main.scala b/test/files/run/t6168b/main.scala
new file mode 100644
index 0000000000..187e9fe85e
--- /dev/null
+++ b/test/files/run/t6168b/main.scala
@@ -0,0 +1,8 @@
+
+
+object Test extends App {
+ JavaTest.main(null)
+
+ var a1 : SomeClass = new SomeClass
+ var b1 : Object = a1.f.set(23)
+}
diff --git a/test/files/run/t6223.scala b/test/files/run/t6223.scala
index fb176e32e6..0996ea1c45 100644
--- a/test/files/run/t6223.scala
+++ b/test/files/run/t6223.scala
@@ -5,7 +5,7 @@ class Foo[@specialized(Int) A](a:A) {
object Test {
def main(args:Array[String]) {
val f = new Foo(333)
- val ms = f.getClass().getDeclaredMethods().sortBy(_.getName)
- ms.foreach(m => println(m.getName))
+ val ms = f.getClass().getDeclaredMethods().map(_.getName).sorted
+ ms.foreach(println)
}
}
diff --git a/test/files/run/t6387.check b/test/files/run/t6387.check
new file mode 100644
index 0000000000..83b33d238d
--- /dev/null
+++ b/test/files/run/t6387.check
@@ -0,0 +1 @@
+1000
diff --git a/test/files/run/t6387.scala b/test/files/run/t6387.scala
new file mode 100644
index 0000000000..bbebb5f511
--- /dev/null
+++ b/test/files/run/t6387.scala
@@ -0,0 +1,16 @@
+trait A {
+ def foo: Long
+}
+
+object Test {
+ def a(): A = new A {
+ var foo: Long = 1000L
+
+ val test = () => {
+ foo = 28
+ }
+ }
+ def main(args: Array[String]) {
+ println(a().foo)
+ }
+}
diff --git a/test/files/run/t6715.scala b/test/files/run/t6715.scala
new file mode 100644
index 0000000000..07ff34218a
--- /dev/null
+++ b/test/files/run/t6715.scala
@@ -0,0 +1,15 @@
+import scala.reflect.runtime.universe._
+
+class A {
+ def $$ = 1
+ def $times = 1
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ val memberSet: Set[String] = typeOf[A].members.map{ _.toString }.toSet
+ assert(memberSet contains "method *")
+ assert(memberSet contains "method $$")
+ assert(! (memberSet contains "method"))
+ }
+}
diff --git a/test/files/run/t6725-1.check b/test/files/run/t6725-1.check
new file mode 100644
index 0000000000..6ed281c757
--- /dev/null
+++ b/test/files/run/t6725-1.check
@@ -0,0 +1,2 @@
+1
+1
diff --git a/test/files/run/t6725-1.scala b/test/files/run/t6725-1.scala
new file mode 100644
index 0000000000..a167ef8aa3
--- /dev/null
+++ b/test/files/run/t6725-1.scala
@@ -0,0 +1,5 @@
+object Test extends App {
+ val a = 1
+ val s = f"$a%s%n$a%s"
+ println(s)
+} \ No newline at end of file
diff --git a/test/files/run/t6725-2.check b/test/files/run/t6725-2.check
new file mode 100644
index 0000000000..3496917ad5
--- /dev/null
+++ b/test/files/run/t6725-2.check
@@ -0,0 +1,8 @@
+
+
+aaaa
+
+
+aaaa
+aaaa
+aaaa
diff --git a/test/files/run/t6725-2.scala b/test/files/run/t6725-2.scala
new file mode 100644
index 0000000000..e033cf5ea8
--- /dev/null
+++ b/test/files/run/t6725-2.scala
@@ -0,0 +1,6 @@
+object Test extends App {
+ println(f"%n")
+ println(f"aaaa%n")
+ println(f"%naaaa")
+ println(f"aaaa%naaaa")
+} \ No newline at end of file
diff --git a/test/files/run/t6793.scala b/test/files/run/t6793.scala
new file mode 100644
index 0000000000..0b1f1619af
--- /dev/null
+++ b/test/files/run/t6793.scala
@@ -0,0 +1,9 @@
+package a { class C1(private[a] val v0: String) }
+package b { class C2(v1: String) extends a.C1(v1) { def foo = v1 } }
+
+object Test extends App {
+ new b.C2("x")
+
+ val c2Fields = classOf[b.C2].getDeclaredFields
+ assert(c2Fields.size == 1, c2Fields.map(_.getName).toList)
+}
diff --git a/test/files/run/t6793b.scala b/test/files/run/t6793b.scala
new file mode 100644
index 0000000000..cb3f2fb2fa
--- /dev/null
+++ b/test/files/run/t6793b.scala
@@ -0,0 +1,11 @@
+package a {
+ class C1(val v0: String)
+ class C2(v1: String) extends a.C1(v1) { def foo = v1 }
+}
+
+object Test extends App {
+ new a.C2("x")
+
+ val c2Fields = classOf[a.C2].getDeclaredFields
+ assert(c2Fields.isEmpty, c2Fields.map(_.getName).mkString(", "))
+}
diff --git a/test/files/run/t6793c.scala b/test/files/run/t6793c.scala
new file mode 100644
index 0000000000..e28c7c81a1
--- /dev/null
+++ b/test/files/run/t6793c.scala
@@ -0,0 +1,11 @@
+package a {
+ class C1(private[a] val v0: String)
+ class C2(v1: String) extends a.C1(v1) { def foo = v1 }
+}
+
+object Test extends App {
+ new a.C2("x").foo
+
+ val c2Fields = classOf[a.C2].getDeclaredFields
+ assert(c2Fields.isEmpty, c2Fields.map(_.getName).toList)
+}
diff --git a/test/files/run/t6900.scala b/test/files/run/t6900.scala
new file mode 100644
index 0000000000..a29d388129
--- /dev/null
+++ b/test/files/run/t6900.scala
@@ -0,0 +1,36 @@
+import annotation.tailrec
+
+trait Universe {
+ type T <: AnyRef
+}
+
+final class Bug {
+ var i = 1
+ def stop() = { i -= 1; i < 0 }
+ // the alias bypasses the fast path in erasures InfoTransformer
+ // predicated on `TypeMap.noChangeToSymbols`
+ type Alias = Any
+
+ @tailrec
+ // So we get two symbols for `universe`, the original on the ValDef
+ // and a clone in the MethodType of `f`.
+ def f(universe: Universe, l: Alias): universe.T = {
+ if (stop()) null.asInstanceOf[universe.T] else f(universe, null)
+ }
+
+ @tailrec
+ def g(universe: Universe)(l: Alias): universe.T = {
+ if (stop()) null.asInstanceOf[universe.T] else g(universe)(l)
+ }
+
+ @tailrec
+ def h(universe: Universe)(l: List[universe.T]): List[universe.T] = {
+ if (stop()) Nil else h(universe)(l)
+ }
+}
+
+object Test extends App {
+ assert(new Bug().f(null, null) == null)
+ assert(new Bug().g(null)(null) == null)
+ assert(new Bug().h(null)(null) == Nil)
+} \ No newline at end of file
diff --git a/test/files/run/t7240.check b/test/files/run/t7240.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/run/t7240.check
diff --git a/test/files/run/t7240/Macros_1.scala b/test/files/run/t7240/Macros_1.scala
new file mode 100644
index 0000000000..6465e18760
--- /dev/null
+++ b/test/files/run/t7240/Macros_1.scala
@@ -0,0 +1,48 @@
+package bakery
+
+import scala.language.experimental.macros
+import scala.reflect.macros.Context
+
+trait FailureCake {
+ implicit def liftAnyFails[T: Manifest]: Any = ???
+
+ // This works
+ // implicit def liftAny[T]: Any = ???
+}
+
+object Bakery {
+
+ def failure: Any = macro failureImpl
+ def failureImpl(c: Context): c.Expr[Any] = {
+ import c.universe._
+
+ def dslTrait(dslName: String) = {
+ val names = dslName.split("\\.").toList.reverse
+ assert(names.length >= 1, "DSL trait name must be in the valid format. DSL trait name is " + dslName)
+
+ val tpeName = newTypeName(names.head)
+ names.tail.reverse match {
+ case head :: tail ⇒
+ Select(tail.foldLeft[Tree](Ident(newTermName(head)))((tree, name) ⇒ Select(tree, newTermName(name))), tpeName)
+ case Nil ⇒
+ Ident(tpeName)
+ }
+ }
+
+ def composeDSL(transformedBody: Tree) =
+ ClassDef(Modifiers(), newTypeName("eval"), List(), Template(
+ List(dslTrait("bakery.FailureCake")),
+ emptyValDef,
+ List(
+ DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(),
+ Block(List(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List())), Literal(Constant(())))),
+ DefDef(Modifiers(), newTermName("main"), List(), List(List()), Ident(newTypeName("Any")), transformedBody))))
+
+ def constructor = Apply(Select(New(Ident(newTypeName("eval"))), nme.CONSTRUCTOR), List())
+
+ c.eval(c.Expr[Any](
+ c.resetAllAttrs(Block(composeDSL(Literal(Constant(1))), constructor))))
+
+ c.Expr[Any](Literal(Constant(1)))
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t7240/Test_2.scala b/test/files/run/t7240/Test_2.scala
new file mode 100644
index 0000000000..2450bdabf9
--- /dev/null
+++ b/test/files/run/t7240/Test_2.scala
@@ -0,0 +1,3 @@
+object Test extends App {
+ bakery.Bakery.failure
+} \ No newline at end of file
diff --git a/test/files/run/t7242.scala b/test/files/run/t7242.scala
new file mode 100644
index 0000000000..c995336144
--- /dev/null
+++ b/test/files/run/t7242.scala
@@ -0,0 +1,71 @@
+class CrashTest {
+ def foo = ()
+ trait CrashTestTable {
+ def cols = foo
+ }
+ // This was leading to a class between the mixed in
+ // outer accessor and the outer accessor of this object.
+ object CrashTestTable extends CrashTestTable {
+ foo
+ cols
+ }
+}
+
+class CrashTest1 {
+ def foo = ()
+ class CrashTestTable {
+ def cols = foo
+ }
+ object CrashTestTable extends CrashTestTable {
+ foo
+ cols
+ }
+}
+
+class CrashTest2 {
+ def foo = ()
+ trait CrashTestTable {
+ def cols = foo
+ }
+ object Obj extends CrashTestTable {
+ foo
+ cols
+ }
+}
+
+class CrashTest3 {
+ def foo = ()
+
+ def meth() {
+ trait CrashTestTable {
+ def cols = foo
+ }
+ object Obj extends CrashTestTable {
+ foo
+ cols
+ }
+ Obj
+ }
+}
+
+object Test extends App {
+ {
+ val c = new CrashTest
+ c.CrashTestTable
+ }
+
+ {
+ val c = new CrashTest1
+ c.CrashTestTable
+ }
+
+ {
+ val c = new CrashTest2
+ c.Obj
+ }
+
+ {
+ val c = new CrashTest3
+ c.meth()
+ }
+}
diff --git a/test/files/run/t7246.check b/test/files/run/t7246.check
new file mode 100755
index 0000000000..ce01362503
--- /dev/null
+++ b/test/files/run/t7246.check
@@ -0,0 +1 @@
+hello
diff --git a/test/files/run/t7246/Outer.java b/test/files/run/t7246/Outer.java
new file mode 100755
index 0000000000..163276fb3b
--- /dev/null
+++ b/test/files/run/t7246/Outer.java
@@ -0,0 +1,4 @@
+public class Outer {
+ public class Inner {
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t7246/Test.scala b/test/files/run/t7246/Test.scala
new file mode 100755
index 0000000000..9f23ca8f3a
--- /dev/null
+++ b/test/files/run/t7246/Test.scala
@@ -0,0 +1,16 @@
+object Test extends App {
+
+ val so = new SubOuter
+ val si = new so.SubInner
+ println(si.bar)
+}
+
+class SubOuter extends Outer {
+
+ val foo = "hello"
+
+ class SubInner extends Inner {
+ def bar = foo
+ }
+
+} \ No newline at end of file
diff --git a/test/files/run/t7246b.check b/test/files/run/t7246b.check
new file mode 100755
index 0000000000..5073bd8617
--- /dev/null
+++ b/test/files/run/t7246b.check
@@ -0,0 +1,2 @@
+base
+sub
diff --git a/test/files/run/t7246b/Base.scala b/test/files/run/t7246b/Base.scala
new file mode 100755
index 0000000000..4e71d3313d
--- /dev/null
+++ b/test/files/run/t7246b/Base.scala
@@ -0,0 +1,7 @@
+class Base {
+ val baseOuter = "base"
+
+ class BaseInner {
+ val baseInner = baseOuter
+ }
+}
diff --git a/test/files/run/t7246b/Outer.java b/test/files/run/t7246b/Outer.java
new file mode 100755
index 0000000000..53a79316ef
--- /dev/null
+++ b/test/files/run/t7246b/Outer.java
@@ -0,0 +1,4 @@
+public class Outer extends Base {
+ public class Inner extends BaseInner {
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t7246b/Test.scala b/test/files/run/t7246b/Test.scala
new file mode 100755
index 0000000000..f0982ea8d0
--- /dev/null
+++ b/test/files/run/t7246b/Test.scala
@@ -0,0 +1,14 @@
+object Test extends App {
+
+ val so = new SubOuter
+ val si = new so.SubInner
+ println(si.baseInner)
+ println(si.subInner)
+}
+
+class SubOuter extends Outer {
+ val subOuter = "sub"
+ class SubInner extends Inner {
+ def subInner = subOuter
+ }
+}
diff --git a/test/files/run/t7249.check b/test/files/run/t7249.check
new file mode 100644
index 0000000000..7777e0a5a2
--- /dev/null
+++ b/test/files/run/t7249.check
@@ -0,0 +1 @@
+Yup!
diff --git a/test/files/run/t7249.scala b/test/files/run/t7249.scala
new file mode 100644
index 0000000000..375df5c3ad
--- /dev/null
+++ b/test/files/run/t7249.scala
@@ -0,0 +1,7 @@
+object Test extends App {
+ def bnToLambda(s: => String): () => String = () => s
+ var x: () => String = () => sys.error("Nope")
+ val y = bnToLambda { x() }
+ x = () => "Yup!"
+ println(y())
+}
diff --git a/test/files/run/t7290.scala b/test/files/run/t7290.scala
new file mode 100644
index 0000000000..01f7e8f68e
--- /dev/null
+++ b/test/files/run/t7290.scala
@@ -0,0 +1,9 @@
+object Test extends App {
+ val y = (0: Int) match {
+ case 1 => 1
+ case 0 | 0 => 0
+ case 2 | 2 | 2 | 3 | 2 | 3 => 0
+ case _ => -1
+ }
+ assert(y == 0, y)
+}
diff --git a/test/files/run/t7300.check b/test/files/run/t7300.check
new file mode 100644
index 0000000000..51993f072d
--- /dev/null
+++ b/test/files/run/t7300.check
@@ -0,0 +1,2 @@
+2
+2
diff --git a/test/files/run/t7300.scala b/test/files/run/t7300.scala
new file mode 100644
index 0000000000..ec841690df
--- /dev/null
+++ b/test/files/run/t7300.scala
@@ -0,0 +1,11 @@
+object Test extends App {
+ // single line comment in multi line comment
+ /*//*/ val x = 1 */*/
+ val x = 2
+ println(x)
+
+ // single line comment in nested multi line comment
+ /*/*//*/ val y = 1 */*/*/
+ val y = 2
+ println(y)
+}
diff --git a/test/files/run/test-cpp.check b/test/files/run/test-cpp.check
index bfea438c60..13f4c64be3 100644
--- a/test/files/run/test-cpp.check
+++ b/test/files/run/test-cpp.check
@@ -1,65 +1,81 @@
-37c37
-< locals: value args, value x, value y
----
-> locals: value args
-42,43d41
-< 52 CONSTANT(2)
-< 52 STORE_LOCAL(value x)
-45,46d42
-< 53 LOAD_LOCAL(value x)
-< 53 STORE_LOCAL(value y)
-49c45
-< 54 LOAD_LOCAL(value y)
----
-> 54 CONSTANT(2)
-92c88
-< locals: value args, value x, value y
----
-> locals: value args, value x
-101,102d96
-< 82 LOAD_LOCAL(value x)
-< 82 STORE_LOCAL(value y)
-105c99
-< 83 LOAD_LOCAL(value y)
----
-> 83 LOAD_LOCAL(value x)
-135c129
-< locals: value args, value x, value y
----
-> locals: value args
-140,141d133
-< 66 THIS(TestAliasChainDerefThis)
-< 66 STORE_LOCAL(value x)
-143,144d134
-< 67 LOAD_LOCAL(value x)
-< 67 STORE_LOCAL(value y)
-147c137
-< 68 LOAD_LOCAL(value y)
----
-> 68 THIS(Object)
-176c166
-< locals: value x, value y
----
-> locals: value x
-181,182d170
-< 29 LOAD_LOCAL(value x)
-< 29 STORE_LOCAL(value y)
-185c173
-< 30 LOAD_LOCAL(value y)
----
-> 30 LOAD_LOCAL(value x)
-223,224d210
-< 97 LOAD_LOCAL(variable x)
-< 97 STORE_LOCAL(variable y)
-227c213
-< 98 LOAD_LOCAL(variable y)
----
-> 98 LOAD_LOCAL(variable x)
-233,234d218
-< 101 LOAD_LOCAL(variable y)
-< 101 STORE_LOCAL(variable x)
-236c220
-< 102 LOAD_LOCAL(variable x)
----
-> 102 LOAD_LOCAL(variable y)
-
+--- a
++++ b
+@@ -36,3 +36,3 @@
+ def main(args: Array[String] (ARRAY[REF(class String)])): Unit {
+- locals: value args, value x, value y
++ locals: value args
+ startBlock: 1
+@@ -41,10 +41,6 @@
+ 1:
+- 52 CONSTANT(2)
+- 52 STORE_LOCAL(value x)
+ 52 SCOPE_ENTER value x
+- 53 LOAD_LOCAL(value x)
+- 53 STORE_LOCAL(value y)
+ 53 SCOPE_ENTER value y
+ 54 LOAD_MODULE object Predef
+- 54 LOAD_LOCAL(value y)
++ 54 CONSTANT(2)
+ 54 BOX INT
+@@ -91,3 +87,3 @@
+ def main(args: Array[String] (ARRAY[REF(class String)])): Unit {
+- locals: value args, value x, value y
++ locals: value args, value x
+ startBlock: 1
+@@ -100,7 +96,5 @@
+ 81 SCOPE_ENTER value x
+- 82 LOAD_LOCAL(value x)
+- 82 STORE_LOCAL(value y)
+ 82 SCOPE_ENTER value y
+ 83 LOAD_MODULE object Predef
+- 83 LOAD_LOCAL(value y)
++ 83 LOAD_LOCAL(value x)
+ 83 BOX INT
+@@ -134,3 +128,3 @@
+ def main(args: Array[String] (ARRAY[REF(class String)])): Unit {
+- locals: value args, value x, value y
++ locals: value args
+ startBlock: 1
+@@ -139,10 +133,6 @@
+ 1:
+- 66 THIS(TestAliasChainDerefThis)
+- 66 STORE_LOCAL(value x)
+ 66 SCOPE_ENTER value x
+- 67 LOAD_LOCAL(value x)
+- 67 STORE_LOCAL(value y)
+ 67 SCOPE_ENTER value y
+ 68 LOAD_MODULE object Predef
+- 68 LOAD_LOCAL(value y)
++ 68 THIS(Object)
+ 68 CALL_METHOD scala.Predef.println (dynamic)
+@@ -175,3 +165,3 @@
+ def test(x: Int (INT)): Unit {
+- locals: value x, value y
++ locals: value x
+ startBlock: 1
+@@ -180,7 +170,5 @@
+ 1:
+- 29 LOAD_LOCAL(value x)
+- 29 STORE_LOCAL(value y)
+ 29 SCOPE_ENTER value y
+ 30 LOAD_MODULE object Predef
+- 30 LOAD_LOCAL(value y)
++ 30 LOAD_LOCAL(value x)
+ 30 BOX INT
+@@ -222,7 +210,5 @@
+ 96 SCOPE_ENTER variable x
+- 97 LOAD_LOCAL(variable x)
+- 97 STORE_LOCAL(variable y)
+ 97 SCOPE_ENTER variable y
+ 98 LOAD_MODULE object Predef
+- 98 LOAD_LOCAL(variable y)
++ 98 LOAD_LOCAL(variable x)
+ 98 BOX INT
+@@ -232,6 +218,4 @@
+ 100 STORE_LOCAL(variable y)
+- 101 LOAD_LOCAL(variable y)
+- 101 STORE_LOCAL(variable x)
+ 102 LOAD_MODULE object Predef
+- 102 LOAD_LOCAL(variable x)
++ 102 LOAD_LOCAL(variable y)
+ 102 BOX INT
diff --git a/test/files/scalap/abstractClass/result.test b/test/files/scalap/abstractClass.check
index ef1daac23d..ef1daac23d 100644
--- a/test/files/scalap/abstractClass/result.test
+++ b/test/files/scalap/abstractClass.check
diff --git a/test/files/scalap/abstractClass/A.scala b/test/files/scalap/abstractClass.scala
index 19a528d5a1..19a528d5a1 100644
--- a/test/files/scalap/abstractClass/A.scala
+++ b/test/files/scalap/abstractClass.scala
diff --git a/test/files/scalap/abstractMethod/result.test b/test/files/scalap/abstractMethod.check
index 40fa02d408..40fa02d408 100644
--- a/test/files/scalap/abstractMethod/result.test
+++ b/test/files/scalap/abstractMethod.check
diff --git a/test/files/scalap/abstractMethod/A.scala b/test/files/scalap/abstractMethod.scala
index 4bedb377b3..4bedb377b3 100644
--- a/test/files/scalap/abstractMethod/A.scala
+++ b/test/files/scalap/abstractMethod.scala
diff --git a/test/files/scalap/caseClass/result.test b/test/files/scalap/caseClass.check
index 7d7aa4fd8f..7d7aa4fd8f 100644
--- a/test/files/scalap/caseClass/result.test
+++ b/test/files/scalap/caseClass.check
diff --git a/test/files/scalap/caseClass/A.scala b/test/files/scalap/caseClass.scala
index 95f9984519..95f9984519 100644
--- a/test/files/scalap/caseClass/A.scala
+++ b/test/files/scalap/caseClass.scala
diff --git a/test/files/scalap/caseObject/result.test b/test/files/scalap/caseObject.check
index 867a4b2162..867a4b2162 100644
--- a/test/files/scalap/caseObject/result.test
+++ b/test/files/scalap/caseObject.check
diff --git a/test/files/scalap/caseObject/A.scala b/test/files/scalap/caseObject.scala
index 6a3ff10d75..6a3ff10d75 100644
--- a/test/files/scalap/caseObject/A.scala
+++ b/test/files/scalap/caseObject.scala
diff --git a/test/files/scalap/cbnParam/result.test b/test/files/scalap/cbnParam.check
index 52ecb6ae66..52ecb6ae66 100644
--- a/test/files/scalap/cbnParam/result.test
+++ b/test/files/scalap/cbnParam.check
diff --git a/test/files/scalap/cbnParam/A.scala b/test/files/scalap/cbnParam.scala
index 2f366df64a..2f366df64a 100644
--- a/test/files/scalap/cbnParam/A.scala
+++ b/test/files/scalap/cbnParam.scala
diff --git a/test/files/scalap/classPrivate/result.test b/test/files/scalap/classPrivate.check
index ab2d40cdaf..ab2d40cdaf 100644
--- a/test/files/scalap/classPrivate/result.test
+++ b/test/files/scalap/classPrivate.check
diff --git a/test/files/scalap/classPrivate/A.scala b/test/files/scalap/classPrivate.scala
index 9f1bd34a6a..9f1bd34a6a 100644
--- a/test/files/scalap/classPrivate/A.scala
+++ b/test/files/scalap/classPrivate.scala
diff --git a/test/files/scalap/classWithExistential/result.test b/test/files/scalap/classWithExistential.check
index caee3fd6de..caee3fd6de 100644
--- a/test/files/scalap/classWithExistential/result.test
+++ b/test/files/scalap/classWithExistential.check
diff --git a/test/files/scalap/classWithExistential/A.scala b/test/files/scalap/classWithExistential.scala
index 4a5213f963..4a5213f963 100644
--- a/test/files/scalap/classWithExistential/A.scala
+++ b/test/files/scalap/classWithExistential.scala
diff --git a/test/files/scalap/classWithSelfAnnotation/result.test b/test/files/scalap/classWithSelfAnnotation.check
index 82bbd9e8df..82bbd9e8df 100644
--- a/test/files/scalap/classWithSelfAnnotation/result.test
+++ b/test/files/scalap/classWithSelfAnnotation.check
diff --git a/test/files/scalap/classWithSelfAnnotation/A.scala b/test/files/scalap/classWithSelfAnnotation.scala
index 9e0398622a..9e0398622a 100644
--- a/test/files/scalap/classWithSelfAnnotation/A.scala
+++ b/test/files/scalap/classWithSelfAnnotation.scala
diff --git a/test/files/scalap/covariantParam/result.test b/test/files/scalap/covariantParam.check
index f7a3c98966..f7a3c98966 100644
--- a/test/files/scalap/covariantParam/result.test
+++ b/test/files/scalap/covariantParam.check
diff --git a/test/files/scalap/covariantParam/A.scala b/test/files/scalap/covariantParam.scala
index 5b2c24d6fa..5b2c24d6fa 100644
--- a/test/files/scalap/covariantParam/A.scala
+++ b/test/files/scalap/covariantParam.scala
diff --git a/test/files/scalap/defaultParameter/result.test b/test/files/scalap/defaultParameter.check
index 0c775ea7b5..0c775ea7b5 100644
--- a/test/files/scalap/defaultParameter/result.test
+++ b/test/files/scalap/defaultParameter.check
diff --git a/test/files/scalap/defaultParameter/A.scala b/test/files/scalap/defaultParameter.scala
index d3514952f4..d3514952f4 100644
--- a/test/files/scalap/defaultParameter/A.scala
+++ b/test/files/scalap/defaultParameter.scala
diff --git a/test/files/scalap/implicitParam/result.test b/test/files/scalap/implicitParam.check
index a2cfd6092d..a2cfd6092d 100644
--- a/test/files/scalap/implicitParam/result.test
+++ b/test/files/scalap/implicitParam.check
diff --git a/test/files/scalap/implicitParam/A.scala b/test/files/scalap/implicitParam.scala
index 80657218d9..80657218d9 100644
--- a/test/files/scalap/implicitParam/A.scala
+++ b/test/files/scalap/implicitParam.scala
diff --git a/test/files/scalap/packageObject/result.test b/test/files/scalap/packageObject.check
index 5732d92958..5732d92958 100644
--- a/test/files/scalap/packageObject/result.test
+++ b/test/files/scalap/packageObject.check
diff --git a/test/files/scalap/packageObject/A.scala b/test/files/scalap/packageObject.scala
index 7e429c9935..7e429c9935 100644
--- a/test/files/scalap/packageObject/A.scala
+++ b/test/files/scalap/packageObject.scala
diff --git a/test/files/scalap/paramClauses/result.test b/test/files/scalap/paramClauses.check
index 3a141e8faf..3a141e8faf 100644
--- a/test/files/scalap/paramClauses/result.test
+++ b/test/files/scalap/paramClauses.check
diff --git a/test/files/scalap/paramClauses/A.scala b/test/files/scalap/paramClauses.scala
index f9d1917402..f9d1917402 100644
--- a/test/files/scalap/paramClauses/A.scala
+++ b/test/files/scalap/paramClauses.scala
diff --git a/test/files/scalap/paramNames/result.test b/test/files/scalap/paramNames.check
index 85e37f858d..85e37f858d 100644
--- a/test/files/scalap/paramNames/result.test
+++ b/test/files/scalap/paramNames.check
diff --git a/test/files/scalap/paramNames/A.scala b/test/files/scalap/paramNames.scala
index 7ba9ff0feb..7ba9ff0feb 100644
--- a/test/files/scalap/paramNames/A.scala
+++ b/test/files/scalap/paramNames.scala
diff --git a/test/files/scalap/sequenceParam/result.test b/test/files/scalap/sequenceParam.check
index 142d92fea3..142d92fea3 100644
--- a/test/files/scalap/sequenceParam/result.test
+++ b/test/files/scalap/sequenceParam.check
diff --git a/test/files/scalap/sequenceParam/A.scala b/test/files/scalap/sequenceParam.scala
index 86e13340b9..86e13340b9 100644
--- a/test/files/scalap/sequenceParam/A.scala
+++ b/test/files/scalap/sequenceParam.scala
diff --git a/test/files/scalap/simpleClass/result.test b/test/files/scalap/simpleClass.check
index 4fdf25d1cf..4fdf25d1cf 100644
--- a/test/files/scalap/simpleClass/result.test
+++ b/test/files/scalap/simpleClass.check
diff --git a/test/files/scalap/simpleClass/A.scala b/test/files/scalap/simpleClass.scala
index fa82e62680..fa82e62680 100644
--- a/test/files/scalap/simpleClass/A.scala
+++ b/test/files/scalap/simpleClass.scala
diff --git a/test/files/scalap/traitObject/result.test b/test/files/scalap/traitObject.check
index 104ba14f1a..104ba14f1a 100644
--- a/test/files/scalap/traitObject/result.test
+++ b/test/files/scalap/traitObject.check
diff --git a/test/files/scalap/traitObject/A.scala b/test/files/scalap/traitObject.scala
index d5f43181c1..d5f43181c1 100644
--- a/test/files/scalap/traitObject/A.scala
+++ b/test/files/scalap/traitObject.scala
diff --git a/test/files/scalap/typeAnnotations/result.test b/test/files/scalap/typeAnnotations.check
index 407b0235c6..407b0235c6 100644
--- a/test/files/scalap/typeAnnotations/result.test
+++ b/test/files/scalap/typeAnnotations.check
diff --git a/test/files/scalap/typeAnnotations/A.scala b/test/files/scalap/typeAnnotations.scala
index ff2445edc9..ff2445edc9 100644
--- a/test/files/scalap/typeAnnotations/A.scala
+++ b/test/files/scalap/typeAnnotations.scala
diff --git a/test/files/scalap/valAndVar/result.test b/test/files/scalap/valAndVar.check
index e940da9801..e940da9801 100644
--- a/test/files/scalap/valAndVar/result.test
+++ b/test/files/scalap/valAndVar.check
diff --git a/test/files/scalap/valAndVar/A.scala b/test/files/scalap/valAndVar.scala
index 2d89348401..2d89348401 100644
--- a/test/files/scalap/valAndVar/A.scala
+++ b/test/files/scalap/valAndVar.scala
diff --git a/test/files/scalap/wildcardType/result.test b/test/files/scalap/wildcardType.check
index e43261db32..e43261db32 100644
--- a/test/files/scalap/wildcardType/result.test
+++ b/test/files/scalap/wildcardType.check
diff --git a/test/files/scalap/wildcardType/A.scala b/test/files/scalap/wildcardType.scala
index 4bb0d14de5..4bb0d14de5 100644
--- a/test/files/scalap/wildcardType/A.scala
+++ b/test/files/scalap/wildcardType.scala
diff --git a/test/partest b/test/partest
index 9b0ab02fdc..8243316cca 100755
--- a/test/partest
+++ b/test/partest
@@ -1,7 +1,8 @@
-#!/bin/sh
+#!/usr/bin/env bash
+#
##############################################################################
-# Scala test runner 2.8.0
+# Scala test runner 2.10.0
##############################################################################
# (c) 2002-2013 LAMP/EPFL
#
@@ -10,6 +11,16 @@
# PARTICULAR PURPOSE.
##############################################################################
+# Use tput to detect color-capable terminal.
+term_colors=$(tput colors 2>/dev/null)
+if [[ $? == 0 ]] && [[ $term_colors -gt 2 ]]; then
+ git_diff_options="--color=always --word-diff"
+ color_opts="-Dpartest.colors=$term_colors"
+else
+ unset color_opts
+ git_diff_options="--nocolor"
+fi
+
cygwin=false;
darwin=false;
case "`uname`" in
@@ -53,8 +64,8 @@ if [ -z "$EXT_CLASSPATH" ] ; then
fi
done
elif [ -f "$SCALA_HOME/build/pack/lib/scala-partest.jar" ] ; then
- for lib in `echo "partest library reflect compiler"`; do
- ext="$SCALA_HOME/build/pack/lib/scala-$lib.jar"
+ for lib in `echo "scala-partest scala-library scala-reflect scala-compiler diffutils"`; do
+ ext="$SCALA_HOME/build/pack/lib/$lib.jar"
if [ -z "$EXT_CLASSPATH" ] ; then
EXT_CLASSPATH="$ext"
else
@@ -98,6 +109,7 @@ fi
"${JAVACMD:=java}" \
$JAVA_OPTS -cp "$EXT_CLASSPATH" \
${partestDebugStr} \
+ "$color_opts" \
-Dscala.home="${SCALA_HOME}" \
-Dpartest.javacmd="${JAVACMD}" \
-Dpartest.java_opts="${JAVA_OPTS}" \
diff --git a/test/scaladoc/run/SI-6580.check b/test/scaladoc/run/SI-6580.check
new file mode 100644
index 0000000000..2fb6ec3258
--- /dev/null
+++ b/test/scaladoc/run/SI-6580.check
@@ -0,0 +1,11 @@
+Chain(List(Chain(List(Text(Here z(1) is defined as follows:), Text(
+), HtmlTag(<br>), Text(
+), Text( ), HtmlTag(<img src='http://example.com/fig1.png'>), Text(
+), HtmlTag(<br>), Text(
+), Text(plus z(1) times), Text(
+), HtmlTag(<br>), Text(
+), Text( ), HtmlTag(<img src='http://example.com/fig2.png'>), Text(
+), HtmlTag(<br>), Text(
+), Text(equals QL of something
+)))))
+Done.
diff --git a/test/scaladoc/run/SI-6580.scala b/test/scaladoc/run/SI-6580.scala
new file mode 100644
index 0000000000..c544138f44
--- /dev/null
+++ b/test/scaladoc/run/SI-6580.scala
@@ -0,0 +1,32 @@
+import scala.tools.nsc.doc
+import scala.tools.nsc.doc.model._
+import scala.tools.nsc.doc.html.page.{Index, ReferenceIndex}
+import scala.tools.partest.ScaladocModelTest
+
+object Test extends ScaladocModelTest {
+ override def scaladocSettings = ""
+ override def code = """
+
+ object Test {
+ /** Here z(1) is defined as follows:
+ * <br>
+ * <img src='http://example.com/fig1.png'>
+ * <br>
+ * plus z(1) times
+ * <br>
+ * <img src='http://example.com/fig2.png'>
+ * <br>
+ * equals QL of something
+ */
+ def f = 1
+ }
+
+ """
+
+ def testModel(rootPackage: Package) {
+ import access._
+
+ val f = rootPackage._object("Test")._method("f")
+ println(f.comment.get.short)
+ }
+}
diff --git a/test/scaladoc/run/SI-6715.check b/test/scaladoc/run/SI-6715.check
new file mode 100644
index 0000000000..619c56180b
--- /dev/null
+++ b/test/scaladoc/run/SI-6715.check
@@ -0,0 +1 @@
+Done.
diff --git a/test/scaladoc/run/SI-6715.scala b/test/scaladoc/run/SI-6715.scala
new file mode 100644
index 0000000000..92d3376234
--- /dev/null
+++ b/test/scaladoc/run/SI-6715.scala
@@ -0,0 +1,15 @@
+import scala.tools.nsc.doc.model._
+import scala.tools.partest.ScaladocModelTest
+
+object Test extends ScaladocModelTest {
+ def scaladocSettings = ""
+
+ override def code = "object A { def $$ = 123 }"
+
+ def testModel(rootPackage: Package) = {
+ import access._
+
+ val method = rootPackage._object("A")._method("$$")
+ assert(method != null)
+ }
+}