diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2015-07-23 12:25:49 +1000 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2015-07-23 12:25:49 +1000 |
commit | 96fd54b2f05152bd433f288049ab929f9965b16d (patch) | |
tree | 1a3017c4d039ebe1c4d8e6a75395efbfbc2890f4 /test/files | |
parent | f6756eaaa5504538f8fa23fc37f8728e56f76908 (diff) | |
parent | 0e9525aa618a2eca143a1c7379ff1e6efd23b86e (diff) | |
download | scala-96fd54b2f05152bd433f288049ab929f9965b16d.tar.gz scala-96fd54b2f05152bd433f288049ab929f9965b16d.tar.bz2 scala-96fd54b2f05152bd433f288049ab929f9965b16d.zip |
Merge remote-tracking branch 'origin/2.11.x' into merge/2.11.x-to-2.12.x-20152307
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/neg/t7214neg.scala | 2 | ||||
-rw-r--r-- | test/files/neg/t9401.check | 4 | ||||
-rw-r--r-- | test/files/neg/t9401.scala | 4 | ||||
-rw-r--r-- | test/files/pos/t6089b.scala | 2 | ||||
-rw-r--r-- | test/files/pos/t7689.scala | 2 | ||||
-rw-r--r-- | test/files/pos/t9370/ThePlugin.scala | 31 | ||||
-rw-r--r-- | test/files/pos/t9370/sample_2.flags | 1 | ||||
-rw-r--r-- | test/files/pos/t9370/sample_2.scala | 6 | ||||
-rw-r--r-- | test/files/pos/t9370/scalac-plugin.xml | 5 | ||||
-rwxr-xr-x | test/files/run/t2127.scala | 2 | ||||
-rw-r--r-- | test/files/run/t7214.scala | 2 | ||||
-rw-r--r-- | test/files/run/t8502b.scala | 46 | ||||
-rw-r--r-- | test/files/run/test-cpp.scala | 2 |
13 files changed, 103 insertions, 6 deletions
diff --git a/test/files/neg/t7214neg.scala b/test/files/neg/t7214neg.scala index ff1ea8082d..e2b2d908d8 100644 --- a/test/files/neg/t7214neg.scala +++ b/test/files/neg/t7214neg.scala @@ -1,4 +1,4 @@ -// pattern matcher crashes here trying to synthesize an uneeded outer test. +// pattern matcher crashes here trying to synthesize an unneeded outer test. // no-symbol does not have an owner // at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:49) // at scala.tools.nsc.Global.abort(Global.scala:253) diff --git a/test/files/neg/t9401.check b/test/files/neg/t9401.check new file mode 100644 index 0000000000..638d56db63 --- /dev/null +++ b/test/files/neg/t9401.check @@ -0,0 +1,4 @@ +t9401.scala:3: error: cannot find class tag for element type T + gencastarray = new Array[T](0) + ^ +one error found diff --git a/test/files/neg/t9401.scala b/test/files/neg/t9401.scala new file mode 100644 index 0000000000..f42ecc7f74 --- /dev/null +++ b/test/files/neg/t9401.scala @@ -0,0 +1,4 @@ +class Resetting[T] { + var gencastarray: Any = null + gencastarray = new Array[T](0) +} diff --git a/test/files/pos/t6089b.scala b/test/files/pos/t6089b.scala index ff7ca157eb..040987413e 100644 --- a/test/files/pos/t6089b.scala +++ b/test/files/pos/t6089b.scala @@ -1,5 +1,5 @@ // this crazy code simply tries to nest pattern matches so that the last call is in a tricky-to-determine -// tail position (my initial tightenign of tailpos detection for SI-6089 ruled this out) +// tail position (my initial tightening of tailpos detection for SI-6089 ruled this out) class BKTree { @annotation.tailrec final def -?-[AA](a: AA): Boolean = this match { diff --git a/test/files/pos/t7689.scala b/test/files/pos/t7689.scala index 022e7ab7a0..72cca99bc0 100644 --- a/test/files/pos/t7689.scala +++ b/test/files/pos/t7689.scala @@ -2,6 +2,6 @@ object A { // The default getter must have an explicit return type (List[_] => Int) // This wasn't happening since e28c3edda4. That commit encoded upper/lower // bounds of Any/Nothing as EmptyTree, which were triggering an .isEmpty - // check in Namers#TypeTreeSubstitutor + // check in Namers#TypeTreeSubstituter def x(f: List[_] => Int = _ => 3) = 9 } diff --git a/test/files/pos/t9370/ThePlugin.scala b/test/files/pos/t9370/ThePlugin.scala new file mode 100644 index 0000000000..cd800781dc --- /dev/null +++ b/test/files/pos/t9370/ThePlugin.scala @@ -0,0 +1,31 @@ +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 = "timebomb" + val description = "Explodes if run. Maybe I haven't implemented it yet." + val components = List[PluginComponent](thePhase1) + + private object thePhase1 extends PluginComponent { + val global = ThePlugin.this.global + + val runsAfter = List[String]("parser") + override val runsBefore = List[String]("namer") + val phaseName = ThePlugin.this.name + + def newPhase(prev: Phase) = new ThePhase(prev) + } + + private class ThePhase(prev: Phase) extends Phase(prev) { + override def name = ThePlugin.this.name + override def run = ??? + } +} + diff --git a/test/files/pos/t9370/sample_2.flags b/test/files/pos/t9370/sample_2.flags new file mode 100644 index 0000000000..03baca3030 --- /dev/null +++ b/test/files/pos/t9370/sample_2.flags @@ -0,0 +1 @@ +-Xplugin:/tmp:. -Xplugin-require:timebomb -Ystop-after:parser diff --git a/test/files/pos/t9370/sample_2.scala b/test/files/pos/t9370/sample_2.scala new file mode 100644 index 0000000000..7eb11b8204 --- /dev/null +++ b/test/files/pos/t9370/sample_2.scala @@ -0,0 +1,6 @@ + +package sample + +// just a sample that is compiled with the explosive plugin disabled +object Sample extends App { +} diff --git a/test/files/pos/t9370/scalac-plugin.xml b/test/files/pos/t9370/scalac-plugin.xml new file mode 100644 index 0000000000..2558d6fd03 --- /dev/null +++ b/test/files/pos/t9370/scalac-plugin.xml @@ -0,0 +1,5 @@ +<plugin> + <name>ignored</name> + <classname>scala.test.plugins.ThePlugin</classname> +</plugin> + diff --git a/test/files/run/t2127.scala b/test/files/run/t2127.scala index 869d8a38d6..839c8d6a5c 100755 --- a/test/files/run/t2127.scala +++ b/test/files/run/t2127.scala @@ -28,5 +28,5 @@ } -The constructor invocation of Bar is done within the scope of object Foo's constructor, and therefor the private constructor of Foo should be visible and accessible. +The constructor invocation of Bar is done within the scope of object Foo's constructor, and therefore the private constructor of Foo should be visible and accessible. */ diff --git a/test/files/run/t7214.scala b/test/files/run/t7214.scala index 15c2c24fa0..b2ef53eeab 100644 --- a/test/files/run/t7214.scala +++ b/test/files/run/t7214.scala @@ -1,4 +1,4 @@ -// pattern matcher crashes here trying to synthesize an uneeded outer test. +// pattern matcher crashes here trying to synthesize an unneeded outer test. // no-symbol does not have an owner // at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:49) // at scala.tools.nsc.Global.abort(Global.scala:253) diff --git a/test/files/run/t8502b.scala b/test/files/run/t8502b.scala new file mode 100644 index 0000000000..4f70d13bb0 --- /dev/null +++ b/test/files/run/t8502b.scala @@ -0,0 +1,46 @@ +import scala.tools.partest._ +import java.io.File + +// used to crash with an assertion failure in flatten because the type symbol created for the missing +// package was a ClassSymbol, not a PackageClassSymbol +// - isFlattenablePrefix(vanishingPackage) was true (wrongly) +// - therefore flatten tried to flatten the class defined in the package, but the class is +// top-level, vanishingClass.enclosingTopLevelClass is NoSymbol +object Test extends StoreReporterDirectTest { + def code = ??? + + def compileCode(code: String) = { + val classpath = List(sys.props("partest.lib"), testOutput.path) mkString sys.props("path.separator") + compileString(newCompiler("-cp", classpath, "-d", testOutput.path))(code) + } + + def show(): Unit = { + compileCode(""" + class Outer { + class Nested extends vanishing.Vanishing + } + + package vanishing { + class Vanishing + } + """) + assert(filteredInfos.isEmpty, filteredInfos) + deletePackage("vanishing") + compileCode(""" + class Test { + def f(o: Outer): Outer = o + } + """) + assert(storeReporter.infos.isEmpty, storeReporter.infos.mkString("\n")) // Included a MissingRequirementError before. + } + + def deletePackage(name: String) { + val directory = new File(testOutput.path, name) + for (f <- directory.listFiles()) { + assert(f.getName.endsWith(".class")) + assert(f.delete()) + } + assert(directory.listFiles().isEmpty) + assert(directory.delete()) + } +} diff --git a/test/files/run/test-cpp.scala b/test/files/run/test-cpp.scala index 7db831fb09..80163deb66 100644 --- a/test/files/run/test-cpp.scala +++ b/test/files/run/test-cpp.scala @@ -46,7 +46,7 @@ object TestSetterInline { * The access of the local variable 'y' should be replaced by the * constant. */ -object TestAliasChainConstat { +object TestAliasChainConstant { def main(args: Array[String]): Unit = { val x = 2 |