summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
Diffstat (limited to 'test/files')
-rw-r--r--test/files/neg/t1909-object.check4
-rw-r--r--test/files/neg/t1909-object.flags1
-rw-r--r--test/files/neg/t1909-object.scala12
-rw-r--r--test/files/neg/t284.check8
-rw-r--r--test/files/neg/t284.flags1
-rw-r--r--test/files/neg/t284.scala7
-rwxr-xr-xtest/files/neg/t6446-additional.check8
-rwxr-xr-xtest/files/neg/t6446-missing.check7
-rw-r--r--test/files/neg/t6446-show-phases.check7
-rw-r--r--test/files/neg/t7007.check7
-rw-r--r--test/files/neg/t7007.scala14
-rw-r--r--test/files/neg/t7494-multi-right-after.check4
-rw-r--r--test/files/neg/t7494-no-options.check10
-rw-r--r--test/files/neg/t7494-right-after-before.check2
-rw-r--r--test/files/neg/t7622-cyclic-dependency.check1
-rw-r--r--test/files/neg/t7622-cyclic-dependency/ThePlugin.scala40
-rw-r--r--test/files/neg/t7622-cyclic-dependency/sample_2.flags1
-rw-r--r--test/files/neg/t7622-cyclic-dependency/sample_2.scala6
-rw-r--r--test/files/neg/t7622-cyclic-dependency/scalac-plugin.xml5
-rw-r--r--test/files/neg/t7622-missing-dependency.check2
-rw-r--r--test/files/neg/t7622-missing-dependency/ThePlugin.scala33
-rw-r--r--test/files/neg/t7622-missing-dependency/sample_2.flags1
-rw-r--r--test/files/neg/t7622-missing-dependency/sample_2.scala6
-rw-r--r--test/files/neg/t7622-missing-dependency/scalac-plugin.xml5
-rw-r--r--test/files/neg/t7622-missing-required.check2
-rw-r--r--test/files/neg/t7622-missing-required.flags1
-rw-r--r--test/files/neg/t7622-missing-required.scala4
-rw-r--r--test/files/neg/t7622-multi-followers.check1
-rw-r--r--test/files/neg/t7622-multi-followers/ThePlugin.scala44
-rw-r--r--test/files/neg/t7622-multi-followers/sample_2.flags1
-rw-r--r--test/files/neg/t7622-multi-followers/sample_2.scala6
-rw-r--r--test/files/neg/t7622-multi-followers/scalac-plugin.xml5
-rw-r--r--test/files/neg/t7834neg.check41
-rw-r--r--test/files/neg/t7834neg.scala76
-rw-r--r--test/files/pos/infersingle.scala51
-rw-r--r--test/files/pos/private-types-after-typer.scala9
-rw-r--r--test/files/pos/t7818.scala10
-rw-r--r--test/files/pos/t7834.scala6
-rw-r--r--test/files/run/compiler-asSeenFrom.check98
-rw-r--r--test/files/run/idempotency-case-classes.check2
-rw-r--r--test/files/run/inline-ex-handlers.scala4
-rw-r--r--test/files/run/predef-cycle.scala71
-rw-r--r--test/files/run/programmatic-main.check9
-rw-r--r--test/files/run/t1909.check3
-rw-r--r--test/files/run/t1909.scala (renamed from test/files/pos/t1909.scala)4
-rw-r--r--test/files/run/t1909b.scala (renamed from test/files/pos/t1909b-pos.scala)5
-rw-r--r--test/files/run/t1909c.scala9
-rw-r--r--test/files/run/t3832.scala17
-rw-r--r--test/files/run/t5313.scala6
-rw-r--r--test/files/run/t6102.check2
-rw-r--r--test/files/run/t6102.flags2
-rw-r--r--test/files/run/t6288b-jump-position.scala9
-rw-r--r--test/files/run/t6955.check1
-rw-r--r--test/files/run/t6955.scala12
-rw-r--r--test/files/run/t6956.check1
-rw-r--r--test/files/run/t6956.scala13
-rw-r--r--test/files/run/t7223.check1
-rw-r--r--test/files/run/t7223.scala11
-rw-r--r--test/files/run/t7269.scala32
-rw-r--r--test/files/run/t7801.check11
-rw-r--r--test/files/run/t7801.scala12
-rw-r--r--test/files/run/test-cpp.scala4
62 files changed, 734 insertions, 54 deletions
diff --git a/test/files/neg/t1909-object.check b/test/files/neg/t1909-object.check
new file mode 100644
index 0000000000..401c1f7ebf
--- /dev/null
+++ b/test/files/neg/t1909-object.check
@@ -0,0 +1,4 @@
+t1909-object.scala:4: error: !!! SI-1909 Unable to STATICally lift object InnerTrouble$1, which is defined in the self- or super-constructor call of class Kaboom. A VerifyError is likely.
+ object InnerTrouble
+ ^
+one error found
diff --git a/test/files/neg/t1909-object.flags b/test/files/neg/t1909-object.flags
new file mode 100644
index 0000000000..eb8b40661b
--- /dev/null
+++ b/test/files/neg/t1909-object.flags
@@ -0,0 +1 @@
+-Xdev -Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/t1909-object.scala b/test/files/neg/t1909-object.scala
new file mode 100644
index 0000000000..d6011ba4a5
--- /dev/null
+++ b/test/files/neg/t1909-object.scala
@@ -0,0 +1,12 @@
+class Kaboom(a: Any) {
+ def this() = {
+ this({
+ object InnerTrouble
+ InnerTrouble
+ })
+ }
+}
+
+object Test extends App {
+ new Kaboom()
+} \ No newline at end of file
diff --git a/test/files/neg/t284.check b/test/files/neg/t284.check
index 37801af1b5..7c2e9be03e 100644
--- a/test/files/neg/t284.check
+++ b/test/files/neg/t284.check
@@ -1,8 +1,6 @@
t284.scala:2: warning: Detected apparent refinement of Unit; are you missing an '=' sign?
- def f1(a: T): Unit { }
- ^
-t284.scala:5: error: Unmatched closing brace '}' ignored here
- }
- ^
+ def f1(a: T): Unit { }
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
one warning found
one error found
diff --git a/test/files/neg/t284.flags b/test/files/neg/t284.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/neg/t284.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/t284.scala b/test/files/neg/t284.scala
index a210130102..f75bc3d4ba 100644
--- a/test/files/neg/t284.scala
+++ b/test/files/neg/t284.scala
@@ -1,6 +1,5 @@
trait B[T] {
- def f1(a: T): Unit { }
- def f2(a: T): Unit
- def f3(a: T) { }
- }
+ def f1(a: T): Unit { }
+ def f2(a: T): Unit
+ def f3(a: T) { }
}
diff --git a/test/files/neg/t6446-additional.check b/test/files/neg/t6446-additional.check
index 24201c07c2..6dfe072913 100755
--- a/test/files/neg/t6446-additional.check
+++ b/test/files/neg/t6446-additional.check
@@ -22,6 +22,7 @@ superaccessors 6 add super accessors in traits and nested classes
mixin 20 mixin composition
cleanup 21 platform-specific cleanups, generate reflective calls
icode 22 generate portable intermediate code
+#partest -optimise
inliner 23 optimization: do inlining
inlinehandlers 24 optimization: inline exception handlers
closelim 25 optimization: eliminate uncalled closures
@@ -29,4 +30,9 @@ inlinehandlers 24 optimization: inline exception handlers
dce 27 optimization: eliminate dead code
jvm 28 generate JVM bytecode
ploogin 29 A sample phase that does so many things it's kind of hard...
- terminal 30 The last phase in the compiler chain
+ terminal 30 the last phase during a compilation run
+#partest !-optimise
+ jvm 23 generate JVM bytecode
+ ploogin 24 A sample phase that does so many things it's kind of hard...
+ terminal 25 the last phase during a compilation run
+#partest
diff --git a/test/files/neg/t6446-missing.check b/test/files/neg/t6446-missing.check
index 6e5bdcf07c..d4afa9b630 100755
--- a/test/files/neg/t6446-missing.check
+++ b/test/files/neg/t6446-missing.check
@@ -23,10 +23,15 @@ superaccessors 6 add super accessors in traits and nested classes
mixin 20 mixin composition
cleanup 21 platform-specific cleanups, generate reflective calls
icode 22 generate portable intermediate code
+#partest !-optimise
+ jvm 23 generate JVM bytecode
+ terminal 24 the last phase during a compilation run
+#partest -optimise
inliner 23 optimization: do inlining
inlinehandlers 24 optimization: inline exception handlers
closelim 25 optimization: eliminate uncalled closures
constopt 26 optimization: optimize null and other constants
dce 27 optimization: eliminate dead code
jvm 28 generate JVM bytecode
- terminal 29 The last phase in the compiler chain
+ terminal 29 the last phase during a compilation run
+#partest
diff --git a/test/files/neg/t6446-show-phases.check b/test/files/neg/t6446-show-phases.check
index a1bf408506..10a9e08b86 100644
--- a/test/files/neg/t6446-show-phases.check
+++ b/test/files/neg/t6446-show-phases.check
@@ -22,10 +22,15 @@ superaccessors 6 add super accessors in traits and nested classes
mixin 20 mixin composition
cleanup 21 platform-specific cleanups, generate reflective calls
icode 22 generate portable intermediate code
+#partest !-optimise
+ jvm 23 generate JVM bytecode
+ terminal 24 the last phase during a compilation run
+#partest -optimise
inliner 23 optimization: do inlining
inlinehandlers 24 optimization: inline exception handlers
closelim 25 optimization: eliminate uncalled closures
constopt 26 optimization: optimize null and other constants
dce 27 optimization: eliminate dead code
jvm 28 generate JVM bytecode
- terminal 29 The last phase in the compiler chain
+ terminal 29 the last phase during a compilation run
+#partest
diff --git a/test/files/neg/t7007.check b/test/files/neg/t7007.check
new file mode 100644
index 0000000000..e22ecb9e4e
--- /dev/null
+++ b/test/files/neg/t7007.check
@@ -0,0 +1,7 @@
+t7007.scala:5: error: Implementation restriction: <$anon: A => B> requires premature access to class Crash.
+ def this(a: Seq[A]) = this(a.collect{ case b: B => b}, a.collect{ case b: B => b})
+ ^
+t7007.scala:5: error: Implementation restriction: <$anon: A => B> requires premature access to class Crash.
+ def this(a: Seq[A]) = this(a.collect{ case b: B => b}, a.collect{ case b: B => b})
+ ^
+two errors found
diff --git a/test/files/neg/t7007.scala b/test/files/neg/t7007.scala
new file mode 100644
index 0000000000..e41dccf550
--- /dev/null
+++ b/test/files/neg/t7007.scala
@@ -0,0 +1,14 @@
+class A
+class B extends A
+
+class Crash(b1: Seq[B], b2: Seq[B]) {
+ def this(a: Seq[A]) = this(a.collect{ case b: B => b}, a.collect{ case b: B => b})
+}
+
+object Main extends App {
+
+ // runtime exception with either constructor
+ val c1 = new Crash(Seq(new B, new B))
+ val c2 = new Crash(Seq(new B), Seq(new B))
+
+}
diff --git a/test/files/neg/t7494-multi-right-after.check b/test/files/neg/t7494-multi-right-after.check
index 9c6fdbe91f..151d177414 100644
--- a/test/files/neg/t7494-multi-right-after.check
+++ b/test/files/neg/t7494-multi-right-after.check
@@ -1,3 +1 @@
-error: Multiple phases want to run right after the phase explicitouter
-Phases: erasure, multi-rafter,
-Re-run with -Xgenerate-phase-graph <filename> to better see the problem.
+error: Multiple phases want to run right after explicitouter; followers: erasure,multi-rafter; created phase-order.dot
diff --git a/test/files/neg/t7494-no-options.check b/test/files/neg/t7494-no-options.check
index c197d2a671..0bde84c96c 100644
--- a/test/files/neg/t7494-no-options.check
+++ b/test/files/neg/t7494-no-options.check
@@ -1,4 +1,4 @@
-error: Error: ploogin has no options
+error: Error: ploogin takes no options
phase name id description
---------- -- -----------
parser 1 parse source into ASTs, perform simple desugaring
@@ -23,6 +23,11 @@ superaccessors 6 add super accessors in traits and nested classes
mixin 20 mixin composition
cleanup 21 platform-specific cleanups, generate reflective calls
icode 22 generate portable intermediate code
+#partest !-optimise
+ jvm 23 generate JVM bytecode
+ ploogin 24 A sample phase that does so many things it's kind of hard...
+ terminal 25 the last phase during a compilation run
+#partest -optimise
inliner 23 optimization: do inlining
inlinehandlers 24 optimization: inline exception handlers
closelim 25 optimization: eliminate uncalled closures
@@ -30,4 +35,5 @@ inlinehandlers 24 optimization: inline exception handlers
dce 27 optimization: eliminate dead code
jvm 28 generate JVM bytecode
ploogin 29 A sample phase that does so many things it's kind of hard...
- terminal 30 The last phase in the compiler chain
+ terminal 30 the last phase during a compilation run
+#partest
diff --git a/test/files/neg/t7494-right-after-before.check b/test/files/neg/t7494-right-after-before.check
index 9b57a7711b..7e83daab4a 100644
--- a/test/files/neg/t7494-right-after-before.check
+++ b/test/files/neg/t7494-right-after-before.check
@@ -1 +1 @@
-error: phase erasure want to run right after explicitouter, but some phase has declared to run before erasure. Re-run with -Xgenerate-phase-graph <filename> to better see the problem.
+error: Phase erasure can't follow explicitouter, created phase-order.dot
diff --git a/test/files/neg/t7622-cyclic-dependency.check b/test/files/neg/t7622-cyclic-dependency.check
new file mode 100644
index 0000000000..3546964f5f
--- /dev/null
+++ b/test/files/neg/t7622-cyclic-dependency.check
@@ -0,0 +1 @@
+error: Cycle in phase dependencies detected at cyclicdependency1, created phase-cycle.dot
diff --git a/test/files/neg/t7622-cyclic-dependency/ThePlugin.scala b/test/files/neg/t7622-cyclic-dependency/ThePlugin.scala
new file mode 100644
index 0000000000..7a905ae32d
--- /dev/null
+++ b/test/files/neg/t7622-cyclic-dependency/ThePlugin.scala
@@ -0,0 +1,40 @@
+package scala.test.plugins
+
+import scala.tools.nsc
+import nsc.Global
+import nsc.Phase
+import nsc.plugins.Plugin
+import nsc.plugins.PluginComponent
+
+class ThePlugin(val global: Global) extends Plugin {
+ import global._
+
+ val name = "cyclicdependency"
+ val description = "Declares two phases that have a cyclic dependency"
+ val components = List[PluginComponent](thePhase1,thePhase2)
+
+ private object thePhase1 extends PluginComponent {
+ val global = ThePlugin.this.global
+
+ val runsAfter = List[String]("tailcalls","cyclicdependency2")
+
+ val phaseName = ThePlugin.this.name + "1"
+
+ def newPhase(prev: Phase) = new ThePhase(prev, phaseName)
+ }
+
+ private object thePhase2 extends PluginComponent {
+ val global = ThePlugin.this.global
+
+ val runsAfter = List[String]("dce","cyclicdependency1")
+
+ val phaseName = ThePlugin.this.name + "2"
+
+ def newPhase(prev: Phase) = new ThePhase(prev, phaseName)
+ }
+
+ private class ThePhase(prev: Phase, val name: String) extends Phase(prev) {
+ def run {}
+ }
+}
+
diff --git a/test/files/neg/t7622-cyclic-dependency/sample_2.flags b/test/files/neg/t7622-cyclic-dependency/sample_2.flags
new file mode 100644
index 0000000000..db25b88a12
--- /dev/null
+++ b/test/files/neg/t7622-cyclic-dependency/sample_2.flags
@@ -0,0 +1 @@
+-Xplugin:. -Xplugin-require:cyclicdependency
diff --git a/test/files/neg/t7622-cyclic-dependency/sample_2.scala b/test/files/neg/t7622-cyclic-dependency/sample_2.scala
new file mode 100644
index 0000000000..73cdc64e40
--- /dev/null
+++ b/test/files/neg/t7622-cyclic-dependency/sample_2.scala
@@ -0,0 +1,6 @@
+
+package sample
+
+// just a sample that is compiled with the sample plugin enabled
+object Sample extends App {
+}
diff --git a/test/files/neg/t7622-cyclic-dependency/scalac-plugin.xml b/test/files/neg/t7622-cyclic-dependency/scalac-plugin.xml
new file mode 100644
index 0000000000..2558d6fd03
--- /dev/null
+++ b/test/files/neg/t7622-cyclic-dependency/scalac-plugin.xml
@@ -0,0 +1,5 @@
+<plugin>
+ <name>ignored</name>
+ <classname>scala.test.plugins.ThePlugin</classname>
+</plugin>
+
diff --git a/test/files/neg/t7622-missing-dependency.check b/test/files/neg/t7622-missing-dependency.check
new file mode 100644
index 0000000000..a0d0e30870
--- /dev/null
+++ b/test/files/neg/t7622-missing-dependency.check
@@ -0,0 +1,2 @@
+error: Phase 'myplugin' requires: List(missing)
+one error found
diff --git a/test/files/neg/t7622-missing-dependency/ThePlugin.scala b/test/files/neg/t7622-missing-dependency/ThePlugin.scala
new file mode 100644
index 0000000000..a87cbb8e45
--- /dev/null
+++ b/test/files/neg/t7622-missing-dependency/ThePlugin.scala
@@ -0,0 +1,33 @@
+package scala.test.plugins
+
+import scala.tools.nsc
+import nsc.Global
+import nsc.Phase
+import nsc.plugins.Plugin
+import nsc.plugins.PluginComponent
+
+class ThePlugin(val global: Global) extends Plugin {
+ import global._
+
+ val name = "myplugin"
+ val description = "Declares one plugin with a missing requirement"
+ val components = List[PluginComponent](thePhase)
+
+ private object thePhase extends PluginComponent {
+ val global = ThePlugin.this.global
+
+ val runsAfter = List[String]("typer")
+
+ val phaseName = ThePlugin.this.name
+
+ override val requires = List("missing")
+
+ def newPhase(prev: Phase) = new ThePhase(prev)
+ }
+
+ private class ThePhase(prev: Phase) extends Phase(prev) {
+ def name = thePhase.phaseName
+ def run {}
+ }
+}
+
diff --git a/test/files/neg/t7622-missing-dependency/sample_2.flags b/test/files/neg/t7622-missing-dependency/sample_2.flags
new file mode 100644
index 0000000000..d69035100e
--- /dev/null
+++ b/test/files/neg/t7622-missing-dependency/sample_2.flags
@@ -0,0 +1 @@
+-Xplugin:. -Xplugin-require:myplugin
diff --git a/test/files/neg/t7622-missing-dependency/sample_2.scala b/test/files/neg/t7622-missing-dependency/sample_2.scala
new file mode 100644
index 0000000000..73cdc64e40
--- /dev/null
+++ b/test/files/neg/t7622-missing-dependency/sample_2.scala
@@ -0,0 +1,6 @@
+
+package sample
+
+// just a sample that is compiled with the sample plugin enabled
+object Sample extends App {
+}
diff --git a/test/files/neg/t7622-missing-dependency/scalac-plugin.xml b/test/files/neg/t7622-missing-dependency/scalac-plugin.xml
new file mode 100644
index 0000000000..3c14061dce
--- /dev/null
+++ b/test/files/neg/t7622-missing-dependency/scalac-plugin.xml
@@ -0,0 +1,5 @@
+<plugin>
+ <name>myplugin</name>
+ <classname>scala.test.plugins.ThePlugin</classname>
+</plugin>
+
diff --git a/test/files/neg/t7622-missing-required.check b/test/files/neg/t7622-missing-required.check
new file mode 100644
index 0000000000..5982178581
--- /dev/null
+++ b/test/files/neg/t7622-missing-required.check
@@ -0,0 +1,2 @@
+error: Missing required plugin: special-plugin
+one error found
diff --git a/test/files/neg/t7622-missing-required.flags b/test/files/neg/t7622-missing-required.flags
new file mode 100644
index 0000000000..65deac6feb
--- /dev/null
+++ b/test/files/neg/t7622-missing-required.flags
@@ -0,0 +1 @@
+-Xplugin-require:special-plugin
diff --git a/test/files/neg/t7622-missing-required.scala b/test/files/neg/t7622-missing-required.scala
new file mode 100644
index 0000000000..a0ba487b24
--- /dev/null
+++ b/test/files/neg/t7622-missing-required.scala
@@ -0,0 +1,4 @@
+
+// the amazing features of this trait
+// are unlocked by compiling with a special plugin.
+trait Amazing
diff --git a/test/files/neg/t7622-multi-followers.check b/test/files/neg/t7622-multi-followers.check
new file mode 100644
index 0000000000..d123853a5b
--- /dev/null
+++ b/test/files/neg/t7622-multi-followers.check
@@ -0,0 +1 @@
+error: Multiple phases want to run right after parser; followers: multi1,multi2; created phase-order.dot
diff --git a/test/files/neg/t7622-multi-followers/ThePlugin.scala b/test/files/neg/t7622-multi-followers/ThePlugin.scala
new file mode 100644
index 0000000000..e7a49a9be6
--- /dev/null
+++ b/test/files/neg/t7622-multi-followers/ThePlugin.scala
@@ -0,0 +1,44 @@
+package scala.test.plugins
+
+import scala.tools.nsc
+import nsc.Global
+import nsc.Phase
+import nsc.plugins.Plugin
+import nsc.plugins.PluginComponent
+
+class ThePlugin(val global: Global) extends Plugin {
+ import global._
+
+ val name = "multi"
+ val description = "Declares two phases that both follow parser"
+ val components = List[PluginComponent](thePhase1,thePhase2)
+
+ private object thePhase1 extends PluginComponent {
+ val global = ThePlugin.this.global
+
+ val runsAfter = List[String]()
+
+ override val runsRightAfter = Some("parser")
+
+ val phaseName = ThePlugin.this.name + "1"
+
+ def newPhase(prev: Phase) = new ThePhase(prev, phaseName)
+ }
+
+ private object thePhase2 extends PluginComponent {
+ val global = ThePlugin.this.global
+
+ val runsAfter = List[String]()
+
+ override val runsRightAfter = Some("parser")
+
+ val phaseName = ThePlugin.this.name + "2"
+
+ def newPhase(prev: Phase) = new ThePhase(prev, phaseName)
+ }
+
+ private class ThePhase(prev: Phase, val name: String) extends Phase(prev) {
+ def run {}
+ }
+}
+
diff --git a/test/files/neg/t7622-multi-followers/sample_2.flags b/test/files/neg/t7622-multi-followers/sample_2.flags
new file mode 100644
index 0000000000..d2e83e9723
--- /dev/null
+++ b/test/files/neg/t7622-multi-followers/sample_2.flags
@@ -0,0 +1 @@
+-Xplugin:. -Xplugin-require:multi
diff --git a/test/files/neg/t7622-multi-followers/sample_2.scala b/test/files/neg/t7622-multi-followers/sample_2.scala
new file mode 100644
index 0000000000..73cdc64e40
--- /dev/null
+++ b/test/files/neg/t7622-multi-followers/sample_2.scala
@@ -0,0 +1,6 @@
+
+package sample
+
+// just a sample that is compiled with the sample plugin enabled
+object Sample extends App {
+}
diff --git a/test/files/neg/t7622-multi-followers/scalac-plugin.xml b/test/files/neg/t7622-multi-followers/scalac-plugin.xml
new file mode 100644
index 0000000000..2558d6fd03
--- /dev/null
+++ b/test/files/neg/t7622-multi-followers/scalac-plugin.xml
@@ -0,0 +1,5 @@
+<plugin>
+ <name>ignored</name>
+ <classname>scala.test.plugins.ThePlugin</classname>
+</plugin>
+
diff --git a/test/files/neg/t7834neg.check b/test/files/neg/t7834neg.check
new file mode 100644
index 0000000000..569df4b8ce
--- /dev/null
+++ b/test/files/neg/t7834neg.check
@@ -0,0 +1,41 @@
+t7834neg.scala:48: error: type mismatch;
+ found : C.super.q.type (with underlying type M2)
+ required: C.super.q.type
+ x1 = x2 // fail
+ ^
+t7834neg.scala:50: error: type mismatch;
+ found : C.super.q.type (with underlying type M1)
+ required: C.super.q.type
+ x2 = x1 // fail
+ ^
+t7834neg.scala:53: error: type mismatch;
+ found : C.super.q.type (with underlying type M1)
+ required: C.this.q.type
+ x3 = x1 // fail
+ ^
+t7834neg.scala:54: error: type mismatch;
+ found : C.super.q.type (with underlying type M2)
+ required: C.this.q.type
+ x3 = x2 // fail
+ ^
+t7834neg.scala:69: error: type mismatch;
+ found : C.super.q.type (with underlying type M2)
+ required: C.super.q.type
+ x1 = super[S2].q // fail
+ ^
+t7834neg.scala:71: error: type mismatch;
+ found : C.super.q.type (with underlying type M1)
+ required: C.super.q.type
+ x2 = super[S1].q // fail
+ ^
+t7834neg.scala:74: error: type mismatch;
+ found : C.super.q.type (with underlying type M1)
+ required: C.this.q.type
+ x3 = super[S1].q // fail
+ ^
+t7834neg.scala:75: error: type mismatch;
+ found : C.super.q.type (with underlying type M2)
+ required: C.this.q.type
+ x3 = super[S2].q // fail
+ ^
+8 errors found
diff --git a/test/files/neg/t7834neg.scala b/test/files/neg/t7834neg.scala
new file mode 100644
index 0000000000..d35a84eadd
--- /dev/null
+++ b/test/files/neg/t7834neg.scala
@@ -0,0 +1,76 @@
+class M1
+class M2 extends M1
+class M3 extends M2
+
+trait S1 { val q = new M1 ; val q1: q.type = q }
+trait S2 { val q = new M2 ; val q2: q.type = q }
+
+class B extends S1 with S2 {
+ override val q = new M3
+ val q3: q.type = q
+
+ var x1: B.super[S1].q1.type = null
+ var x2: B.super[S2].q2.type = null
+ var x3: B.this.q3.type = null
+
+ x1 = x1
+ x1 = x2
+ x1 = x3
+ x2 = x1
+ x2 = x2
+ x2 = x3
+ x3 = x1
+ x3 = x2
+ x3 = x3
+
+ x1 = q1
+ x1 = q2
+ x1 = q3
+ x2 = q1
+ x2 = q2
+ x2 = q3
+ x3 = q1
+ x3 = q2
+ x3 = x3
+}
+
+class C extends S1 with S2 {
+ override val q = new M3
+ val q3: q.type = q
+
+ // x1's type and x2's type are incompatible
+ // x3's is assignable to x1 or x2, but not vice versa
+ var x1: C.super[S1].q.type = null
+ var x2: C.super[S2].q.type = null
+ var x3: C.this.q.type = null
+
+ x1 = x1
+ x1 = x2 // fail
+ x1 = x3
+ x2 = x1 // fail
+ x2 = x2
+ x2 = x3
+ x3 = x1 // fail
+ x3 = x2 // fail
+ x3 = x3
+
+ x1 = q1
+ x1 = q2
+ x1 = q3
+ x2 = q1
+ x2 = q2
+ x2 = q3
+ x3 = q1
+ x3 = q2
+ x3 = x3
+
+ x1 = q
+ x1 = super[S1].q
+ x1 = super[S2].q // fail
+ x2 = q
+ x2 = super[S1].q // fail
+ x2 = super[S2].q
+ x3 = q
+ x3 = super[S1].q // fail
+ x3 = super[S2].q // fail
+}
diff --git a/test/files/pos/infersingle.scala b/test/files/pos/infersingle.scala
index 6830fcd799..60f4ff07e6 100644
--- a/test/files/pos/infersingle.scala
+++ b/test/files/pos/infersingle.scala
@@ -1,5 +1,52 @@
-object Test {
+object Test1 {
def one[T](x: T): Option[T] = Some(x)
val x = "one"
val y: Option[x.type] = one(x)
-} \ No newline at end of file
+}
+
+object Test2 {
+ // Has never worked, but seems desirable given the recent changes to
+ // pattern type inference.
+ val a = ""
+ object Id {
+ def unapply(xxxx: Any): Some[a.type] = Some[a.type](a)
+ }
+ val b: a.type = (a: a.type) match {
+ case Id(x) => x
+ }
+}
+
+object Test3 {
+ val a = ""
+ object Id {
+ def unapply(xxxx: Any): Some[Test3.type] = Some[Test3.type](Test3)
+ }
+ val b: Test3.type = a match {
+ case Id(x) => x
+ }
+}
+
+class Test4 {
+ val a = ""
+ object Id {
+ def unapply(xxxx: Any): Some[Test4.this.type] = Some[Test4.this.type](Test4.this)
+ }
+ val b: Test4.this.type = a match {
+ case Id(x) => x
+ }
+}
+
+class Super5 {
+ final val q = ""
+ def q1: q.type = q
+}
+
+class Test5 extends Super5 {
+ val a = ""
+ object Id {
+ def unapply(xxxx: Any): Some[Test5.super.q.type] = Some[Test5.super.q.type](q1)
+ }
+ val b: Test5.super.q.type = a match {
+ case Id(x) => x
+ }
+}
diff --git a/test/files/pos/private-types-after-typer.scala b/test/files/pos/private-types-after-typer.scala
new file mode 100644
index 0000000000..79ef934063
--- /dev/null
+++ b/test/files/pos/private-types-after-typer.scala
@@ -0,0 +1,9 @@
+// Testing that the type of the outer accessor in O2
+// doesn't crash the compiler over private type escaping scope.
+trait T {
+ class C {
+ private object O1 {
+ object O2
+ }
+ }
+} \ No newline at end of file
diff --git a/test/files/pos/t7818.scala b/test/files/pos/t7818.scala
new file mode 100644
index 0000000000..77b99e7d5d
--- /dev/null
+++ b/test/files/pos/t7818.scala
@@ -0,0 +1,10 @@
+class Observable1[+T](val asJava: JObservable[_ <: T]) extends AnyVal {
+ private def foo[X](a: JObservable[X]): JObservable[X] = ???
+ // was generating a type error as the type of the RHS included an existential
+ // skolem based on the class type parameter `T`, which did not conform
+ // to the typer parameter of the extension method into which the RHS is
+ // transplanted.
+ def synchronize: Observable1[T] = new Observable1(foo(asJava))
+}
+
+class JObservable[T]
diff --git a/test/files/pos/t7834.scala b/test/files/pos/t7834.scala
new file mode 100644
index 0000000000..fc9a0aa09d
--- /dev/null
+++ b/test/files/pos/t7834.scala
@@ -0,0 +1,6 @@
+class S { val q = "" }
+
+class B extends S {
+ val x1: B.super.q.type = q
+ val x2: B.this.q.type = q
+}
diff --git a/test/files/run/compiler-asSeenFrom.check b/test/files/run/compiler-asSeenFrom.check
index 47d40b0331..a1826c2784 100644
--- a/test/files/run/compiler-asSeenFrom.check
+++ b/test/files/run/compiler-asSeenFrom.check
@@ -1,6 +1,54 @@
class C {
type seen from prefix is
---- ---------------- --
+ C.this.I[Int] C[List[T3]] C[List[T3]]#I[Int]
+ C.this.I[Int] C[T1] C[T1]#I[Int]
+ C.this.I[Int] D[A1] D[A1]#I[Int]
+ C.this.I[Int] D[T3] D[T3]#I[Int]
+ C.this.I[List[Int]] C[List[T3]] C[List[T3]]#I[List[Int]]
+ C.this.I[List[Int]] C[T1] C[T1]#I[List[Int]]
+ C.this.I[List[Int]] D[A1] D[A1]#I[List[Int]]
+ C.this.I[List[Int]] D[T3] D[T3]#I[List[Int]]
+ C.this.I[T1] C[List[T3]] C[List[T3]]#I[List[T3]]
+ C.this.I[T1] C[T1] C[T1]#I[T1]
+ C.this.I[T1] D[A1] D[A1]#I[A1]
+ C.this.I[T1] D[T3] D[T3]#I[T3]
+ C.this.I[T2] C[List[T3]] C[List[T3]]#I[T2]
+ C.this.I[T2] C[T1] C[T1]#I[T2]
+ C.this.I[T2] D[A1] D[A1]#I[T2]
+ C.this.I[T2] D[T3] D[T3]#I[T2]
+ C.this.I[T3] C[List[T3]] C[List[T3]]#I[T3]
+ C.this.I[T3] C[T1] C[T1]#I[T3]
+ C.this.I[T3] D[A1] D[A1]#I[T3]
+ C.this.I[T3] D[T3] D[T3]#I[T3]
+ C.this.I[T4] C[List[T3]] C[List[T3]]#I[T4]
+ C.this.I[T4] C[T1] C[T1]#I[T4]
+ C.this.I[T4] D[A1] D[A1]#I[T4]
+ C.this.I[T4] D[T3] D[T3]#I[T4]
+ C.this.J[Int] C[List[T3]] C[List[T3]]#J[Int]
+ C.this.J[Int] C[T1] C[T1]#J[Int]
+ C.this.J[Int] D[A1] D[A1]#J[Int]
+ C.this.J[Int] D[T3] D[T3]#J[Int]
+ C.this.J[List[Int]] C[List[T3]] C[List[T3]]#J[List[Int]]
+ C.this.J[List[Int]] C[T1] C[T1]#J[List[Int]]
+ C.this.J[List[Int]] D[A1] D[A1]#J[List[Int]]
+ C.this.J[List[Int]] D[T3] D[T3]#J[List[Int]]
+ C.this.J[T1] C[List[T3]] C[List[T3]]#J[List[T3]]
+ C.this.J[T1] C[T1] C[T1]#J[T1]
+ C.this.J[T1] D[A1] D[A1]#J[A1]
+ C.this.J[T1] D[T3] D[T3]#J[T3]
+ C.this.J[T2] C[List[T3]] C[List[T3]]#J[T2]
+ C.this.J[T2] C[T1] C[T1]#J[T2]
+ C.this.J[T2] D[A1] D[A1]#J[T2]
+ C.this.J[T2] D[T3] D[T3]#J[T2]
+ C.this.J[T3] C[List[T3]] C[List[T3]]#J[T3]
+ C.this.J[T3] C[T1] C[T1]#J[T3]
+ C.this.J[T3] D[A1] D[A1]#J[T3]
+ C.this.J[T3] D[T3] D[T3]#J[T3]
+ C.this.J[T4] C[List[T3]] C[List[T3]]#J[T4]
+ C.this.J[T4] C[T1] C[T1]#J[T4]
+ C.this.J[T4] D[A1] D[A1]#J[T4]
+ C.this.J[T4] D[T3] D[T3]#J[T4]
C[List[T3]]#I[T1] D[A1] C[List[T3]]#I[A1]
C[List[T3]]#I[T1] D[T3] C[List[T3]]#I[T3]
C[List[T3]]#J[T1] D[A1] C[List[T3]]#J[A1]
@@ -49,6 +97,8 @@ class C {
class D {
type seen from prefix is
---- ---------------- --
+ C.this.I[T3] D[A1] C.this.I[A1]
+ C.this.J[T3] D[A1] C.this.J[A1]
C[List[T3]]#I[Int] D[A1] C[List[A1]]#I[Int]
C[List[T3]]#I[List[Int]] D[A1] C[List[A1]]#I[List[Int]]
C[List[T3]]#I[T1] D[A1] C[List[A1]]#I[T1]
@@ -73,6 +123,42 @@ class D {
class I {
type seen from prefix is
---- ---------------- --
+ C.this.I[Int] D.this.J[T4] D.this.cD.I[Int]
+ C.this.I[Int] Z.dZ.J[A2] Z.dZ.cD.I[Int]
+ C.this.I[Int] Z.dZ.J[P] Z.dZ.cD.I[Int]
+ C.this.I[List[Int]] D.this.J[T4] D.this.cD.I[List[Int]]
+ C.this.I[List[Int]] Z.dZ.J[A2] Z.dZ.cD.I[List[Int]]
+ C.this.I[List[Int]] Z.dZ.J[P] Z.dZ.cD.I[List[Int]]
+ C.this.I[T1] D.this.J[T4] D.this.cD.I[List[T3]]
+ C.this.I[T1] Z.dZ.J[A2] Z.dZ.cD.I[List[A1]]
+ C.this.I[T1] Z.dZ.J[P] Z.dZ.cD.I[List[A1]]
+ C.this.I[T2] D.this.J[T4] D.this.cD.I[T4]
+ C.this.I[T2] Z.dZ.J[A2] Z.dZ.cD.I[A2]
+ C.this.I[T2] Z.dZ.J[P] Z.dZ.cD.I[P]
+ C.this.I[T3] D.this.J[T4] D.this.cD.I[T3]
+ C.this.I[T3] Z.dZ.J[A2] Z.dZ.cD.I[T3]
+ C.this.I[T3] Z.dZ.J[P] Z.dZ.cD.I[T3]
+ C.this.I[T4] D.this.J[T4] D.this.cD.I[T4]
+ C.this.I[T4] Z.dZ.J[A2] Z.dZ.cD.I[T4]
+ C.this.I[T4] Z.dZ.J[P] Z.dZ.cD.I[T4]
+ C.this.J[Int] D.this.J[T4] D.this.cD.J[Int]
+ C.this.J[Int] Z.dZ.J[A2] Z.dZ.cD.J[Int]
+ C.this.J[Int] Z.dZ.J[P] Z.dZ.cD.J[Int]
+ C.this.J[List[Int]] D.this.J[T4] D.this.cD.J[List[Int]]
+ C.this.J[List[Int]] Z.dZ.J[A2] Z.dZ.cD.J[List[Int]]
+ C.this.J[List[Int]] Z.dZ.J[P] Z.dZ.cD.J[List[Int]]
+ C.this.J[T1] D.this.J[T4] D.this.cD.J[List[T3]]
+ C.this.J[T1] Z.dZ.J[A2] Z.dZ.cD.J[List[A1]]
+ C.this.J[T1] Z.dZ.J[P] Z.dZ.cD.J[List[A1]]
+ C.this.J[T2] D.this.J[T4] D.this.cD.J[T4]
+ C.this.J[T2] Z.dZ.J[A2] Z.dZ.cD.J[A2]
+ C.this.J[T2] Z.dZ.J[P] Z.dZ.cD.J[P]
+ C.this.J[T3] D.this.J[T4] D.this.cD.J[T3]
+ C.this.J[T3] Z.dZ.J[A2] Z.dZ.cD.J[T3]
+ C.this.J[T3] Z.dZ.J[P] Z.dZ.cD.J[T3]
+ C.this.J[T4] D.this.J[T4] D.this.cD.J[T4]
+ C.this.J[T4] Z.dZ.J[A2] Z.dZ.cD.J[T4]
+ C.this.J[T4] Z.dZ.J[P] Z.dZ.cD.J[T4]
C[List[T3]]#I[T1] D.this.J[T4] C[List[T3]]#I[List[T3]]
C[List[T3]]#I[T1] Z.dZ.J[A2] C[List[T3]]#I[List[A1]]
C[List[T3]]#I[T1] Z.dZ.J[P] C[List[T3]]#I[List[A1]]
@@ -137,6 +223,14 @@ class I {
class J {
type seen from prefix is
---- ---------------- --
+ C.this.I[T3] Z.dZ.J[A2] C.this.I[A1]
+ C.this.I[T3] Z.dZ.J[P] C.this.I[A1]
+ C.this.I[T4] Z.dZ.J[A2] C.this.I[A2]
+ C.this.I[T4] Z.dZ.J[P] C.this.I[P]
+ C.this.J[T3] Z.dZ.J[A2] C.this.J[A1]
+ C.this.J[T3] Z.dZ.J[P] C.this.J[A1]
+ C.this.J[T4] Z.dZ.J[A2] C.this.J[A2]
+ C.this.J[T4] Z.dZ.J[P] C.this.J[P]
C[List[T3]]#I[Int] Z.dZ.J[A2] C[List[A1]]#I[Int]
C[List[T3]]#I[Int] Z.dZ.J[P] C[List[A1]]#I[Int]
C[List[T3]]#I[List[Int]] Z.dZ.J[A2] C[List[A1]]#I[List[Int]]
@@ -269,8 +363,8 @@ value jZ { // after parser
value jZ { // after explicitouter
protected val $outer: D.this.type
- val $outer(): D.this.type
- val $outer(): C.this.type
+ val $outer(): ll.D[T3]
+ val $outer(): ll.C[T1]
def thisI(): I.this.type
def thisC(): C.this.type
def t2(): T2
diff --git a/test/files/run/idempotency-case-classes.check b/test/files/run/idempotency-case-classes.check
index e0453883ff..5a8d0ad9d3 100644
--- a/test/files/run/idempotency-case-classes.check
+++ b/test/files/run/idempotency-case-classes.check
@@ -47,7 +47,7 @@ C(2,3)
case <synthetic> def unapply(x$0: C): Option[(Int, Int)] = if (x$0.==(null))
scala.this.None
else
- Some.apply[(Int, Int)](Tuple2.apply[Int, Int](x$0.x, x$0.y));
+ Some.apply[(Int, Int)](scala.Tuple2.apply[Int, Int](x$0.x, x$0.y));
<synthetic> private def readResolve(): Object = C
};
Predef.println(C.apply(2, 3))
diff --git a/test/files/run/inline-ex-handlers.scala b/test/files/run/inline-ex-handlers.scala
index 33e794b940..964594d258 100644
--- a/test/files/run/inline-ex-handlers.scala
+++ b/test/files/run/inline-ex-handlers.scala
@@ -1,6 +1,6 @@
-import scala.tools.partest.IcodeTest
+import scala.tools.partest.IcodeComparison
-object Test extends IcodeTest {
+object Test extends IcodeComparison {
override def printIcodeAfterPhase = "inlinehandlers"
}
diff --git a/test/files/run/predef-cycle.scala b/test/files/run/predef-cycle.scala
new file mode 100644
index 0000000000..ab147688bc
--- /dev/null
+++ b/test/files/run/predef-cycle.scala
@@ -0,0 +1,71 @@
+class Force {
+ val t1 = new Thread {
+ override def run() {
+ scala.`package`
+ }
+ }
+ val t2 = new Thread {
+ override def run() {
+ scala.Predef
+ }
+ }
+ t1.start()
+ t2.start()
+ t1.join()
+ t2.join()
+}
+
+object Test {
+ def main(args: Array[String]) {
+ new Force()
+ }
+}
+
+/* Was deadlocking:
+"Thread-2" prio=5 tid=7f9637268000 nid=0x119601000 in Object.wait() [119600000]
+ java.lang.Thread.State: RUNNABLE
+ at scala.Predef$.<init>(Predef.scala:90)
+ at scala.Predef$.<clinit>(Predef.scala)
+ at Force$$anon$2.run(predef-cycle.scala:10)
+
+"Thread-1" prio=5 tid=7f9637267800 nid=0x1194fe000 in Object.wait() [1194fb000]
+ java.lang.Thread.State: RUNNABLE
+ at scala.collection.immutable.Set$Set4.$plus(Set.scala:127)
+ at scala.collection.immutable.Set$Set4.$plus(Set.scala:121)
+ at scala.collection.mutable.SetBuilder.$plus$eq(SetBuilder.scala:24)
+ at scala.collection.mutable.SetBuilder.$plus$eq(SetBuilder.scala:22)
+ at scala.collection.generic.Growable$$anonfun$$plus$plus$eq$1.apply(Growable.scala:48)
+ at scala.collection.generic.Growable$$anonfun$$plus$plus$eq$1.apply(Growable.scala:48)
+ at scala.collection.immutable.List.foreach(List.scala:318)
+ at scala.collection.generic.Growable$class.$plus$plus$eq(Growable.scala:48)
+ at scala.collection.mutable.SetBuilder.$plus$plus$eq(SetBuilder.scala:22)
+ at scala.collection.TraversableLike$class.to(TraversableLike.scala:629)
+ at scala.collection.AbstractTraversable.to(Traversable.scala:105)
+ at scala.collection.TraversableOnce$class.toSet(TraversableOnce.scala:267)
+ at scala.collection.AbstractTraversable.toSet(Traversable.scala:105)
+ at scala.runtime.ScalaRunTime$.<init>(ScalaRunTime.scala:50)
+ at scala.runtime.ScalaRunTime$.<clinit>(ScalaRunTime.scala)
+ at scala.collection.mutable.HashTable$HashUtils$class.elemHashCode(HashTable.scala)
+ at scala.collection.mutable.HashMap.elemHashCode(HashMap.scala:39)
+ at scala.collection.mutable.HashTable$class.findOrAddEntry(HashTable.scala:161)
+ at scala.collection.mutable.HashMap.findOrAddEntry(HashMap.scala:39)
+ at scala.collection.mutable.HashMap.put(HashMap.scala:75)
+ at scala.collection.mutable.HashMap.update(HashMap.scala:80)
+ at scala.sys.SystemProperties$.addHelp(SystemProperties.scala:64)
+ at scala.sys.SystemProperties$.bool(SystemProperties.scala:68)
+ at scala.sys.SystemProperties$.noTraceSupression$lzycompute(SystemProperties.scala:80)
+ - locked <7b8b0e228> (a scala.sys.SystemProperties$)
+ at scala.sys.SystemProperties$.noTraceSupression(SystemProperties.scala:80)
+ at scala.util.control.NoStackTrace$.<init>(NoStackTrace.scala:31)
+ at scala.util.control.NoStackTrace$.<clinit>(NoStackTrace.scala)
+ at scala.util.control.NoStackTrace$class.fillInStackTrace(NoStackTrace.scala:22)
+ at scala.util.control.BreakControl.fillInStackTrace(Breaks.scala:93)
+ at java.lang.Throwable.<init>(Throwable.java:181)
+ at scala.util.control.BreakControl.<init>(Breaks.scala:93)
+ at scala.util.control.Breaks.<init>(Breaks.scala:28)
+ at scala.collection.Traversable$.<init>(Traversable.scala:96)
+ at scala.collection.Traversable$.<clinit>(Traversable.scala)
+ at scala.package$.<init>(package.scala:46)
+ at scala.package$.<clinit>(package.scala)
+ at Force$$anon$1.run(predef-cycle.scala:4)
+ */ \ No newline at end of file
diff --git a/test/files/run/programmatic-main.check b/test/files/run/programmatic-main.check
index 61b947214c..a6e53fbe92 100644
--- a/test/files/run/programmatic-main.check
+++ b/test/files/run/programmatic-main.check
@@ -22,11 +22,6 @@ superaccessors 6 add super accessors in traits and nested classes
mixin 20 mixin composition
cleanup 21 platform-specific cleanups, generate reflective calls
icode 22 generate portable intermediate code
- inliner 23 optimization: do inlining
-inlinehandlers 24 optimization: inline exception handlers
- closelim 25 optimization: eliminate uncalled closures
- constopt 26 optimization: optimize null and other constants
- dce 27 optimization: eliminate dead code
- jvm 28 generate JVM bytecode
- terminal 29 The last phase in the compiler chain
+ jvm 23 generate JVM bytecode
+ terminal 24 the last phase during a compilation run
diff --git a/test/files/run/t1909.check b/test/files/run/t1909.check
new file mode 100644
index 0000000000..7d25be60fd
--- /dev/null
+++ b/test/files/run/t1909.check
@@ -0,0 +1,3 @@
+t1909.scala:7: warning: A try without a catch or finally is equivalent to putting its body in a block; no exceptions are handled.
+ def this(p: String) = this(try 0)
+ ^
diff --git a/test/files/pos/t1909.scala b/test/files/run/t1909.scala
index 01213f62a3..8ead7bacf2 100644
--- a/test/files/pos/t1909.scala
+++ b/test/files/run/t1909.scala
@@ -6,3 +6,7 @@ class Ticket1909 {
def this(value: Int) = this()
def this(p: String) = this(try 0)
}
+
+object Test extends App {
+ new Ticket1909("")
+}
diff --git a/test/files/pos/t1909b-pos.scala b/test/files/run/t1909b.scala
index b914bee366..89b2af57dc 100644
--- a/test/files/pos/t1909b-pos.scala
+++ b/test/files/run/t1909b.scala
@@ -3,4 +3,7 @@ class Ticket1909 (x: Int) {
def bar() = 5
bar
})
-} \ No newline at end of file
+}
+object Test extends App {
+ new Ticket1909()
+}
diff --git a/test/files/run/t1909c.scala b/test/files/run/t1909c.scala
new file mode 100644
index 0000000000..87c0eb08b5
--- /dev/null
+++ b/test/files/run/t1909c.scala
@@ -0,0 +1,9 @@
+class Base(a: Any)
+
+// java.lang.VerifyError: (class: Sub, method: <init> signature: ()V) Expecting to find object/array on stack
+// at Test$.<init>(t1909c.scala)
+class Sub() extends Base({ def bippy = 5; bippy })
+
+object Test extends App {
+ new Sub()
+}
diff --git a/test/files/run/t3832.scala b/test/files/run/t3832.scala
new file mode 100644
index 0000000000..ac44358bc7
--- /dev/null
+++ b/test/files/run/t3832.scala
@@ -0,0 +1,17 @@
+class t3832 {
+ def this(un: Int) = {
+ this()
+ def bippy = this
+ ()
+ }
+ def this(un: Boolean) = {
+ this()
+ def boppy = () => this
+ ()
+ }
+}
+
+object Test extends App {
+ new t3832(0)
+ new t3832(true)
+}
diff --git a/test/files/run/t5313.scala b/test/files/run/t5313.scala
index febfd9c3ed..4cbc29ba5d 100644
--- a/test/files/run/t5313.scala
+++ b/test/files/run/t5313.scala
@@ -1,6 +1,6 @@
-import scala.tools.partest.IcodeTest
+import scala.tools.partest.IcodeComparison
-object Test extends IcodeTest {
+object Test extends IcodeComparison {
override def printIcodeAfterPhase = "dce"
override def extraSettings: String = super.extraSettings + " -optimize"
@@ -48,7 +48,7 @@ object Test extends IcodeTest {
override def show() {
val storeLocal = "STORE_LOCAL"
- val lines1 = collectIcode("") filter (_ contains storeLocal) map (x => x.drop(x.indexOf(storeLocal)))
+ val lines1 = collectIcode() filter (_ contains storeLocal) map (x => x.drop(x.indexOf(storeLocal)))
println(lines1 mkString "\n")
}
}
diff --git a/test/files/run/t6102.check b/test/files/run/t6102.check
index 97e455647b..4e8efa7b6d 100644
--- a/test/files/run/t6102.check
+++ b/test/files/run/t6102.check
@@ -20,10 +20,12 @@
[running phase mixin on t6102.scala]
[running phase cleanup on t6102.scala]
[running phase icode on t6102.scala]
+#partest -optimise
[running phase inliner on t6102.scala]
[running phase inlinehandlers on t6102.scala]
[running phase closelim on t6102.scala]
[running phase constopt on t6102.scala]
+#partest
[running phase dce on t6102.scala]
[running phase jvm on icode]
hello
diff --git a/test/files/run/t6102.flags b/test/files/run/t6102.flags
index 72fe7b1aa0..726e2a997f 100644
--- a/test/files/run/t6102.flags
+++ b/test/files/run/t6102.flags
@@ -1 +1 @@
- -Ydead-code -Ydebug -Xfatal-warnings
+-Ydead-code -Ydebug -Xfatal-warnings
diff --git a/test/files/run/t6288b-jump-position.scala b/test/files/run/t6288b-jump-position.scala
index e22a1ab120..c5f3bbe788 100644
--- a/test/files/run/t6288b-jump-position.scala
+++ b/test/files/run/t6288b-jump-position.scala
@@ -1,6 +1,6 @@
-import scala.tools.partest.IcodeTest
+import scala.tools.partest.IcodeComparison
-object Test extends IcodeTest {
+object Test extends IcodeComparison {
override def code =
"""object Case3 { // 01
| def unapply(z: Any): Option[Int] = Some(-1) // 02
@@ -15,8 +15,5 @@ object Test extends IcodeTest {
| }
|}""".stripMargin
- override def show() {
- val lines1 = collectIcode("")
- println(lines1 mkString "\n")
- }
+ override def show() = showIcode()
}
diff --git a/test/files/run/t6955.check b/test/files/run/t6955.check
deleted file mode 100644
index 0cfbf08886..0000000000
--- a/test/files/run/t6955.check
+++ /dev/null
@@ -1 +0,0 @@
-2
diff --git a/test/files/run/t6955.scala b/test/files/run/t6955.scala
index 980aa420cc..329af688e4 100644
--- a/test/files/run/t6955.scala
+++ b/test/files/run/t6955.scala
@@ -1,4 +1,4 @@
-import scala.tools.partest.IcodeTest
+import scala.tools.partest.IcodeComparison
// this class should compile to code that uses switches (twice)
class Switches {
@@ -20,9 +20,15 @@ class Switches {
}
}
-object Test extends IcodeTest {
+object Test extends IcodeComparison {
// ensure we get two switches out of this -- ignore the rest of the output for robustness
// exclude the constant we emit for the "SWITCH ..." string below (we get the icode for all the code you see in this file)
- override def show() = println(collectIcode("").filter(x => x.indexOf("SWITCH ...") >= 0 && x.indexOf("CONSTANT(") == -1).size)
+ override def show() = {
+ val expected = 2
+ val actual = (collectIcode() filter {
+ x => x.indexOf("SWITCH ...") >= 0 && x.indexOf("CONSTANT(") == -1
+ }).size
+ assert(actual == expected)
+ }
}
diff --git a/test/files/run/t6956.check b/test/files/run/t6956.check
deleted file mode 100644
index 0cfbf08886..0000000000
--- a/test/files/run/t6956.check
+++ /dev/null
@@ -1 +0,0 @@
-2
diff --git a/test/files/run/t6956.scala b/test/files/run/t6956.scala
index 4a6583ca45..3569adf483 100644
--- a/test/files/run/t6956.scala
+++ b/test/files/run/t6956.scala
@@ -1,4 +1,4 @@
-import scala.tools.partest.IcodeTest
+import scala.tools.partest.IcodeComparison
class Switches {
private[this] final val ONE = 1
@@ -18,9 +18,14 @@ class Switches {
}
}
-object Test extends IcodeTest {
+object Test extends IcodeComparison {
// ensure we get two switches out of this -- ignore the rest of the output for robustness
// exclude the constant we emit for the "SWITCH ..." string below (we get the icode for all the code you see in this file)
- override def show() = println(collectIcode("").filter(x => x.indexOf("SWITCH ...") >= 0 && x.indexOf("CONSTANT(") == -1).size)
+ override def show() = {
+ val expected = 2
+ val actual = (collectIcode() filter {
+ x => x.indexOf("SWITCH ...") >= 0 && x.indexOf("CONSTANT(") == -1
+ }).size
+ assert(actual == expected)
+ }
}
-
diff --git a/test/files/run/t7223.check b/test/files/run/t7223.check
new file mode 100644
index 0000000000..573541ac97
--- /dev/null
+++ b/test/files/run/t7223.check
@@ -0,0 +1 @@
+0
diff --git a/test/files/run/t7223.scala b/test/files/run/t7223.scala
new file mode 100644
index 0000000000..a707e957df
--- /dev/null
+++ b/test/files/run/t7223.scala
@@ -0,0 +1,11 @@
+class D(val a: () => Int => () => Any) {
+ a()(0)()
+}
+
+object Crash extends D(() => {
+ (x: Int) => {() => { new { println(x.toString) } }}
+})
+
+object Test extends App {
+ Crash
+}
diff --git a/test/files/run/t7269.scala b/test/files/run/t7269.scala
new file mode 100644
index 0000000000..d22e57dfee
--- /dev/null
+++ b/test/files/run/t7269.scala
@@ -0,0 +1,32 @@
+import scala.collection.JavaConversions._
+import scala.collection.mutable
+
+object Test extends App {
+
+ def testMap(): Unit = {
+ val mapJ = new java.util.HashMap[Int, String]
+ val mapS: mutable.Map[Int, String] = mapJ
+
+ (10 to 20).foreach(i => mapS += ((i, i.toString)))
+ assert(11 == mapS.size)
+
+ // ConcurrentModificationException thrown in the following line
+ mapS.retain((i, str) => i % 2 == 0)
+ assert(6 == mapS.size)
+ }
+
+ def testSet(): Unit = {
+ val mapJ = new java.util.HashSet[Int]
+ val mapS: mutable.Set[Int] = mapJ
+
+ (10 to 20).foreach(i => mapS += i)
+ assert(11 == mapS.size)
+
+ // ConcurrentModificationException thrown in the following line
+ mapS.retain((i) => i % 2 == 0)
+ assert(6 == mapS.size)
+ }
+
+ testSet()
+ testMap()
+}
diff --git a/test/files/run/t7801.check b/test/files/run/t7801.check
new file mode 100644
index 0000000000..d72060c684
--- /dev/null
+++ b/test/files/run/t7801.check
@@ -0,0 +1,11 @@
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala> val g: scala.reflect.internal.SymbolTable = null; import g.abort
+g: scala.reflect.internal.SymbolTable = null
+import g.abort
+
+scala> class C(val a: Any) extends AnyVal
+defined class C
+
+scala>
diff --git a/test/files/run/t7801.scala b/test/files/run/t7801.scala
new file mode 100644
index 0000000000..3a3cc97a51
--- /dev/null
+++ b/test/files/run/t7801.scala
@@ -0,0 +1,12 @@
+import scala.tools.partest.ReplTest
+
+// was crashing due to a subtle interaction of the Namer entering packages into
+// enclosing packages by mutating the scope in place without invalidating later
+// entries in the enclosing package class symbols type history.
+//
+// Sadly, I couldn't whittle the test case down further.
+object Test extends ReplTest {
+ override def code = """val g: scala.reflect.internal.SymbolTable = null; import g.abort
+ |class C(val a: Any) extends AnyVal""".stripMargin
+
+}
diff --git a/test/files/run/test-cpp.scala b/test/files/run/test-cpp.scala
index f9fa85c4d0..c6eda56776 100644
--- a/test/files/run/test-cpp.scala
+++ b/test/files/run/test-cpp.scala
@@ -12,9 +12,9 @@
* instead of 'l'.
*/
-import scala.tools.partest.IcodeTest
+import scala.tools.partest.IcodeComparison
-object Test extends IcodeTest {
+object Test extends IcodeComparison {
override def printIcodeAfterPhase = "dce"
}