diff options
152 files changed, 1852 insertions, 1335 deletions
diff --git a/bincompat-backward.whitelist.conf b/bincompat-backward.whitelist.conf index d4db9962e7..b88fa64584 100644 --- a/bincompat-backward.whitelist.conf +++ b/bincompat-backward.whitelist.conf @@ -32,6 +32,22 @@ filter { { matchName="scala.sys.process.ProcessImpl#CompoundProcess.getExitValue" problemName=DirectMissingMethodProblem + }, + { + matchName="scala.collection.immutable.HashMap.contains0" + problemName=DirectMissingMethodProblem + }, + { + matchName="scala.collection.immutable.HashMap#HashTrieMap.contains0" + problemName=DirectMissingMethodProblem + }, + { + matchName="scala.collection.immutable.HashMap#HashMap1.contains0" + problemName=DirectMissingMethodProblem + }, + { + matchName="scala.collection.immutable.HashMap#HashMapCollision1.contains0" + problemName=DirectMissingMethodProblem } ] } diff --git a/bincompat-forward.whitelist.conf b/bincompat-forward.whitelist.conf index 533f1b2467..bb9078c362 100644 --- a/bincompat-forward.whitelist.conf +++ b/bincompat-forward.whitelist.conf @@ -42,6 +42,22 @@ filter { { matchName="scala.util.hashing.MurmurHash3.wrappedArrayHash" problemName=DirectMissingMethodProblem + }, + { + matchName="scala.collection.immutable.HashMap.contains0" + problemName=DirectMissingMethodProblem + }, + { + matchName="scala.collection.immutable.HashMap#HashTrieMap.contains0" + problemName=DirectMissingMethodProblem + }, + { + matchName="scala.collection.immutable.HashMap#HashMap1.contains0" + problemName=DirectMissingMethodProblem + }, + { + matchName="scala.collection.immutable.HashMap#HashMapCollision1.contains0" + problemName=DirectMissingMethodProblem } ] } @@ -3,7 +3,7 @@ * * What you see below is very much work-in-progress. The following features are implemented: * - Compiling all classses for the compiler and library ("compile" in the respective subprojects) - * - Running JUnit tests ("test") and partest ("test/it:test") + * - Running JUnit ("junit/test"), ScalaCheck ("scalacheck/test"), and partest ("test/it:test") tests * - Creating build/quick with all compiled classes and launcher scripts ("dist/mkQuick") * - Creating build/pack with all JARs and launcher scripts ("dist/mkPack") * - Building all scaladoc sets ("doc") @@ -39,11 +39,11 @@ val scalaSwingDep = scalaDep("org.scala-lang.modules", "scala-swi val scalaXmlDep = scalaDep("org.scala-lang.modules", "scala-xml") val scalaParserCombinatorsDep = scalaDep("org.scala-lang.modules", "scala-parser-combinators") val partestDep = scalaDep("org.scala-lang.modules", "scala-partest", versionProp = "partest") -val scalacheckDep = scalaDep("org.scalacheck", "scalacheck", scope = "it") // Non-Scala dependencies: val junitDep = "junit" % "junit" % "4.11" val junitInterfaceDep = "com.novocode" % "junit-interface" % "0.11" % "test" +val scalacheckDep = "org.scalacheck" % "scalacheck_2.12" % "1.13.4" % "test" val jolDep = "org.openjdk.jol" % "jol-core" % "0.5" val asmDep = "org.scala-lang.modules" % "scala-asm" % versionProps("scala-asm.version") val jlineDep = "jline" % "jline" % versionProps("jline.version") @@ -524,7 +524,7 @@ lazy val scaladoc = configureAsSubproject(project) .settings( name := "scala-compiler-doc", description := "Scala Documentation Generator", - libraryDependencies ++= Seq(scalaXmlDep, partestDep), + libraryDependencies ++= Seq(scalaXmlDep), includeFilter in unmanagedResources in Compile := "*.html" | "*.css" | "*.gif" | "*.png" | "*.js" | "*.txt" | "*.svg" | "*.eot" | "*.woff" | "*.ttf" ) .dependsOn(compiler) @@ -543,7 +543,7 @@ lazy val scalap = configureAsSubproject(project) .dependsOn(compiler) lazy val partestExtras = Project("partest-extras", file(".") / "src" / "partest-extras") - .dependsOn(replJlineEmbedded) + .dependsOn(replJlineEmbedded, scaladoc) .settings(commonSettings) .settings(generatePropertiesFileSettings) .settings(clearSourceAndResourceDirectories) @@ -567,7 +567,20 @@ lazy val junit = project.in(file("test") / "junit") javaOptions in Test += "-Xss1M", libraryDependencies ++= Seq(junitDep, junitInterfaceDep, jolDep), testOptions += Tests.Argument(TestFrameworks.JUnit, "-a", "-v"), - // testFrameworks -= new TestFramework("org.scalacheck.ScalaCheckFramework"), + unmanagedSourceDirectories in Compile := Nil, + unmanagedSourceDirectories in Test := List(baseDirectory.value) + ) + +lazy val scalacheck = project.in(file("test") / "scalacheck") + .dependsOn(library, reflect, compiler, scaladoc) + .settings(clearSourceAndResourceDirectories) + .settings(commonSettings) + .settings(disableDocs) + .settings(disablePublishing) + .settings( + fork in Test := true, + javaOptions in Test += "-Xss1M", + libraryDependencies ++= Seq(scalacheckDep), unmanagedSourceDirectories in Compile := Nil, unmanagedSourceDirectories in Test := List(baseDirectory.value) ) @@ -647,7 +660,7 @@ lazy val test = project .settings(disablePublishing) .settings(Defaults.itSettings) .settings( - libraryDependencies ++= Seq(asmDep, partestDep, scalaXmlDep, scalacheckDep), + libraryDependencies ++= Seq(asmDep, partestDep, scalaXmlDep), libraryDependencies ++= { // Resolve the JARs for all test/files/lib/*.jar.desired.sha1 files through Ivy val baseDir = (baseDirectory in ThisBuild).value @@ -664,7 +677,6 @@ lazy val test = project fork in IntegrationTest := true, javaOptions in IntegrationTest += "-Xmx2G", testFrameworks += new TestFramework("scala.tools.partest.sbt.Framework"), - // testFrameworks -= new TestFramework("org.scalacheck.ScalaCheckFramework"), testOptions in IntegrationTest += Tests.Argument("-Dpartest.java_opts=-Xmx1024M -Xms64M"), testOptions in IntegrationTest += Tests.Argument("-Dpartest.scalac_opts=" + (scalacOptions in Compile).value.mkString(" ")), testOptions in IntegrationTest += Tests.Setup { () => @@ -796,9 +808,10 @@ lazy val root: Project = (project in file(".")) testAll := { val results = ScriptCommands.sequence[Result[Unit]](List( (Keys.test in Test in junit).result, + (Keys.test in Test in scalacheck).result, (testOnly in IntegrationTest in testP).toTask(" -- run").result, (testOnly in IntegrationTest in testP).toTask(" -- pos neg jvm").result, - (testOnly in IntegrationTest in testP).toTask(" -- res scalap specialized scalacheck").result, + (testOnly in IntegrationTest in testP).toTask(" -- res scalap specialized").result, (testOnly in IntegrationTest in testP).toTask(" -- instrumented presentation").result, (testOnly in IntegrationTest in testP).toTask(" -- --srcpath scaladoc").result, (Keys.test in Test in osgiTestFelix).result, @@ -817,7 +830,7 @@ lazy val root: Project = (project in file(".")) "junit/test", "partest run", "partest pos neg jvm", - "partest res scalap specialized scalacheck", + "partest res scalap specialized", "partest instrumented presentation", "partest --srcpath scaladoc", "osgiTestFelix/test", @@ -1023,7 +1036,7 @@ addCommandAlias("scalap", "scalap/compile:runMain scala.tools.sca lazy val intellij = taskKey[Unit]("Update the library classpaths in the IntelliJ project files.") -def moduleDeps(p: Project) = (externalDependencyClasspath in Compile in p).map(a => (p.id, a.map(_.data))) +def moduleDeps(p: Project, config: Configuration = Compile) = (externalDependencyClasspath in config in p).map(a => (p.id, a.map(_.data))) // aliases to projects to prevent name clashes def compilerP = compiler @@ -1055,6 +1068,7 @@ intellij := { // moduleDeps(replJlineEmbedded).value, // No sources // moduleDeps(root).value, // No sources // moduleDeps(scalaDist).value, // No sources + moduleDeps(scalacheck, config = Test).value, moduleDeps(scaladoc).value, moduleDeps(scalap).value, moduleDeps(testP).value) diff --git a/project/PartestUtil.scala b/project/PartestUtil.scala index 7cb9af4c94..7343c1857f 100644 --- a/project/PartestUtil.scala +++ b/project/PartestUtil.scala @@ -28,7 +28,7 @@ object PartestUtil { def partestParser(globalBase: File, testBase: File): Parser[String] = { val knownUnaryOptions = List( "--pos", "--neg", "--run", "--jvm", "--res", "--ant", "--scalap", "--specialized", - "--scalacheck", "--instrumented", "--presentation", "--failed", "--update-check", + "--instrumented", "--presentation", "--failed", "--update-check", "--show-diff", "--show-log", "--verbose", "--terse", "--debug", "--version", "--self-test", "--help") val srcPathOption = "--srcpath" val grepOption = "--grep" diff --git a/scripts/jobs/integrate/bootstrap b/scripts/jobs/integrate/bootstrap index 7c045ae918..3933854e4f 100755 --- a/scripts/jobs/integrate/bootstrap +++ b/scripts/jobs/integrate/bootstrap @@ -250,7 +250,7 @@ buildSwing() { } # should only be called with publishTasks publishing to private-repo -buildScalacheck(){ +buildScalaCheck(){ if [ "$SCALACHECK_BUILT" != "yes" ] && [ "$forceRebuild" != "yes" ] && ( sbtResolve "org.scalacheck" "scalacheck" $SCALACHECK_VER ) then echo "Found scalacheck $SCALACHECK_VER; not building." else @@ -261,14 +261,14 @@ buildScalacheck(){ fi } -# build modules, using ${buildTasks[@]} (except for Scalacheck, which is hard-coded to publish to private-repo) +# build modules, using ${buildTasks[@]} (except for ScalaCheck, which is hard-coded to publish to private-repo) buildModules() { publishTasks=('set credentials += Credentials(Path.userHome / ".credentials-private-repo")' "set every publishTo := Some(\"private-repo\" at \"$releaseTempRepoUrl\")") buildTasks=($publishPrivateTask) buildXML buildParsers buildSwing - # buildScalacheck + # buildScalaCheck buildPartest } diff --git a/scripts/jobs/validate/test b/scripts/jobs/validate/test index 7b00356390..39fafebaef 100755 --- a/scripts/jobs/validate/test +++ b/scripts/jobs/validate/test @@ -17,7 +17,7 @@ case $prDryRun in # build quick using STARR built upstream, as specified by scalaVersion # (in that sense it's locker, since it was built with starr by that upstream job); - # and run JUnit tests, partest, OSGi tests, MiMa and scaladoc + # and run JUnit tests, ScalaCheck tests, partest, OSGi tests, MiMa and scaladoc $SBT \ -Dstarr.version=$scalaVersion \ --warn \ diff --git a/spec/05-classes-and-objects.md b/spec/05-classes-and-objects.md index 75620f57d4..6738c7a5b7 100644 --- a/spec/05-classes-and-objects.md +++ b/spec/05-classes-and-objects.md @@ -709,7 +709,7 @@ Here, value parameter may not form part of the types of any of the parent classes or members of the class template $t$. It is illegal to define two formal value parameters with the same name. - If no formal parameter sections are given, an empty parameter section `()` is assumed. + If a class has no formal parameter section that is not implicit, an empty parameter section `()` is assumed. If a formal parameter declaration $x: T$ is preceded by a `val` or `var` keyword, an accessor (getter) [definition](04-basic-declarations-and-definitions.html#variable-declarations-and-definitions) @@ -842,12 +842,13 @@ TmplDef ::= ‘case’ ‘class’ ClassDef If a class definition is prefixed with `case`, the class is said to be a _case class_. -The formal parameters in the first parameter section of a case class -are called _elements_; they are treated -specially. First, the value of such a parameter can be extracted as a +A case class is required to have a parameter section that is not implicit. +The formal parameters in the first parameter section +are called _elements_ and are treated specially. +First, the value of such a parameter can be extracted as a field of a constructor pattern. Second, a `val` prefix is -implicitly added to such a parameter, unless the parameter carries -already a `val` or `var` modifier. Hence, an accessor +implicitly added to such a parameter, unless the parameter already carries +a `val` or `var` modifier. Hence, an accessor definition for the parameter is [generated](#class-definitions). A case class definition of `$c$[$\mathit{tps}\,$]($\mathit{ps}_1\,$)$\ldots$($\mathit{ps}_n$)` with type diff --git a/src/compiler/scala/tools/ant/templates/tool-windows.tmpl b/src/compiler/scala/tools/ant/templates/tool-windows.tmpl index 50e44fb669..338f2f1375 100644 --- a/src/compiler/scala/tools/ant/templates/tool-windows.tmpl +++ b/src/compiler/scala/tools/ant/templates/tool-windows.tmpl @@ -156,7 +156,7 @@ rem (see http://support.microsoft.com/?kbid=833431) rem set _SCALA_HOME=%~dps0.. :set_home set _BIN_DIR= - for %%i in (%~sf0) do set _BIN_DIR=%_BIN_DIR%%%~dpsi + for %%i in ("%~sf0") do set _BIN_DIR=%_BIN_DIR%%%~dpsi set _SCALA_HOME=%_BIN_DIR%.. goto :eof diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index cf66e0a7dc..c35c0a1019 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -2236,31 +2236,57 @@ self => * }}} */ def paramClauses(owner: Name, contextBounds: List[Tree], ofCaseClass: Boolean): List[List[ValDef]] = { - var implicitmod = 0 - var caseParam = ofCaseClass - def paramClause(): List[ValDef] = { - if (in.token == RPAREN) - return Nil - - if (in.token == IMPLICIT) { - in.nextToken() - implicitmod = Flags.IMPLICIT - } - commaSeparated(param(owner, implicitmod, caseParam )) - } - val vds = new ListBuffer[List[ValDef]] + var implicitSection = -1 + var implicitOffset = -1 + var warnAt = -1 + var caseParam = ofCaseClass + val vds = new ListBuffer[List[ValDef]] val start = in.offset + def paramClause(): List[ValDef] = if (in.token == RPAREN) Nil else { + val implicitmod = + if (in.token == IMPLICIT) { + if (implicitOffset == -1) { implicitOffset = in.offset ; implicitSection = vds.length } + else if (warnAt == -1) warnAt = in.offset + in.nextToken() + Flags.IMPLICIT + } else 0 + commaSeparated(param(owner, implicitmod, caseParam)) + } newLineOptWhenFollowedBy(LPAREN) - if (ofCaseClass && in.token != LPAREN) - syntaxError(in.lastOffset, "case classes without a parameter list are not allowed;\n"+ - "use either case objects or case classes with an explicit `()' as a parameter list.") - while (implicitmod == 0 && in.token == LPAREN) { + while (in.token == LPAREN) { in.nextToken() vds += paramClause() accept(RPAREN) caseParam = false newLineOptWhenFollowedBy(LPAREN) } + if (ofCaseClass) { + if (vds.isEmpty) + syntaxError(start, s"case classes must have a parameter list; try 'case class ${owner.encoded + }()' or 'case object ${owner.encoded}'") + else if (vds.head.nonEmpty && vds.head.head.mods.isImplicit) { + if (settings.isScala213) + syntaxError(start, s"case classes must have a non-implicit parameter list; try 'case class ${ + owner.encoded}()${ vds.map(vs => "(...)").mkString }'") + else { + deprecationWarning(start, s"case classes should have a non-implicit parameter list; adapting to 'case class ${ + owner.encoded}()${ vds.map(vs => "(...)").mkString }'", "2.12.2") + vds.insert(0, List.empty[ValDef]) + vds(1) = vds(1).map(vd => copyValDef(vd)(mods = vd.mods & ~Flags.CASEACCESSOR)) + if (implicitSection != -1) implicitSection += 1 + } + } + } + if (implicitSection != -1 && implicitSection != vds.length - 1) + syntaxError(implicitOffset, "an implicit parameter section must be last") + if (warnAt != -1) + syntaxError(warnAt, "multiple implicit parameter sections are not allowed") + else if (settings.warnExtraImplicit) { + // guard against anomalous class C(private implicit val x: Int)(implicit s: String) + val ttl = vds.count { case ValDef(mods, _, _, _) :: _ => mods.isImplicit ; case _ => false } + if (ttl > 1) + warning(in.offset, s"$ttl parameter sections are effectively implicit") + } val result = vds.toList if (owner == nme.CONSTRUCTOR && (result.isEmpty || (result.head take 1 exists (_.mods.isImplicit)))) { in.token match { diff --git a/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala b/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala index 9b9d94bb0f..342031b601 100644 --- a/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala +++ b/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala @@ -20,6 +20,7 @@ class ConsoleReporter(val settings: Settings, reader: BufferedReader, writer: Pr var shortname: Boolean = false /** maximal number of error messages to be printed */ + @deprecated("configured by settings.maxerrs", since="2.12.2") final val ERROR_LIMIT = 100 private def label(severity: Severity): String = severity match { @@ -63,9 +64,13 @@ class ConsoleReporter(val settings: Settings, reader: BufferedReader, writer: Pr if ( ERROR.count > 0) printMessage(getCountString(ERROR ) + " found") } - def display(pos: Position, msg: String, severity: Severity) { - if (severity != ERROR || severity.count <= ERROR_LIMIT) - print(pos, msg, severity) + def display(pos: Position, msg: String, severity: Severity): Unit = { + val ok = severity match { + case ERROR => ERROR.count <= settings.maxerrs.value + case WARNING => WARNING.count <= settings.maxwarns.value + case _ => true + } + if (ok) print(pos, msg, severity) } def displayPrompt(): Unit = { diff --git a/src/compiler/scala/tools/nsc/settings/MutableSettings.scala b/src/compiler/scala/tools/nsc/settings/MutableSettings.scala index 822e0f16bf..92a5cbdd73 100644 --- a/src/compiler/scala/tools/nsc/settings/MutableSettings.scala +++ b/src/compiler/scala/tools/nsc/settings/MutableSettings.scala @@ -416,9 +416,9 @@ class MutableSettings(val errorFn: String => Unit) // Helper to generate a textual explanation of valid inputs private def getValidText: String = (min, max) match { case (IntMin, IntMax) => "can be any integer" - case (IntMin, x) => "must be less than or equal to "+x - case (x, IntMax) => "must be greater than or equal to "+x - case _ => "must be between %d and %d".format(min, max) + case (IntMin, x) => f"must be less than or equal to $x%d" + case (x, IntMax) => f"must be greater than or equal to $x%d" + case _ => f"must be between $min%d and $max%d" } // Ensure that the default value is actually valid @@ -431,7 +431,7 @@ class MutableSettings(val errorFn: String => Unit) } } - def errorMsg() = errorFn("invalid setting for -"+name+" "+getValidText) + def errorMsg() = errorFn(s"invalid setting for $name $getValidText") def tryToSet(args: List[String]) = if (args.isEmpty) errorAndValue("missing argument", None) @@ -444,7 +444,7 @@ class MutableSettings(val errorFn: String => Unit) if (value == default) Nil else List(name, value.toString) - withHelpSyntax(name + " <n>") + withHelpSyntax(s"$name <n>") } /** A setting represented by a boolean flag (false, unless set) */ diff --git a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala index 7be65431db..cce9a5b3a8 100644 --- a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala +++ b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala @@ -107,6 +107,8 @@ trait ScalaSettings extends AbsScalaSettings val logFreeTerms = BooleanSetting ("-Xlog-free-terms", "Print a message when reification creates a free term.") val logFreeTypes = BooleanSetting ("-Xlog-free-types", "Print a message when reification resorts to generating a free type.") val maxClassfileName = IntSetting ("-Xmax-classfile-name", "Maximum filename length for generated classes", 255, Some((72, 255)), _ => None) + val maxerrs = IntSetting ("-Xmaxerrs", "Maximum errors to print", 100, None, _ => None) + val maxwarns = IntSetting ("-Xmaxwarns", "Maximum warnings to print", 100, None, _ => None) val Xmigration = ScalaVersionSetting ("-Xmigration", "version", "Warn about constructs whose behavior may have changed since version.", initial = NoScalaVersion, default = Some(AnyScalaVersion)) val nouescape = BooleanSetting ("-Xno-uescape", "Disable handling of \\u unicode escapes.") val Xnojline = BooleanSetting ("-Xnojline", "Do not use JLine for editing.") diff --git a/src/compiler/scala/tools/nsc/settings/Warnings.scala b/src/compiler/scala/tools/nsc/settings/Warnings.scala index 839e734abc..87534656f9 100644 --- a/src/compiler/scala/tools/nsc/settings/Warnings.scala +++ b/src/compiler/scala/tools/nsc/settings/Warnings.scala @@ -25,6 +25,8 @@ trait Warnings { // currently considered too noisy for general use val warnUnusedImport = BooleanSetting("-Ywarn-unused-import", "Warn when imports are unused.") + val warnExtraImplicit = BooleanSetting("-Ywarn-extra-implicit", "Warn when more than one implicit parameter section is defined.") + // Experimental lint warnings that are turned off, but which could be turned on programmatically. // They are not activated by -Xlint and can't be enabled on the command line because they are not // created using the standard factory methods. diff --git a/src/eclipse/partest/.classpath b/src/eclipse/partest/.classpath index 74eb47032d..f21d653e63 100644 --- a/src/eclipse/partest/.classpath +++ b/src/eclipse/partest/.classpath @@ -9,6 +9,6 @@ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry combineaccessrules="false" kind="src" path="/scala-compiler"/> <classpathentry combineaccessrules="false" kind="src" path="/scala-library"/> - <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/partest/scala-partest_2.12.0-M5-1.0.17.jar"/> + <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/partest/scala-partest_2.12.0-M5-1.1.0.jar"/> <classpathentry kind="output" path="build-quick-partest-extras"/> </classpath> diff --git a/src/eclipse/scaladoc/.classpath b/src/eclipse/scaladoc/.classpath index 9ae1a1c1dd..14dd2e665e 100644 --- a/src/eclipse/scaladoc/.classpath +++ b/src/eclipse/scaladoc/.classpath @@ -7,6 +7,6 @@ <classpathentry combineaccessrules="false" kind="src" path="/scala-compiler"/> <classpathentry combineaccessrules="false" kind="src" path="/scala-library"/> <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/scaladoc/scala-xml_2.12.0-M5-1.0.5.jar"/> - <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/partest/scala-partest_2.12.0-M5-1.0.17.jar"/> + <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/partest/scala-partest_2.12.0-M5-1.1.0.jar"/> <classpathentry kind="output" path="build-quick-scaladoc"/> </classpath> diff --git a/src/intellij/actors.iml.SAMPLE b/src/intellij/actors.iml.SAMPLE deleted file mode 100644 index f012ee7b0f..0000000000 --- a/src/intellij/actors.iml.SAMPLE +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" inherit-compiler-output="false"> - <output url="file://$MODULE_DIR$/../../build/quick/classes/actors" /> - <output-test url="file://$MODULE_DIR$/../../out/test/actors" /> - <exclude-output /> - <content url="file://$MODULE_DIR$/../actors"> - <sourceFolder url="file://$MODULE_DIR$/../actors" isTestSource="false" /> - </content> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="module" module-name="library" /> - <orderEntry type="module" module-name="forkjoin" /> - <orderEntry type="library" name="starr" level="project" /> - </component> -</module>
\ No newline at end of file diff --git a/src/intellij/forkjoin.iml.SAMPLE b/src/intellij/forkjoin.iml.SAMPLE deleted file mode 100644 index aa3f83e56e..0000000000 --- a/src/intellij/forkjoin.iml.SAMPLE +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" inherit-compiler-output="false"> - <output url="file://$MODULE_DIR$/../../build/quick/classes/forkjoin" /> - <output-test url="file://$MODULE_DIR$/../../out/test/forkjoin" /> - <exclude-output /> - <content url="file://$MODULE_DIR$/../forkjoin"> - <sourceFolder url="file://$MODULE_DIR$/../forkjoin" isTestSource="false" /> - </content> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - </component> -</module>
\ No newline at end of file diff --git a/src/intellij/junit.iml.SAMPLE b/src/intellij/junit.iml.SAMPLE index e0f52aa42a..87ca586761 100644 --- a/src/intellij/junit.iml.SAMPLE +++ b/src/intellij/junit.iml.SAMPLE @@ -9,9 +9,7 @@ </content> <orderEntry type="inheritedJdk" /> <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="module" module-name="forkjoin" /> <orderEntry type="module" module-name="library" /> - <orderEntry type="module" module-name="actors" /> <orderEntry type="module" module-name="reflect" /> <orderEntry type="module" module-name="compiler" /> <orderEntry type="module" module-name="repl" /> diff --git a/src/intellij/library.iml.SAMPLE b/src/intellij/library.iml.SAMPLE index ce61c097bd..d39c9d2032 100644 --- a/src/intellij/library.iml.SAMPLE +++ b/src/intellij/library.iml.SAMPLE @@ -9,7 +9,6 @@ </content> <orderEntry type="inheritedJdk" /> <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="module" module-name="forkjoin" /> <orderEntry type="library" name="starr" level="project" /> </component> </module>
\ No newline at end of file diff --git a/src/intellij/partest-extras.iml.SAMPLE b/src/intellij/partest-extras.iml.SAMPLE index 79c736f7da..3618cd8f52 100644 --- a/src/intellij/partest-extras.iml.SAMPLE +++ b/src/intellij/partest-extras.iml.SAMPLE @@ -12,8 +12,9 @@ <orderEntry type="module" module-name="library" /> <orderEntry type="module" module-name="reflect" /> <orderEntry type="module" module-name="compiler" /> + <orderEntry type="module" module-name="scaladoc" /> <orderEntry type="module" module-name="repl" /> - <orderEntry type="library" name="partest-extras-deps" level="project" /> <orderEntry type="library" name="starr" level="project" /> + <orderEntry type="library" name="partest-extras-deps" level="project" /> </component> </module>
\ No newline at end of file diff --git a/src/intellij/scala.ipr.SAMPLE b/src/intellij/scala.ipr.SAMPLE index 01f08c4efd..48bee181da 100644 --- a/src/intellij/scala.ipr.SAMPLE +++ b/src/intellij/scala.ipr.SAMPLE @@ -1,8 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="CompilerConfiguration"> - <option name="DEFAULT_COMPILER" value="Javac" /> - <resourceExtensions /> <wildcardResourcePatterns> <entry name="!?*.java" /> <entry name="!?*.form" /> @@ -13,18 +11,137 @@ <entry name="!?*.kt" /> <entry name="!?*.clj" /> </wildcardResourcePatterns> - <annotationProcessing> - <profile default="true" name="Default" enabled="false"> - <processorPath useClasspath="true" /> - </profile> - </annotationProcessing> </component> <component name="CopyrightManager" default="" /> <component name="Encoding"> <file url="PROJECT" charset="UTF-8" /> </component> - <component name="EntryPointsManager"> - <entry_points version="2.0" /> + <component name="InspectionProjectProfileManager"> + <profile version="1.0"> + <option name="myName" value="Project Default" /> + </profile> + <version value="1.0" /> + </component> + <component name="Palette2"> + <group name="Swing"> + <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" /> + </item> + <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" /> + </item> + <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" /> + </item> + <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true"> + <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" /> + </item> + <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" /> + <initial-values> + <property name="text" value="Button" /> + </initial-values> + </item> + <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" /> + <initial-values> + <property name="text" value="RadioButton" /> + </initial-values> + </item> + <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" /> + <initial-values> + <property name="text" value="CheckBox" /> + </initial-values> + </item> + <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" /> + <initial-values> + <property name="text" value="Label" /> + </initial-values> + </item> + <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> + <preferred-size width="150" height="-1" /> + </default-constraints> + </item> + <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> + <preferred-size width="150" height="-1" /> + </default-constraints> + </item> + <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> + <preferred-size width="150" height="-1" /> + </default-constraints> + </item> + <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> + <preferred-size width="150" height="50" /> + </default-constraints> + </item> + <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> + <preferred-size width="150" height="50" /> + </default-constraints> + </item> + <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> + <preferred-size width="150" height="50" /> + </default-constraints> + </item> + <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" /> + </item> + <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> + <preferred-size width="150" height="50" /> + </default-constraints> + </item> + <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3"> + <preferred-size width="150" height="50" /> + </default-constraints> + </item> + <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> + <preferred-size width="150" height="50" /> + </default-constraints> + </item> + <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3"> + <preferred-size width="200" height="200" /> + </default-constraints> + </item> + <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3"> + <preferred-size width="200" height="200" /> + </default-constraints> + </item> + <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" /> + </item> + <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" /> + </item> + <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" /> + </item> + <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" /> + </item> + <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1"> + <preferred-size width="-1" height="20" /> + </default-constraints> + </item> + <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" /> + </item> + <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" /> + </item> + </group> </component> <component name="ProjectLevelVcsManager" settingsEditedManually="false"> <OptionsSetting value="true" id="Add" /> @@ -38,9 +155,7 @@ </component> <component name="ProjectModuleManager"> <modules> - <module fileurl="file://$PROJECT_DIR$/actors.iml" filepath="$PROJECT_DIR$/actors.iml" /> <module fileurl="file://$PROJECT_DIR$/compiler.iml" filepath="$PROJECT_DIR$/compiler.iml" /> - <module fileurl="file://$PROJECT_DIR$/forkjoin.iml" filepath="$PROJECT_DIR$/forkjoin.iml" /> <module fileurl="file://$PROJECT_DIR$/interactive.iml" filepath="$PROJECT_DIR$/interactive.iml" /> <module fileurl="file://$PROJECT_DIR$/junit.iml" filepath="$PROJECT_DIR$/junit.iml" /> <module fileurl="file://$PROJECT_DIR$/library.iml" filepath="$PROJECT_DIR$/library.iml" /> @@ -52,12 +167,13 @@ <module fileurl="file://$PROJECT_DIR$/repl-jline.iml" filepath="$PROJECT_DIR$/repl-jline.iml" /> <module fileurl="file://$PROJECT_DIR$/scala.iml" filepath="$PROJECT_DIR$/scala.iml" /> <module fileurl="file://$PROJECT_DIR$/scala-build.iml" filepath="$PROJECT_DIR$/scala-build.iml" /> + <module fileurl="file://$PROJECT_DIR$/scalacheck.iml" filepath="$PROJECT_DIR$/scalacheck.iml" /> <module fileurl="file://$PROJECT_DIR$/scaladoc.iml" filepath="$PROJECT_DIR$/scaladoc.iml" /> <module fileurl="file://$PROJECT_DIR$/scalap.iml" filepath="$PROJECT_DIR$/scalap.iml" /> <module fileurl="file://$PROJECT_DIR$/test.iml" filepath="$PROJECT_DIR$/test.iml" /> </modules> </component> - <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> + <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <output url="file://$PROJECT_DIR$/../../out" /> </component> <component name="ScalaCompilerConfiguration"> @@ -75,8 +191,8 @@ <root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant/jars/ant-1.9.4.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant-launcher/jars/ant-launcher-1.9.4.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-5.1.0-scala-1.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12.0-M5/bundles/scala-xml_2.12.0-M5-1.0.5.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/jline/jline/jars/jline-2.14.1.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12/bundles/scala-xml_2.12-1.0.6.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/jline/jline/jars/jline-2.14.3.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> @@ -86,7 +202,7 @@ <root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant/jars/ant-1.9.4.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant-launcher/jars/ant-launcher-1.9.4.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-5.1.0-scala-1.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12.0-M5/bundles/scala-xml_2.12.0-M5-1.0.5.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12/bundles/scala-xml_2.12-1.0.6.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> @@ -96,22 +212,24 @@ <root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant/jars/ant-1.9.4.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant-launcher/jars/ant-launcher-1.9.4.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-5.1.0-scala-1.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12.0-M5/bundles/scala-xml_2.12.0-M5-1.0.5.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/jline/jline/jars/jline-2.14.1.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-partest_2.12.0-M5/jars/scala-partest_2.12.0-M5-1.0.17.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12/bundles/scala-xml_2.12-1.0.6.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/jline/jline/jars/jline-2.14.3.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-partest_2.12/jars/scala-partest_2.12-1.1.0.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/com.googlecode.java-diff-utils/diffutils/jars/diffutils-1.3.0.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/test-interface/jars/test-interface-1.0.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/junit/junit/jars/junit-4.12.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/junit/junit/jars/junit-4.11.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.hamcrest/hamcrest-core/jars/hamcrest-core-1.3.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.openjdk.jol/jol-core/jars/jol-core-0.5.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> </library> <library name="manual-deps"> <CLASSES> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12.0-M5/bundles/scala-xml_2.12.0-M5-1.0.5.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12/bundles/scala-xml_2.12-1.0.6.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant/jars/ant-1.9.4.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant-launcher/jars/ant-launcher-1.9.4.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.12.1.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> @@ -121,9 +239,9 @@ <root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant/jars/ant-1.9.4.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant-launcher/jars/ant-launcher-1.9.4.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-5.1.0-scala-1.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12.0-M5/bundles/scala-xml_2.12.0-M5-1.0.5.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/jline/jline/jars/jline-2.14.1.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-partest_2.12.0-M5/jars/scala-partest_2.12.0-M5-1.0.17.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12/bundles/scala-xml_2.12-1.0.6.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/jline/jline/jars/jline-2.14.3.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-partest_2.12/jars/scala-partest_2.12-1.1.0.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/com.googlecode.java-diff-utils/diffutils/jars/diffutils-1.3.0.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/test-interface/jars/test-interface-1.0.jar!/" /> </CLASSES> @@ -142,7 +260,7 @@ <root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant/jars/ant-1.9.4.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant-launcher/jars/ant-launcher-1.9.4.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-5.1.0-scala-1.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12.0-M5/bundles/scala-xml_2.12.0-M5-1.0.5.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12/bundles/scala-xml_2.12-1.0.6.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> @@ -152,32 +270,36 @@ <root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant/jars/ant-1.9.4.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant-launcher/jars/ant-launcher-1.9.4.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-5.1.0-scala-1.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12.0-M5/bundles/scala-xml_2.12.0-M5-1.0.5.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/jline/jline/jars/jline-2.14.1.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12/bundles/scala-xml_2.12-1.0.6.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/jline/jline/jars/jline-2.14.3.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> </library> <library name="scala-build-deps"> <CLASSES> - <root url="jar://$USER_HOME$/.ivy2/cache/scala_2.10/sbt_0.13/com.typesafe.sbt/sbt-git/jars/sbt-git-0.8.5.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.eclipse.jgit/org.eclipse.jgit.pgm/jars/org.eclipse.jgit.pgm-3.7.0.201502260915-r.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/scala_2.10/sbt_0.13/net.virtual-void/sbt-dependency-graph/jars/sbt-dependency-graph-0.8.2.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/com.github.mdr/ascii-graphs_2.10/jars/ascii-graphs_2.10-0.0.3.jar!/" /> + <root url="jar://$USER_HOME$/.sbt/boot/scala-2.10.6/lib/scala-library.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/scala_2.10/sbt_0.13/com.github.tototoshi/sbt-build-files-watcher/jars/sbt-build-files-watcher-0.1.1.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/scala_2.10/sbt_0.13/com.scalapenos/sbt-prompt/jars/sbt-prompt-0.2.1.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/scala_2.10/sbt_0.13/com.typesafe.sbt/sbt-git/jars/sbt-git-0.6.4.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.eclipse.jgit/org.eclipse.jgit.pgm/jars/org.eclipse.jgit.pgm-3.3.2.201404171909-r.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/args4j/args4j/jars/args4j-2.0.12.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.apache.commons/commons-compress/jars/commons-compress-1.6.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.tukaani/xz/jars/xz-1.4.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.eclipse.jgit/org.eclipse.jgit.archive/jars/org.eclipse.jgit.archive-3.7.0.201502260915-r.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.eclipse.jgit/org.eclipse.jgit/jars/org.eclipse.jgit-3.7.0.201502260915-r.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.eclipse.jgit/org.eclipse.jgit.archive/jars/org.eclipse.jgit.archive-3.3.2.201404171909-r.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.eclipse.jgit/org.eclipse.jgit/jars/org.eclipse.jgit-3.3.2.201404171909-r.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/com.jcraft/jsch/jars/jsch-0.1.50.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/com.googlecode.javaewah/JavaEWAH/bundles/JavaEWAH-0.7.9.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.apache.httpcomponents/httpclient/jars/httpclient-4.1.3.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.apache.httpcomponents/httpcore/jars/httpcore-4.1.4.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/commons-logging/commons-logging/jars/commons-logging-1.1.1.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/commons-codec/commons-codec/jars/commons-codec-1.4.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.slf4j/slf4j-api/jars/slf4j-api-1.7.2.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.osgi/org.osgi.core/jars/org.osgi.core-4.3.1.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.eclipse.jgit/org.eclipse.jgit.ui/jars/org.eclipse.jgit.ui-3.7.0.201502260915-r.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.eclipse.jgit/org.eclipse.jgit.ui/jars/org.eclipse.jgit.ui-3.3.2.201404171909-r.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.apache.commons/commons-lang3/jars/commons-lang3-3.3.2.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.pantsbuild/jarjar/jars/jarjar-1.6.0.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.pantsbuild/jarjar/jars/jarjar-1.6.3.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant/jars/ant-1.9.6.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant-launcher/jars/ant-launcher-1.9.6.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.ow2.asm/asm/jars/asm-5.0.4.jar!/" /> @@ -195,35 +317,37 @@ <root url="jar://$USER_HOME$/.ivy2/cache/org.codehaus.plexus/plexus-component-annotations/jars/plexus-component-annotations-1.5.5.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.codehaus.plexus/plexus-classworlds/bundles/plexus-classworlds-2.5.2.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/biz.aQute.bnd/biz.aQute.bnd/jars/biz.aQute.bnd-2.4.1.jar!/" /> - <root url="jar://$USER_HOME$/.sbt/boot/scala-2.10.6/lib/scala-library.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/sbt/jars/sbt-0.13.11.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/main/jars/main-0.13.11.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/actions/jars/actions-0.13.11.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/classpath/jars/classpath-0.13.11.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/com.typesafe/mima-reporter_2.10/jars/mima-reporter_2.10-0.1.13.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/com.typesafe/mima-core_2.10/jars/mima-core_2.10-0.1.13.jar!/" /> <root url="jar://$USER_HOME$/.sbt/boot/scala-2.10.6/lib/scala-compiler.jar!/" /> <root url="jar://$USER_HOME$/.sbt/boot/scala-2.10.6/lib/scala-reflect.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/interface/jars/interface-0.13.11.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/io/jars/io-0.13.11.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/control/jars/control-0.13.11.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/com.typesafe/config/bundles/config-1.0.0.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/sbt/jars/sbt-0.13.13.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/main/jars/main-0.13.13.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/actions/jars/actions-0.13.13.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/classpath/jars/classpath-0.13.13.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/interface/jars/interface-0.13.13.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/io/jars/io-0.13.13.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/control/jars/control-0.13.13.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/launcher-interface/jars/launcher-interface-1.0.0-M1.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/completion/jars/completion-0.13.11.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/collections/jars/collections-0.13.11.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/completion/jars/completion-0.13.13.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/collections/jars/collections-0.13.13.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/jline/jline/jars/jline-2.13.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.fusesource.jansi/jansi/jars/jansi-1.11.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/api/jars/api-0.13.11.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/classfile/jars/classfile-0.13.11.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/logging/jars/logging-0.13.11.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/process/jars/process-0.13.11.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/compiler-integration/jars/compiler-integration-0.13.11.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/incremental-compiler/jars/incremental-compiler-0.13.11.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/relation/jars/relation-0.13.11.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/compile/jars/compile-0.13.11.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/persist/jars/persist-0.13.11.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/api/jars/api-0.13.13.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/classfile/jars/classfile-0.13.13.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/logging/jars/logging-0.13.13.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/process/jars/process-0.13.13.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/compiler-integration/jars/compiler-integration-0.13.13.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/incremental-compiler/jars/incremental-compiler-0.13.13.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/relation/jars/relation-0.13.13.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/compile/jars/compile-0.13.13.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/persist/jars/persist-0.13.13.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-tools.sbinary/sbinary_2.10/jars/sbinary_2.10-0.4.2.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/compiler-ivy-integration/jars/compiler-ivy-integration-0.13.11.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/ivy/jars/ivy-0.13.11.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/cross/jars/cross-0.13.11.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt.ivy/ivy/jars/ivy-2.3.0-sbt-2cc8d2761242b072cedb0a04cb39435c4fa24f9a.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/compiler-ivy-integration/jars/compiler-ivy-integration-0.13.13.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/ivy/jars/ivy-0.13.13.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/cross/jars/cross-0.13.13.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt.ivy/ivy/jars/ivy-2.3.0-sbt-2cf13e211b2cb31f0d3b317289dca70eca3362f6.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/serialization_2.10/jars/serialization_2.10-0.1.2.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-pickling_2.10/jars/scala-pickling_2.10-0.10.1.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.scalamacros/quasiquotes_2.10/jars/quasiquotes_2.10-2.0.1.jar!/" /> @@ -232,19 +356,30 @@ <root url="jar://$USER_HOME$/.ivy2/cache/com.thoughtworks.paranamer/paranamer/jars/paranamer-2.6.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.spire-math/jawn-parser_2.10/jars/jawn-parser_2.10-0.6.0.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.spire-math/json4s-support_2.10/jars/json4s-support_2.10-0.6.0.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/run/jars/run-0.13.11.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/task-system/jars/task-system-0.13.11.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/tasks/jars/tasks-0.13.11.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/tracking/jars/tracking-0.13.11.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/cache/jars/cache-0.13.11.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/testing/jars/testing-0.13.11.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/test-agent/jars/test-agent-0.13.11.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/run/jars/run-0.13.13.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/task-system/jars/task-system-0.13.13.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/tasks/jars/tasks-0.13.13.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/tracking/jars/tracking-0.13.13.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/cache/jars/cache-0.13.13.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/testing/jars/testing-0.13.13.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/test-agent/jars/test-agent-0.13.13.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/test-interface/jars/test-interface-1.0.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/main-settings/jars/main-settings-0.13.11.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/apply-macro/jars/apply-macro-0.13.11.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/command/jars/command-0.13.11.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/logic/jars/logic-0.13.11.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/compiler-interface/jars/compiler-interface-0.13.11.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/main-settings/jars/main-settings-0.13.13.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/apply-macro/jars/apply-macro-0.13.13.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/command/jars/command-0.13.13.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/template-resolver/jars/template-resolver-0.1.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/logic/jars/logic-0.13.13.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/compiler-interface/jars/compiler-interface-0.13.13.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + <library name="scalacheck-deps"> + <CLASSES> + <root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant/jars/ant-1.9.4.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant-launcher/jars/ant-launcher-1.9.4.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-5.1.0-scala-1.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12/bundles/scala-xml_2.12-1.0.6.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> @@ -254,10 +389,7 @@ <root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant/jars/ant-1.9.4.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant-launcher/jars/ant-launcher-1.9.4.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-5.1.0-scala-1.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12.0-M5/bundles/scala-xml_2.12.0-M5-1.0.5.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-partest_2.12.0-M5/jars/scala-partest_2.12.0-M5-1.0.17.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/com.googlecode.java-diff-utils/diffutils/jars/diffutils-1.3.0.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/test-interface/jars/test-interface-1.0.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12/bundles/scala-xml_2.12-1.0.6.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> @@ -267,7 +399,7 @@ <root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant/jars/ant-1.9.4.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant-launcher/jars/ant-launcher-1.9.4.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-5.1.0-scala-1.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12.0-M5/bundles/scala-xml_2.12.0-M5-1.0.5.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12/bundles/scala-xml_2.12-1.0.6.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> @@ -276,11 +408,11 @@ <properties> <option name="languageLevel" value="Scala_2_12" /> <compiler-classpath> - <root url="file://$USER_HOME$/.sbt/boot/scala-2.12.0-M5/lib/scala-library.jar" /> - <root url="file://$USER_HOME$/.sbt/boot/scala-2.12.0-M5/lib/scala-compiler.jar" /> - <root url="file://$USER_HOME$/.sbt/boot/scala-2.12.0-M5/lib/scala-reflect.jar" /> - <root url="file://$USER_HOME$/.sbt/boot/scala-2.12.0-M5/lib/scala-xml_2.12.0-M5.jar" /> - <root url="file://$USER_HOME$/.sbt/boot/scala-2.12.0-M5/lib/jline.jar" /> + <root url="file://$USER_HOME$/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.12.1.jar" /> + <root url="file://$USER_HOME$/.ivy2/cache/org.scala-lang/scala-compiler/jars/scala-compiler-2.12.1.jar" /> + <root url="file://$USER_HOME$/.ivy2/cache/org.scala-lang/scala-reflect/jars/scala-reflect-2.12.1.jar" /> + <root url="file://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12/bundles/scala-xml_2.12-1.0.6.jar" /> + <root url="file://$USER_HOME$/.ivy2/cache/jline/jline/jars/jline-2.14.1.jar" /> </compiler-classpath> </properties> <CLASSES /> @@ -292,11 +424,18 @@ <root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant/jars/ant-1.9.4.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant-launcher/jars/ant-launcher-1.9.4.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-5.1.0-scala-1.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12.0-M5/bundles/scala-xml_2.12.0-M5-1.0.5.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/jline/jline/jars/jline-2.14.1.jar!/" /> - <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-partest_2.12.0-M5/jars/scala-partest_2.12.0-M5-1.0.17.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12/bundles/scala-xml_2.12-1.0.6.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/jline/jline/jars/jline-2.14.3.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-partest_2.12/jars/scala-partest_2.12-1.1.0.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/com.googlecode.java-diff-utils/diffutils/jars/diffutils-1.3.0.jar!/" /> <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/test-interface/jars/test-interface-1.0.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.scala-sha-bootstrap.test.files.lib/annotations/jars/annotations-02fe2ed93766323a13f22c7a7e2ecdcd84259b6c.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.scala-sha-bootstrap.test.files.lib/enums/jars/enums-981392dbd1f727b152cd1c908c5fce60ad9d07f7.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.scala-sha-bootstrap.test.files.lib/genericNest/jars/genericNest-b1ec8a095cec4902b3609d74d274c04365c59c04.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.scala-sha-bootstrap.test.files.lib/jsoup-1.3.1/jars/jsoup-1.3.1-346d3dff4088839d6b4d163efa2892124039d216.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.scala-sha-bootstrap.test.files.lib/macro210/jars/macro210-3794ec22d9b27f2b179bd34e9b46db771b934ec3.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.scala-sha-bootstrap.test.files.lib/methvsfield/jars/methvsfield-be8454d5e7751b063ade201c225dcedefd252775.jar!/" /> + <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.scala-sha-bootstrap.test.files.lib/nest/jars/nest-cd33e0a0ea249eb42363a2f8ba531186345ff68c.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> diff --git a/src/intellij/scalacheck.iml.SAMPLE b/src/intellij/scalacheck.iml.SAMPLE new file mode 100644 index 0000000000..cb7837fcd4 --- /dev/null +++ b/src/intellij/scalacheck.iml.SAMPLE @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$/../../test/scalacheck"> + <sourceFolder url="file://$MODULE_DIR$/../../test/scalacheck" isTestSource="true" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="module" module-name="library" /> + <orderEntry type="module" module-name="reflect" /> + <orderEntry type="module" module-name="compiler" /> + <orderEntry type="module" module-name="repl" /> + <orderEntry type="module" module-name="interactive" /> + <orderEntry type="module" module-name="scaladoc" /> + <orderEntry type="library" name="scalacheck-deps" level="project" /> + <orderEntry type="library" name="starr" level="project" /> + </component> +</module>
\ No newline at end of file diff --git a/src/intellij/test.iml.SAMPLE b/src/intellij/test.iml.SAMPLE index 0253b539e7..a74dcfa543 100644 --- a/src/intellij/test.iml.SAMPLE +++ b/src/intellij/test.iml.SAMPLE @@ -7,9 +7,7 @@ </content> <orderEntry type="inheritedJdk" /> <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="module" module-name="forkjoin" /> <orderEntry type="module" module-name="library" /> - <orderEntry type="module" module-name="actors" /> <orderEntry type="module" module-name="reflect" /> <orderEntry type="module" module-name="compiler" /> <orderEntry type="module" module-name="repl" /> diff --git a/src/library/scala/collection/immutable/HashMap.scala b/src/library/scala/collection/immutable/HashMap.scala index 6b29b084aa..627f723cb0 100644 --- a/src/library/scala/collection/immutable/HashMap.scala +++ b/src/library/scala/collection/immutable/HashMap.scala @@ -52,6 +52,9 @@ sealed class HashMap[A, +B] extends AbstractMap[A, B] def get(key: A): Option[B] = get0(key, computeHash(key), 0) + override final def contains(key: A): Boolean = + contains0(key, computeHash(key), 0) + override def updated [B1 >: B] (key: A, value: B1): HashMap[A, B1] = updated0(key, computeHash(key), 0, value, null, null) @@ -92,7 +95,7 @@ sealed class HashMap[A, +B] extends AbstractMap[A, B] import HashMap.{Merger, MergeFunction, liftMerger} private[collection] def get0(key: A, hash: Int, level: Int): Option[B] = None - + protected def contains0(key: A, hash: Int, level: Int): Boolean = false private[collection] def updated0[B1 >: B](key: A, hash: Int, level: Int, value: B1, kv: (A, B1), merger: Merger[A, B1]): HashMap[A, B1] = new HashMap.HashMap1(key, hash, value, kv) @@ -185,6 +188,7 @@ object HashMap extends ImmutableMapFactory[HashMap] with BitOperations.Int { } } + @deprecatedInheritance("This class will be made final in a future release.", "2.12.2") class HashMap1[A,+B](private[collection] val key: A, private[collection] val hash: Int, private[collection] val value: (B @uV), private[collection] var kv: (A,B @uV)) extends HashMap[A,B] { override def size = 1 @@ -195,6 +199,8 @@ object HashMap extends ImmutableMapFactory[HashMap] with BitOperations.Int { override def get0(key: A, hash: Int, level: Int): Option[B] = if (hash == this.hash && key == this.key) Some(value) else None + override protected def contains0(key: A, hash: Int, level: Int): Boolean = + hash == this.hash && key == this.key private[collection] override def updated0[B1 >: B](key: A, hash: Int, level: Int, value: B1, kv: (A, B1), merger: Merger[A, B1]): HashMap[A, B1] = if (hash == this.hash && key == this.key ) { if (merger eq null) { @@ -239,6 +245,9 @@ object HashMap extends ImmutableMapFactory[HashMap] with BitOperations.Int { override def get0(key: A, hash: Int, level: Int): Option[B] = if (hash == this.hash) kvs.get(key) else None + override protected def contains0(key: A, hash: Int, level: Int): Boolean = + hash == this.hash && kvs.contains(key) + private[collection] override def updated0[B1 >: B](key: A, hash: Int, level: Int, value: B1, kv: (A, B1), merger: Merger[A, B1]): HashMap[A, B1] = if (hash == this.hash) { if ((merger eq null) || !kvs.contains(key)) new HashMapCollision1(hash, kvs.updated(key, value)) @@ -294,6 +303,7 @@ object HashMap extends ImmutableMapFactory[HashMap] with BitOperations.Int { } } + @deprecatedInheritance("This class will be made final in a future release.", "2.12.2") class HashTrieMap[A, +B]( private[collection] val bitmap: Int, private[collection] val elems: Array[HashMap[A, B @uV]], @@ -306,21 +316,41 @@ object HashMap extends ImmutableMapFactory[HashMap] with BitOperations.Int { override def size = size0 override def get0(key: A, hash: Int, level: Int): Option[B] = { + // Note: this code is duplicated with `contains0` + val index = (hash >>> level) & 0x1f + if (bitmap == - 1) { + elems(index).get0(key, hash, level + 5) + } else { + val mask = (1 << index) + if ((bitmap & mask) != 0) { + val offset = Integer.bitCount(bitmap & (mask - 1)) + elems(offset).get0(key, hash, level + 5) + } else { + None + } + } + } + + override protected def contains0(key: A, hash: Int, level: Int): Boolean = { + // Note: this code is duplicated from `get0` val index = (hash >>> level) & 0x1f - val mask = (1 << index) if (bitmap == - 1) { - elems(index & 0x1f).get0(key, hash, level + 5) - } else if ((bitmap & mask) != 0) { - val offset = Integer.bitCount(bitmap & (mask-1)) - elems(offset).get0(key, hash, level + 5) - } else - None + elems(index).contains0(key, hash, level + 5) + } else { + val mask = (1 << index) + if ((bitmap & mask) != 0) { + val offset = Integer.bitCount(bitmap & (mask - 1)) + elems(offset).contains0(key, hash, level + 5) + } else { + false + } + } } private[collection] override def updated0[B1 >: B](key: A, hash: Int, level: Int, value: B1, kv: (A, B1), merger: Merger[A, B1]): HashMap[A, B1] = { val index = (hash >>> level) & 0x1f val mask = (1 << index) - val offset = Integer.bitCount(bitmap & (mask-1)) + val offset = Integer.bitCount(bitmap & (mask - 1)) if ((bitmap & mask) != 0) { val sub = elems(offset) val subNew = sub.updated0(key, hash, level + 5, value, kv, merger) @@ -342,7 +372,7 @@ object HashMap extends ImmutableMapFactory[HashMap] with BitOperations.Int { override def removed0(key: A, hash: Int, level: Int): HashMap[A, B] = { val index = (hash >>> level) & 0x1f val mask = (1 << index) - val offset = Integer.bitCount(bitmap & (mask-1)) + val offset = Integer.bitCount(bitmap & (mask - 1)) if ((bitmap & mask) != 0) { val sub = elems(offset) val subNew = sub.removed0(key, hash, level + 5) diff --git a/src/library/scala/collection/immutable/Queue.scala b/src/library/scala/collection/immutable/Queue.scala index 1dd0d7683a..240b5c899e 100644 --- a/src/library/scala/collection/immutable/Queue.scala +++ b/src/library/scala/collection/immutable/Queue.scala @@ -106,6 +106,15 @@ sealed class Queue[+A] protected(protected val in: List[A], protected val out: L case _ => super.:+(elem)(bf) } + override def ++[B >: A, That](that: GenTraversableOnce[B])(implicit bf: CanBuildFrom[Queue[A], B, That]): That = { + if (bf eq Queue.ReusableCBF) { + val thatQueue = that.asInstanceOf[Queue[B]] + new Queue[B](thatQueue.in ++ (thatQueue.out reverse_::: this.in), this.out).asInstanceOf[That] + } else { + super.++(that)(bf) + } + } + /** Creates a new queue with element added at the end * of the old queue. * diff --git a/src/library/scala/collection/mutable/TreeMap.scala b/src/library/scala/collection/mutable/TreeMap.scala index dc7d5d750e..14ae7c9c8c 100644 --- a/src/library/scala/collection/mutable/TreeMap.scala +++ b/src/library/scala/collection/mutable/TreeMap.scala @@ -180,6 +180,9 @@ sealed class TreeMap[A, B] private (tree: RB.Tree[A, B])(implicit val ordering: this } + override def valuesIterator: Iterator[B] = RB.valuesIterator(tree, from, until) + override def keysIterator: Iterator[A] = RB.keysIterator(tree, from, until) + override def clone() = super.clone().rangeImpl(from, until) } } diff --git a/src/scaladoc/scala/tools/partest/ScaladocJavaModelTest.scala b/src/partest-extras/scala/tools/partest/ScaladocJavaModelTest.scala index 1008be5b87..1008be5b87 100644 --- a/src/scaladoc/scala/tools/partest/ScaladocJavaModelTest.scala +++ b/src/partest-extras/scala/tools/partest/ScaladocJavaModelTest.scala diff --git a/src/scaladoc/scala/tools/partest/ScaladocModelTest.scala b/src/partest-extras/scala/tools/partest/ScaladocModelTest.scala index 44c1146a14..44c1146a14 100644 --- a/src/scaladoc/scala/tools/partest/ScaladocModelTest.scala +++ b/src/partest-extras/scala/tools/partest/ScaladocModelTest.scala diff --git a/src/reflect/scala/reflect/internal/Printers.scala b/src/reflect/scala/reflect/internal/Printers.scala index 9602a2859b..bb352e9d31 100644 --- a/src/reflect/scala/reflect/internal/Printers.scala +++ b/src/reflect/scala/reflect/internal/Printers.scala @@ -775,7 +775,7 @@ trait Printers extends api.Printers { self: SymbolTable => } // constructor's params processing (don't print single empty constructor param list) vparamss match { - case Nil | List(Nil) if (!mods.isCase && !ctorMods.hasFlag(AccessFlags)) => + case Nil | List(Nil) if !mods.isCase && !ctorMods.hasFlag(AccessFlags) => case _ => vparamss foreach printConstrParams } parents diff --git a/src/reflect/scala/reflect/internal/ReificationSupport.scala b/src/reflect/scala/reflect/internal/ReificationSupport.scala index 026438e421..1b2be64654 100644 --- a/src/reflect/scala/reflect/internal/ReificationSupport.scala +++ b/src/reflect/scala/reflect/internal/ReificationSupport.scala @@ -266,7 +266,7 @@ trait ReificationSupport { self: SymbolTable => } // undo gen.mkTemplate - protected object UnMkTemplate { + protected class UnMkTemplate(isCaseClass: Boolean) { def unapply(templ: Template): Option[(List[Tree], ValDef, Modifiers, List[List[ValDef]], List[Tree], List[Tree])] = { val Template(parents, selfType, _) = templ val tbody = treeInfo.untypecheckedTemplBody(templ) @@ -296,8 +296,9 @@ trait ReificationSupport { self: SymbolTable => result(ctorMods, Nil, edefs, body) else { // undo conversion from (implicit ... ) to ()(implicit ... ) when it's the only parameter section + // except that case classes require the explicit leading empty parameter list val vparamssRestoredImplicits = ctorVparamss match { - case Nil :: (tail @ ((head :: _) :: _)) if head.mods.isImplicit => tail + case Nil :: (tail @ ((head :: _) :: _)) if head.mods.isImplicit && !isCaseClass => tail case other => other } // undo flag modifications by merging flag info from constructor args and fieldDefs @@ -314,7 +315,9 @@ trait ReificationSupport { self: SymbolTable => } } } + def asCase = new UnMkTemplate(isCaseClass = true) } + protected object UnMkTemplate extends UnMkTemplate(isCaseClass = false) protected def mkSelfType(tree: Tree) = tree match { case vd: ValDef => @@ -346,9 +349,11 @@ trait ReificationSupport { self: SymbolTable => def unapply(tree: Tree): Option[(Modifiers, TypeName, List[TypeDef], Modifiers, List[List[ValDef]], List[Tree], List[Tree], ValDef, List[Tree])] = tree match { - case ClassDef(mods, name, tparams, UnMkTemplate(parents, selfType, ctorMods, vparamss, earlyDefs, body)) - if !ctorMods.isTrait && !ctorMods.hasFlag(JAVA) => - Some((mods, name, tparams, ctorMods, vparamss, earlyDefs, parents, selfType, body)) + case ClassDef(mods, name, tparams, impl) => + val X = if (mods.isCase) UnMkTemplate.asCase else UnMkTemplate + val X(parents, selfType, ctorMods, vparamss, earlyDefs, body) = impl + if (ctorMods.isTrait || ctorMods.hasFlag(JAVA)) None + else Some((mods, name, tparams, ctorMods, vparamss, earlyDefs, parents, selfType, body)) case _ => None } diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala index e664b5ad08..890a5796e9 100644 --- a/src/reflect/scala/reflect/internal/Symbols.scala +++ b/src/reflect/scala/reflect/internal/Symbols.scala @@ -3676,9 +3676,15 @@ trait Symbols extends api.Symbols { self: SymbolTable => val AllOps = SymbolOps(isFlagRelated = false, mask = 0L) def FlagOps(mask: Long) = SymbolOps(isFlagRelated = true, mask = mask) - private def relevantSymbols(syms: Seq[Symbol]) = syms.flatMap(sym => List(sym, sym.moduleClass, sym.sourceModule)) - def markFlagsCompleted(syms: Symbol*)(mask: Long): Unit = relevantSymbols(syms).foreach(_.markFlagsCompleted(mask)) - def markAllCompleted(syms: Symbol*): Unit = relevantSymbols(syms).foreach(_.markAllCompleted) + private def forEachRelevantSymbols(syms: Seq[Symbol], fn: Symbol => Unit): Unit = + syms.foreach { sym => + fn(sym) + fn(sym.moduleClass) + fn(sym.sourceModule) + } + + def markFlagsCompleted(syms: Symbol*)(mask: Long): Unit = forEachRelevantSymbols(syms, _.markFlagsCompleted(mask)) + def markAllCompleted(syms: Symbol*): Unit = forEachRelevantSymbols(syms, _.markAllCompleted) } object SymbolsStats { diff --git a/src/repl-jline/scala/tools/nsc/interpreter/jline/JLineReader.scala b/src/repl-jline/scala/tools/nsc/interpreter/jline/JLineReader.scala index 912ac26329..dc04230d0b 100644 --- a/src/repl-jline/scala/tools/nsc/interpreter/jline/JLineReader.scala +++ b/src/repl-jline/scala/tools/nsc/interpreter/jline/JLineReader.scala @@ -94,19 +94,11 @@ private class JLineConsoleReader extends jconsole.ConsoleReader with interpreter printColumns_(items: List[String]) } - // Workaround for JLine weirdness. (See https://github.com/scala/scala-dev/issues/240) - // Emit control characters as-is, instead of representing them as e.g. "^J" (for '\n'). - // `rawPrint` is package protected in jline.console.ConsoleReader, while `rawPrintln` is private - // Copy/paste part of it as `_rawPrint` (to avoid name clash); - // the super class impl also sets `cursorOk`, but that's out of reach for us. - private def _rawPrint(str: String) = getOutput.write(str) - private def rawPrintln(str: String) = { _rawPrint(str); println() } - private def printColumns_(items: List[String]): Unit = if (items exists (_ != "")) { val grouped = tabulate(items) var linesLeft = if (isPaginationEnabled()) height - 1 else Int.MaxValue grouped foreach { xs => - rawPrintln(xs.mkString) + println(xs.mkString) linesLeft -= 1 if (linesLeft <= 0) { linesLeft = emulateMore() @@ -117,7 +109,7 @@ private class JLineConsoleReader extends jconsole.ConsoleReader with interpreter } def readOneKey(prompt: String) = { - _rawPrint(prompt) + this.print(prompt) this.flush() this.readCharacter() } diff --git a/src/repl/scala/tools/nsc/interpreter/ILoop.scala b/src/repl/scala/tools/nsc/interpreter/ILoop.scala index d1096fda4e..d03924b158 100644 --- a/src/repl/scala/tools/nsc/interpreter/ILoop.scala +++ b/src/repl/scala/tools/nsc/interpreter/ILoop.scala @@ -9,6 +9,7 @@ package interpreter import scala.language.{ implicitConversions, existentials } import scala.annotation.tailrec import Predef.{ println => _, _ } +import PartialFunction.{cond => when} import interpreter.session._ import StdReplTags._ import scala.tools.asm.ClassReader @@ -17,7 +18,7 @@ import scala.tools.nsc.util.{ ClassPath, stringFromStream } import scala.reflect.classTag import scala.reflect.internal.util.{ BatchSourceFile, ScalaClassLoader, NoPosition } import ScalaClassLoader._ -import scala.reflect.io.File +import scala.reflect.io.{Directory, File, Path} import scala.tools.util._ import io.AbstractFile import scala.concurrent.{ ExecutionContext, Await, Future } @@ -26,6 +27,8 @@ import java.io.BufferedReader import scala.util.{ Try, Success, Failure } +import Completion._ + /** The Scala interactive shell. It provides a read-eval-print loop * around the Interpreter class. * After instantiation, clients should call the main() method. @@ -119,37 +122,6 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter) intp = new ILoopInterpreter } - /** print a friendly help message */ - def helpCommand(line: String): Result = line match { - case "" => helpSummary() - case CommandMatch(cmd) => echo(f"%n${cmd.help}") - case _ => ambiguousError(line) - } - private def helpSummary() = { - val usageWidth = commands map (_.usageMsg.length) max - val formatStr = s"%-${usageWidth}s %s" - - echo("All commands can be abbreviated, e.g., :he instead of :help.") - - for (cmd <- commands) echo(formatStr.format(cmd.usageMsg, cmd.help)) - } - private def ambiguousError(cmd: String): Result = { - matchingCommands(cmd) match { - case Nil => echo(cmd + ": no such command. Type :help for help.") - case xs => echo(cmd + " is ambiguous: did you mean " + xs.map(":" + _.name).mkString(" or ") + "?") - } - Result(keepRunning = true, None) - } - // this lets us add commands willy-nilly and only requires enough command to disambiguate - private def matchingCommands(cmd: String) = commands filter (_.name startsWith cmd) - private object CommandMatch { - def unapply(name: String): Option[LoopCommand] = - matchingCommands(name) match { - case x :: Nil => Some(x) - case xs => xs find (_.name == name) // accept an exact match - } - } - /** Show the history */ lazy val historyCommand = new LoopCommand("history", "show the history (optional num is commands to show)") { override def usage = "[num]" @@ -214,16 +186,16 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter) cmd("implicits", "[-v]", "show the implicits in scope", intp.implicitsCommand), cmd("javap", "<path|class>", "disassemble a file or class name", javapCommand), cmd("line", "<id>|<line>", "place line(s) at the end of history", lineCommand), - cmd("load", "<path>", "interpret lines in a file", loadCommand), - cmd("paste", "[-raw] [path]", "enter paste mode or paste a file", pasteCommand), + cmd("load", "<path>", "interpret lines in a file", loadCommand, fileCompletion), + cmd("paste", "[-raw] [path]", "enter paste mode or paste a file", pasteCommand, fileCompletion), nullary("power", "enable power user mode", powerCmd), nullary("quit", "exit the interpreter", () => Result(keepRunning = false, None)), - cmd("replay", "[options]", "reset the repl and replay all previous commands", replayCommand), + cmd("replay", "[options]", "reset the repl and replay all previous commands", replayCommand, settingsCompletion), cmd("require", "<path>", "add a jar to the classpath", require), - cmd("reset", "[options]", "reset the repl to its initial state, forgetting all session entries", resetCommand), - cmd("save", "<path>", "save replayable session to a file", saveCommand), + cmd("reset", "[options]", "reset the repl to its initial state, forgetting all session entries", resetCommand, settingsCompletion), + cmd("save", "<path>", "save replayable session to a file", saveCommand, fileCompletion), shCommand, - cmd("settings", "<options>", "update compiler options, if possible; see reset", changeSettings), + cmd("settings", "<options>", "update compiler options, if possible; see reset", changeSettings, settingsCompletion), nullary("silent", "disable/enable automatic printing of results", verbosity), cmd("type", "[-v] <expr>", "display the type of an expression without evaluating it", typeCommand), cmd("kind", "[-v] <expr>", "display the kind of expression's type", kindCommand), @@ -235,6 +207,46 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter) cmd("phase", "<phase>", "set the implicit phase for power commands", phaseCommand) ) + // complete filename + val fileCompletion: Completion = new Completion { + def resetVerbosity(): Unit = () + val emptyWord = """(\s+)$""".r.unanchored + val directorily = """(\S*/)$""".r.unanchored + val trailingWord = """(\S+)$""".r.unanchored + def listed(i: Int, dir: Option[Path]) = + dir.filter(_.isDirectory).map(d => Candidates(i, d.toDirectory.list.map(_.name).toList)).getOrElse(NoCandidates) + def listedIn(dir: Directory, name: String) = dir.list.filter(_.name.startsWith(name)).map(_.name).toList + def complete(buffer: String, cursor: Int): Candidates = + buffer.substring(0, cursor) match { + case emptyWord(s) => listed(cursor, Directory.Current) + case directorily(s) => listed(cursor, Option(Path(s))) + case trailingWord(s) => + val f = File(s) + val (i, maybes) = + if (f.isFile) (cursor - s.length, List(f.toAbsolute.path)) + else if (f.isDirectory) (cursor - s.length, List(s"${f.toAbsolute.path}/")) + else if (f.parent.exists) (cursor - f.name.length, listedIn(f.parent.toDirectory, f.name)) + else (-1, Nil) + if (maybes.isEmpty) NoCandidates else Candidates(i, maybes) + case _ => NoCandidates + } + } + + // complete settings name + val settingsCompletion: Completion = new Completion { + def resetVerbosity(): Unit = () + val trailingWord = """(\S+)$""".r.unanchored + def complete(buffer: String, cursor: Int): Candidates = { + buffer.substring(0, cursor) match { + case trailingWord(s) => + val maybes = settings.visibleSettings.filter(_.name.startsWith(s)).map(_.name) + .filterNot(when(_) { case "-"|"-X"|"-Y" => true }).toList.sorted + if (maybes.isEmpty) NoCandidates else Candidates(cursor - s.length, maybes) + case _ => NoCandidates + } + } + } + private def importsCommand(line: String): Result = { val tokens = words(line) val handlers = intp.languageWildcardHandlers ++ intp.importHandlers @@ -681,20 +693,11 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter) * (1) whether to keep running, (2) the line to record for replay, if any. */ def command(line: String): Result = { - if (line startsWith ":") colonCommand(line.tail) + if (line startsWith ":") colonCommand(line) else if (intp.global == null) Result(keepRunning = false, None) // Notice failure to create compiler else Result(keepRunning = true, interpretStartingWith(line)) } - private val commandish = """(\S+)(?:\s+)?(.*)""".r - - private def colonCommand(line: String): Result = line.trim match { - case "" => helpSummary() - case commandish(CommandMatch(cmd), rest) => cmd(rest) - case commandish(name, _) => ambiguousError(name) - case _ => echo("?") - } - private def readWhile(cond: String => Boolean) = { Iterator continually in.readLine("") takeWhile (x => x != null && cond(x)) } @@ -849,6 +852,18 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter) } } + // delegate to command completion or presentation compiler + class ReplCompletion(intp: IMain) extends Completion { + val pc = new PresentationCompilerCompleter(intp) + def resetVerbosity(): Unit = pc.resetVerbosity() + def complete(buffer: String, cursor: Int): Completion.Candidates = { + if (buffer.startsWith(":")) + colonCompletion(buffer, cursor).complete(buffer, cursor) + else + pc.complete(buffer, cursor) + } + } + /** Tries to create a jline.InteractiveReader, falling back to SimpleReader, * unless settings or properties are such that it should start with SimpleReader. * The constructor of the InteractiveReader must take a Completion strategy, @@ -868,7 +883,7 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter) } def mkReader(maker: ReaderMaker) = maker { () => - if (settings.noCompletion) NoCompletion else new PresentationCompilerCompleter(intp) + if (settings.noCompletion) NoCompletion else new ReplCompletion(intp) } def internalClass(kind: String) = s"scala.tools.nsc.interpreter.$kind.InteractiveReader" diff --git a/src/repl/scala/tools/nsc/interpreter/LoopCommands.scala b/src/repl/scala/tools/nsc/interpreter/LoopCommands.scala index 8c3b174513..a2ce63996b 100644 --- a/src/repl/scala/tools/nsc/interpreter/LoopCommands.scala +++ b/src/repl/scala/tools/nsc/interpreter/LoopCommands.scala @@ -24,18 +24,21 @@ class ProcessResult(val line: String) { override def toString = "`%s` (%d lines, exit %d)".format(line, buffer.size, exitCode) } -trait LoopCommands { +trait LoopCommands { self: { def echo(msg: String): Unit } => protected def out: JPrintWriter // So outputs can be suppressed. - def echoCommandMessage(msg: String): Unit = out println msg + def echoCommandMessage(msg: String): Unit = out.println(msg) + + // available commands + def commands: List[LoopCommand] // a single interpreter command abstract class LoopCommand(val name: String, val help: String) extends (String => Result) { def usage: String = "" - def usageMsg: String = ":" + name + ( + def usageMsg: String = s":$name${ if (usage == "") "" else " " + usage - ) + }" def apply(line: String): Result // called if no args are given @@ -43,21 +46,88 @@ trait LoopCommands { "usage is " + usageMsg Result(keepRunning = true, None) } + + // subclasses may provide completions + def completion: Completion = NoCompletion } object LoopCommand { def nullary(name: String, help: String, f: () => Result): LoopCommand = new NullaryCmd(name, help, _ => f()) - def cmd(name: String, usage: String, help: String, f: String => Result): LoopCommand = + def cmd(name: String, usage: String, help: String, f: String => Result, completion: Completion = NoCompletion): LoopCommand = if (usage == "") new NullaryCmd(name, help, f) - else new LineCmd(name, usage, help, f) + else new LineCmd(name, usage, help, f, completion) + } + + /** print a friendly help message */ + def helpCommand(line: String): Result = line match { + case "" => helpSummary() + case CommandMatch(cmd) => echo(f"%n${cmd.help}") + case _ => ambiguousError(line) + } + + def helpSummary() = { + val usageWidth = commands map (_.usageMsg.length) max + val formatStr = s"%-${usageWidth}s %s" + + echo("All commands can be abbreviated, e.g., :he instead of :help.") + + for (cmd <- commands) echo(formatStr.format(cmd.usageMsg, cmd.help)) + } + def ambiguousError(cmd: String): Result = { + matchingCommands(cmd) match { + case Nil => echo(cmd + ": no such command. Type :help for help.") + case xs => echo(cmd + " is ambiguous: did you mean " + xs.map(":" + _.name).mkString(" or ") + "?") + } + Result(keepRunning = true, None) + } + + // all commands with given prefix + private def matchingCommands(cmd: String) = commands.filter(_.name.startsWith(cmd.stripPrefix(":"))) + + // extract command from partial name, or prefer exact match if multiple matches + private object CommandMatch { + def unapply(name: String): Option[LoopCommand] = + matchingCommands(name) match { + case Nil => None + case x :: Nil => Some(x) + case xs => xs find (_.name == name) + } + } + + // extract command name and rest of line + private val commandish = """(\S+)(?:\s+)?(.*)""".r + + def colonCommand(line: String): Result = line.trim match { + case "" => helpSummary() + case commandish(CommandMatch(cmd), rest) => cmd(rest) + case commandish(name, _) => ambiguousError(name) + case _ => echo("?") + } + + import Completion.Candidates + + def colonCompletion(line: String, cursor: Int): Completion = line.trim match { + case commandish(name @ CommandMatch(cmd), rest) => + if (name.length > cmd.name.length) cmd.completion + else + new Completion { + def resetVerbosity(): Unit = () + def complete(buffer: String, cursor: Int) = Candidates(cursor - name.length + 1, List(cmd.name)) + } + case commandish(name, _) if matchingCommands(name).nonEmpty => + new Completion { + def resetVerbosity(): Unit = () + def complete(buffer: String, cursor: Int) = Candidates(cursor - name.length + 1, matchingCommands(name).map(_.name)) + } + case _ => NoCompletion } class NullaryCmd(name: String, help: String, f: String => Result) extends LoopCommand(name, help) { def apply(line: String): Result = f(line) } - class LineCmd(name: String, argWord: String, help: String, f: String => Result) extends LoopCommand(name, help) { + class LineCmd(name: String, argWord: String, help: String, f: String => Result, override val completion: Completion) extends LoopCommand(name, help) { override def usage = argWord def apply(line: String): Result = f(line) } diff --git a/test/benchmarks/src/main/scala/scala/collection/immutable/HashMapBenchmark.scala b/test/benchmarks/src/main/scala/scala/collection/immutable/HashMapBenchmark.scala new file mode 100644 index 0000000000..134cd6879b --- /dev/null +++ b/test/benchmarks/src/main/scala/scala/collection/immutable/HashMapBenchmark.scala @@ -0,0 +1,56 @@ +package scala.collection.immutable + +import org.openjdk.jmh.annotations._ +import org.openjdk.jmh.infra._ +import org.openjdk.jmh.runner.IterationType +import benchmark._ +import java.util.concurrent.TimeUnit + +@BenchmarkMode(Array(Mode.AverageTime)) +@Fork(2) +@Threads(1) +@Warmup(iterations = 10) +@Measurement(iterations = 10) +@OutputTimeUnit(TimeUnit.NANOSECONDS) +@State(Scope.Benchmark) +class HashMapBenchmark { + @Param(Array("10", "100", "1000")) + var size: Int = _ + + var existingKeys: Array[Any] = _ + var missingKeys: Array[Any] = _ + + @Setup(Level.Trial) def initKeys(): Unit = { + existingKeys = (0 to size).map(i => (i % 4) match { + case 0 => i.toString + case 1 => i.toChar + case 2 => i.toDouble + case 3 => i.toInt + }).toArray + missingKeys = (size to 2 * size).toArray + } + + var map: collection.immutable.HashMap[Any, Any] = null + + @Setup(Level.Trial) def initialize = { + map = collection.immutable.HashMap(existingKeys.map(x => (x, x)) : _*) + } + + @Benchmark def contains(bh: Blackhole): Unit = { + var i = 0; + while (i < size) { + bh.consume(map.contains(existingKeys(i))) + bh.consume(map.contains(missingKeys(i))) + i += 1 + } + } + + @Benchmark def get(bh: Blackhole): Unit = { + var i = 0; + while (i < size) { + bh.consume(map.get(existingKeys(i))) + bh.consume(map.get(missingKeys(i))) + i += 1 + } + } +} diff --git a/test/files/jvm/t8786/B_2.java b/test/files/jvm/t8786/B_2.java index dc155a290f..ab5350b136 100644 --- a/test/files/jvm/t8786/B_2.java +++ b/test/files/jvm/t8786/B_2.java @@ -5,7 +5,7 @@ public class B_2 { public static void m(String a) { res += 100; } public static void m(Object a) { res += 1000; } - public static <T> T foo(int a, T... b) { return b[0]; } + @SafeVarargs public static <T> T foo(int a, T... b) { return b[0]; } public static <T> T bar(T b[]) { return b[0]; } diff --git a/test/files/jvm/varargs/JavaClass.java b/test/files/jvm/varargs/JavaClass.java index 0cc3587c5e..35adcff850 100644 --- a/test/files/jvm/varargs/JavaClass.java +++ b/test/files/jvm/varargs/JavaClass.java @@ -1,5 +1,5 @@ public class JavaClass { - public static <T> void varargz(int i, T... v) { } + @SafeVarargs public static <T> void varargz(int i, T... v) { } public static void callSomeAnnotations() { VaClass va = new VaClass(); diff --git a/test/files/neg/maxerrs.check b/test/files/neg/maxerrs.check new file mode 100644 index 0000000000..5eaedad487 --- /dev/null +++ b/test/files/neg/maxerrs.check @@ -0,0 +1,16 @@ +maxerrs.scala:22: error: type mismatch; + found : String("") + required: Int + def F = f("") + ^ +maxerrs.scala:24: error: type mismatch; + found : String("") + required: Int + def g = f("") + ^ +maxerrs.scala:26: error: type mismatch; + found : String("") + required: Int + def h = f("") + ^ +5 errors found diff --git a/test/files/neg/maxerrs.flags b/test/files/neg/maxerrs.flags new file mode 100644 index 0000000000..6629ef62b6 --- /dev/null +++ b/test/files/neg/maxerrs.flags @@ -0,0 +1 @@ +-Xmaxerrs 3 -Xfatal-warnings -deprecation diff --git a/test/files/neg/maxerrs.scala b/test/files/neg/maxerrs.scala new file mode 100644 index 0000000000..43b725de7a --- /dev/null +++ b/test/files/neg/maxerrs.scala @@ -0,0 +1,32 @@ + +object X { + @deprecated("just to annoy people", since="forever") + def x = 42 + + def f(i: Int) = i +} + +trait T { + import X._ + + def a = x + + def b = x + + def c = x + + def d = x + + def e = x + + def F = f("") + + def g = f("") + + def h = f("") + + def i = f("") + + def j = f("") +} + diff --git a/test/files/neg/maxwarns.check b/test/files/neg/maxwarns.check new file mode 100644 index 0000000000..f4c8d907bd --- /dev/null +++ b/test/files/neg/maxwarns.check @@ -0,0 +1,12 @@ +maxwarns.scala:12: warning: method x in object X is deprecated (since forever): just to annoy people + def a = x + ^ +maxwarns.scala:14: warning: method x in object X is deprecated (since forever): just to annoy people + def b = x + ^ +maxwarns.scala:16: warning: method x in object X is deprecated (since forever): just to annoy people + def c = x + ^ +error: No warnings can be incurred under -Xfatal-warnings. +5 warnings found +one error found diff --git a/test/files/neg/maxwarns.flags b/test/files/neg/maxwarns.flags new file mode 100644 index 0000000000..d5d6e533e9 --- /dev/null +++ b/test/files/neg/maxwarns.flags @@ -0,0 +1 @@ +-Xmaxwarns 3 -Xfatal-warnings -deprecation diff --git a/test/files/neg/maxwarns.scala b/test/files/neg/maxwarns.scala new file mode 100644 index 0000000000..decb8a7866 --- /dev/null +++ b/test/files/neg/maxwarns.scala @@ -0,0 +1,32 @@ + +object X { + @deprecated("just to annoy people", since="forever") + def x = 42 + + def f(i: String) = i +} + +trait T { + import X._ + + def a = x + + def b = x + + def c = x + + def d = x + + def e = x + + def F = f("") + + def g = f("") + + def h = f("") + + def i = f("") + + def j = f("") +} + diff --git a/test/files/neg/quasiquotes-syntax-error-position.check b/test/files/neg/quasiquotes-syntax-error-position.check index 9fd6ce0417..b12a7d13d6 100644 --- a/test/files/neg/quasiquotes-syntax-error-position.check +++ b/test/files/neg/quasiquotes-syntax-error-position.check @@ -16,8 +16,7 @@ quasiquotes-syntax-error-position.scala:9: error: '{' expected but end of quote quasiquotes-syntax-error-position.scala:10: error: ';' expected but '@' found. q"foo@$a" ^ -quasiquotes-syntax-error-position.scala:11: error: case classes without a parameter list are not allowed; -use either case objects or case classes with an explicit `()' as a parameter list. +quasiquotes-syntax-error-position.scala:11: error: case classes must have a parameter list; try 'case class A()' or 'case object A' q"case class A" ^ quasiquotes-syntax-error-position.scala:12: error: identifier expected but ']' found. diff --git a/test/files/neg/t10097.check b/test/files/neg/t10097.check new file mode 100644 index 0000000000..1f70546b57 --- /dev/null +++ b/test/files/neg/t10097.check @@ -0,0 +1,10 @@ +t10097.scala:2: error: case classes must have a non-implicit parameter list; try 'case class C()(...)' +case class C(implicit val c: Int) + ^ +t10097.scala:4: error: case classes must have a non-implicit parameter list; try 'case class D()(...)(...)' +case class D(implicit c: Int)(s: String) + ^ +t10097.scala:4: error: an implicit parameter section must be last +case class D(implicit c: Int)(s: String) + ^ +three errors found diff --git a/test/files/neg/t10097.flags b/test/files/neg/t10097.flags new file mode 100644 index 0000000000..714bbf5125 --- /dev/null +++ b/test/files/neg/t10097.flags @@ -0,0 +1 @@ +-Xsource:2.13 diff --git a/test/files/neg/t10097.scala b/test/files/neg/t10097.scala new file mode 100644 index 0000000000..b2f05e2972 --- /dev/null +++ b/test/files/neg/t10097.scala @@ -0,0 +1,4 @@ + +case class C(implicit val c: Int) + +case class D(implicit c: Int)(s: String) diff --git a/test/files/neg/t10097b.check b/test/files/neg/t10097b.check new file mode 100644 index 0000000000..14535fee34 --- /dev/null +++ b/test/files/neg/t10097b.check @@ -0,0 +1,6 @@ +t10097b.scala:2: warning: case classes should have a non-implicit parameter list; adapting to 'case class C()(...)' +case class C(implicit val c: Int) + ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found +one error found diff --git a/test/files/neg/t10097b.flags b/test/files/neg/t10097b.flags new file mode 100644 index 0000000000..c6bfaf1f64 --- /dev/null +++ b/test/files/neg/t10097b.flags @@ -0,0 +1 @@ +-deprecation -Xfatal-warnings diff --git a/test/files/neg/t10097b.scala b/test/files/neg/t10097b.scala new file mode 100644 index 0000000000..f166db6792 --- /dev/null +++ b/test/files/neg/t10097b.scala @@ -0,0 +1,3 @@ + +case class C(implicit val c: Int) + diff --git a/test/files/neg/t7014.check b/test/files/neg/t7014.check index 07ad51e9d3..c68c170835 100644 --- a/test/files/neg/t7014.check +++ b/test/files/neg/t7014.check @@ -1,4 +1,4 @@ -warning: While parsing annotations in t7014-neg.obj/t7014/ThreadSafetyLevel.class, could not find COMPLETELY_THREADSAFE in enum object ThreadSafetyLevel. +warning: While parsing annotations in t7014-neg.obj/t7014/ThreadSafetyLevel_1.class, could not find COMPLETELY_THREADSAFE in enum object ThreadSafetyLevel_1. This is likely due to an implementation restriction: an annotation argument cannot refer to a member of the annotated class (SI-7014). error: No warnings can be incurred under -Xfatal-warnings. one warning found diff --git a/test/files/neg/t7014/ThreadSafetyLevel.java b/test/files/neg/t7014/ThreadSafetyLevel_1.java index 4df1dc787a..eeca65366b 100644 --- a/test/files/neg/t7014/ThreadSafetyLevel.java +++ b/test/files/neg/t7014/ThreadSafetyLevel_1.java @@ -4,5 +4,5 @@ package t7014; // package needed due to other bug in scalac's java parser // and on doing so, fail to find a symbol for the COMPLETELY_THREADSAFE reference // from the annotation's argument to the enum's member // for now, let's just not crash -- should implement lazy completing at some point -@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) -public enum ThreadSafetyLevel { COMPLETELY_THREADSAFE } +@ThreadSafety_1(level=ThreadSafetyLevel_1.COMPLETELY_THREADSAFE) +public enum ThreadSafetyLevel_1 { COMPLETELY_THREADSAFE } diff --git a/test/files/neg/t7014/ThreadSafety.java b/test/files/neg/t7014/ThreadSafety_1.java index ed508804e3..e68b103d1f 100644 --- a/test/files/neg/t7014/ThreadSafety.java +++ b/test/files/neg/t7014/ThreadSafety_1.java @@ -4,6 +4,6 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @Retention(RetentionPolicy.RUNTIME) // must be exactly RUNTIME retention (those we parse) -public @interface ThreadSafety { - ThreadSafetyLevel level(); +public @interface ThreadSafety_1 { + ThreadSafetyLevel_1 level(); }
\ No newline at end of file diff --git a/test/files/neg/t7014/t7014.scala b/test/files/neg/t7014/t7014.scala deleted file mode 100644 index 7c73f700be..0000000000 --- a/test/files/neg/t7014/t7014.scala +++ /dev/null @@ -1,3 +0,0 @@ -package t7014 - -import ThreadSafetyLevel.COMPLETELY_THREADSAFE // refer to annotation so it gets parsed diff --git a/test/files/neg/t7014/t7014_2.scala b/test/files/neg/t7014/t7014_2.scala new file mode 100644 index 0000000000..4845fc9a5d --- /dev/null +++ b/test/files/neg/t7014/t7014_2.scala @@ -0,0 +1,3 @@ +package t7014 + +import ThreadSafetyLevel_1.COMPLETELY_THREADSAFE // refer to annotation so it gets parsed diff --git a/test/files/neg/t8704.check b/test/files/neg/t8704.check new file mode 100644 index 0000000000..b567a8bb17 --- /dev/null +++ b/test/files/neg/t8704.check @@ -0,0 +1,11 @@ +t8704.scala:7: warning: 2 parameter sections are effectively implicit +class D(private implicit val i: Int)(implicit s: String) + ^ +t8704.scala:3: error: an implicit parameter section must be last +class C(i: Int)(implicit j: Int)(implicit k: Int)(n: Int) { + ^ +t8704.scala:3: error: multiple implicit parameter sections are not allowed +class C(i: Int)(implicit j: Int)(implicit k: Int)(n: Int) { + ^ +one warning found +two errors found diff --git a/test/files/neg/t8704.flags b/test/files/neg/t8704.flags new file mode 100644 index 0000000000..f175a06c74 --- /dev/null +++ b/test/files/neg/t8704.flags @@ -0,0 +1 @@ +-Ywarn-extra-implicit diff --git a/test/files/neg/t8704.scala b/test/files/neg/t8704.scala new file mode 100644 index 0000000000..db43bfcaa5 --- /dev/null +++ b/test/files/neg/t8704.scala @@ -0,0 +1,7 @@ + + +class C(i: Int)(implicit j: Int)(implicit k: Int)(n: Int) { + def f = n +} + +class D(private implicit val i: Int)(implicit s: String) diff --git a/test/files/run/bcodeInlinerMixed/B_1.scala b/test/files/run/bcodeInlinerMixed/B_1.scala index 2aadeccb82..b26f2f1dd5 100644 --- a/test/files/run/bcodeInlinerMixed/B_1.scala +++ b/test/files/run/bcodeInlinerMixed/B_1.scala @@ -1,15 +1,13 @@ -// Partest does proper mixed compilation: +// Since 1.0.18, partest does mixed compilation only in two stages // 1. scalac *.scala *.java // 2. javac *.java -// 3. scalc *.scala -// -// In the second scalc round, the classfile for A_1 is on the classpath. -// Therefore the inliner has access to the bytecode of `bar`, which means -// it can verify that the invocation to `bar` can be safely inlined. // -// So both callsites of `flop` are inlined. +// Before it used to do a third stage +// 3. scalc *.scala // -// In a single mixed compilation, `flop` cannot be inlined, see JUnit InlinerTest.scala, def mixedCompilationNoInline. +// Because he inliner doesn't has access to the bytecode of `bar`, it cannot verify whether the +// invocation of `bar` can be safely copied to a differnet place, so `flop` is not inlined to `B.g` +// or `C.h`. class B { @inline final def flop = A_1.bar diff --git a/test/files/run/bcodeInlinerMixed/Test.scala b/test/files/run/bcodeInlinerMixed/Test.scala deleted file mode 100644 index c8c7a9fe2a..0000000000 --- a/test/files/run/bcodeInlinerMixed/Test.scala +++ /dev/null @@ -1,16 +0,0 @@ -import scala.tools.partest.{BytecodeTest, ASMConverters} -import ASMConverters._ - -object Test extends BytecodeTest { - def show: Unit = { - val gIns = instructionsFromMethod(getMethod(loadClassNode("B"), "g")) - val hIns = instructionsFromMethod(getMethod(loadClassNode("C"), "h")) - // val invocation = Invoke(INVOKESTATIC, A_1, bar, ()I, false) - for (i <- List(gIns, hIns)) { - assert(i exists { - case Invoke(_, _, "bar", "()I", _) => true - case _ => false - }, i mkString "\n") - } - } -} diff --git a/test/files/run/bcodeInlinerMixed/Test_2.scala b/test/files/run/bcodeInlinerMixed/Test_2.scala new file mode 100644 index 0000000000..db1ea14a8f --- /dev/null +++ b/test/files/run/bcodeInlinerMixed/Test_2.scala @@ -0,0 +1,30 @@ +import scala.tools.partest.{BytecodeTest, ASMConverters} +import ASMConverters._ + +class D { + // This is compiled with `A_1.class` on the classpath. When inlining `flop` (which invokes + // `A_1.bar`), the inliner can check that the call to `A_1.bar` can be safely inlined into a + // different classfile (D). See also comment in B_1.scala. + def m(b: B) = b.flop +} + +object Test extends BytecodeTest { + def show: Unit = { + val gIns = instructionsFromMethod(getMethod(loadClassNode("B"), "g")) + val hIns = instructionsFromMethod(getMethod(loadClassNode("C"), "h")) + for (i <- List(gIns, hIns)) { + assert(i exists { + // `flop` is not inlined + case Invoke(_, _, "flop", "()I", _) => true + case _ => false + }, i mkString "\n") + } + + val mIns = instructionsFromMethod(getMethod(loadClassNode("D"), "m")) + assert(mIns exists { + // `flop` is inlined, we get a call to `bar` + case Invoke(_, _, "bar", "()I", _) => true + case _ => false + }, mIns mkString "\n") + } +} diff --git a/test/files/run/iq.scala b/test/files/run/iq.scala index 0ccf67a2e9..9929f0e1a0 100644 --- a/test/files/run/iq.scala +++ b/test/files/run/iq.scala @@ -25,12 +25,18 @@ object iq { assert(q2 == qb) val qc = 42 +: q :+ 0 assert(q2 == qc) + assert(q ++ qa == qa) + val qdr = 1 +: 2 +: 3 +: 4 +: q + val qcon1 = 1 +: 2 +: q + val qcon2 = q :+ 3 :+ 4 + val qd = qcon1 ++ qcon2 + assert(qd == qdr) Console.println("q2: " + q2) Console.println("qa: " + qa) Console.println("qb: " + qb) Console.println("qc: " + qc) - + /* Test is empty and dequeue. * Expected: Head: 42 */ diff --git a/test/files/run/patmat-exprs.scala b/test/files/run/patmat-exprs.scala index 7ca5fd3063..d18df9c714 100644 --- a/test/files/run/patmat-exprs.scala +++ b/test/files/run/patmat-exprs.scala @@ -344,13 +344,13 @@ trait Pattern { } - case class Zero[T] (implicit num: NumericOps[T]) extends Leaf[T] { + case class Zero[T]()(implicit num: NumericOps[T]) extends Leaf[T] { def derivative(variable: Var[T]) = Zero[T] def eval(f: Any => Any) = num.zero override def toString = "0" } - case class One[T] (implicit num: NumericOps[T]) extends Leaf[T] { + case class One[T]()(implicit num: NumericOps[T]) extends Leaf[T] { def derivative(variable: Var[T]) = Zero[T] def eval(f: Any => Any) = num.one override def toString = "1" diff --git a/test/files/run/t10097.check b/test/files/run/t10097.check new file mode 100644 index 0000000000..0e8b96061c --- /dev/null +++ b/test/files/run/t10097.check @@ -0,0 +1,3 @@ +t10097.scala:2: warning: case classes should have a non-implicit parameter list; adapting to 'case class C()(...)' +case class C(implicit c: Int) + ^ diff --git a/test/files/run/t10097.flags b/test/files/run/t10097.flags new file mode 100644 index 0000000000..dcc59ebe32 --- /dev/null +++ b/test/files/run/t10097.flags @@ -0,0 +1 @@ +-deprecation diff --git a/test/files/run/t10097.scala b/test/files/run/t10097.scala new file mode 100644 index 0000000000..a16be897cc --- /dev/null +++ b/test/files/run/t10097.scala @@ -0,0 +1,6 @@ + +case class C(implicit c: Int) + +object Test extends App { + assert(C()(42).productArity == 0) +} diff --git a/test/files/run/t4788-separate-compilation.check b/test/files/run/t4788-separate-compilation.check index 172ad90102..618fddfea3 100644 --- a/test/files/run/t4788-separate-compilation.check +++ b/test/files/run/t4788-separate-compilation.check @@ -1,5 +1,5 @@ Some(@Ljava/lang/Deprecated;()) None -None -Some(@LCAnnotation;() // invisible) +Some(@LSAnnotation;()) +Some(@LCAnnotation;()) Some(@LRAnnotation;()) diff --git a/test/files/run/t4788.check b/test/files/run/t4788.check index 172ad90102..618fddfea3 100644 --- a/test/files/run/t4788.check +++ b/test/files/run/t4788.check @@ -1,5 +1,5 @@ Some(@Ljava/lang/Deprecated;()) None -None -Some(@LCAnnotation;() // invisible) +Some(@LSAnnotation;()) +Some(@LCAnnotation;()) Some(@LRAnnotation;()) diff --git a/test/files/run/t5907.scala b/test/files/run/t5907.scala index a005e9fbd3..81fc43e3f5 100644 --- a/test/files/run/t5907.scala +++ b/test/files/run/t5907.scala @@ -86,7 +86,7 @@ object Test extends App { } } -case class C1(implicit x: Int) { +case class C1()(implicit x: Int) { override def toString = s"c1: $x" } case class C2()(y: Int) { diff --git a/test/files/run/t6240a/StepOne.java b/test/files/run/t6240a/StepOne.java index 342d617c79..a9c076c000 100644 --- a/test/files/run/t6240a/StepOne.java +++ b/test/files/run/t6240a/StepOne.java @@ -31,7 +31,7 @@ public class StepOne { // launch StepTwo URL[] launchURLs = new URL[launchPaths.length]; for (int i = 0; i < launchPaths.length; i++) { - launchURLs[i] = new File(launchPaths[i]).toURL(); + launchURLs[i] = new File(launchPaths[i]).toURI().toURL(); } URLClassLoader classLoader = new URLClassLoader(launchURLs, Object.class.getClassLoader()); Class<?> stepTwo = classLoader.loadClass("StepTwo"); diff --git a/test/files/run/t6240b/StepOne.java b/test/files/run/t6240b/StepOne.java index 342d617c79..a9c076c000 100644 --- a/test/files/run/t6240b/StepOne.java +++ b/test/files/run/t6240b/StepOne.java @@ -31,7 +31,7 @@ public class StepOne { // launch StepTwo URL[] launchURLs = new URL[launchPaths.length]; for (int i = 0; i < launchPaths.length; i++) { - launchURLs[i] = new File(launchPaths[i]).toURL(); + launchURLs[i] = new File(launchPaths[i]).toURI().toURL(); } URLClassLoader classLoader = new URLClassLoader(launchURLs, Object.class.getClassLoader()); Class<?> stepTwo = classLoader.loadClass("StepTwo"); diff --git a/test/files/run/t7582.check b/test/files/run/t7582.check index 58d0f19f5d..d0a0975d4c 100644 --- a/test/files/run/t7582.check +++ b/test/files/run/t7582.check @@ -1,5 +1,5 @@ -InlineHolder.scala:9: warning: p1/InlineHolder$::inlinable()I is annotated @inline but could not be inlined: -The callee p1/InlineHolder$::inlinable()I contains the instruction INVOKESTATIC p1/PackageProtectedJava.protectedMethod ()I +InlineHolder_2.scala:9: warning: p1/InlineHolder$::inlinable()I is annotated @inline but could not be inlined: +The callee p1/InlineHolder$::inlinable()I contains the instruction INVOKESTATIC p1/PackageProtectedJava_1.protectedMethod ()I that would cause an IllegalAccessError when inlined into class O$. def x = p1.InlineHolder.inlinable ^ diff --git a/test/files/run/t7582/InlineHolder.scala b/test/files/run/t7582/InlineHolder_2.scala index a18b9effaa..44c68d49b9 100644 --- a/test/files/run/t7582/InlineHolder.scala +++ b/test/files/run/t7582/InlineHolder_2.scala @@ -1,6 +1,6 @@ package p1 { object InlineHolder { - @inline def inlinable = p1.PackageProtectedJava.protectedMethod() + 1 + @inline def inlinable = p1.PackageProtectedJava_1.protectedMethod() + 1 } } diff --git a/test/files/run/t7582/PackageProtectedJava.java b/test/files/run/t7582/PackageProtectedJava_1.java index b7ea2a7676..a3a957dad8 100644 --- a/test/files/run/t7582/PackageProtectedJava.java +++ b/test/files/run/t7582/PackageProtectedJava_1.java @@ -1,6 +1,6 @@ package p1; // public class, protected method -public class PackageProtectedJava { +public class PackageProtectedJava_1 { static final int protectedMethod() { return 1; } } diff --git a/test/files/run/t7582b.check b/test/files/run/t7582b.check index 58d0f19f5d..d0a0975d4c 100644 --- a/test/files/run/t7582b.check +++ b/test/files/run/t7582b.check @@ -1,5 +1,5 @@ -InlineHolder.scala:9: warning: p1/InlineHolder$::inlinable()I is annotated @inline but could not be inlined: -The callee p1/InlineHolder$::inlinable()I contains the instruction INVOKESTATIC p1/PackageProtectedJava.protectedMethod ()I +InlineHolder_2.scala:9: warning: p1/InlineHolder$::inlinable()I is annotated @inline but could not be inlined: +The callee p1/InlineHolder$::inlinable()I contains the instruction INVOKESTATIC p1/PackageProtectedJava_1.protectedMethod ()I that would cause an IllegalAccessError when inlined into class O$. def x = p1.InlineHolder.inlinable ^ diff --git a/test/files/run/t7582b/InlineHolder.scala b/test/files/run/t7582b/InlineHolder_2.scala index a18b9effaa..44c68d49b9 100644 --- a/test/files/run/t7582b/InlineHolder.scala +++ b/test/files/run/t7582b/InlineHolder_2.scala @@ -1,6 +1,6 @@ package p1 { object InlineHolder { - @inline def inlinable = p1.PackageProtectedJava.protectedMethod() + 1 + @inline def inlinable = p1.PackageProtectedJava_1.protectedMethod() + 1 } } diff --git a/test/files/run/t7582b/PackageProtectedJava.java b/test/files/run/t7582b/PackageProtectedJava_1.java index 55a44b79f9..42a2019b91 100644 --- a/test/files/run/t7582b/PackageProtectedJava.java +++ b/test/files/run/t7582b/PackageProtectedJava_1.java @@ -1,6 +1,6 @@ package p1; // protected class, public method -class PackageProtectedJava { +class PackageProtectedJava_1 { public static final int protectedMethod() { return 1; } } diff --git a/test/files/scalacheck/MutableTreeMap.scala b/test/files/scalacheck/MutableTreeMap.scala deleted file mode 100644 index 42b88c56a7..0000000000 --- a/test/files/scalacheck/MutableTreeMap.scala +++ /dev/null @@ -1,345 +0,0 @@ -import java.io._ - -import org.scalacheck._ -import org.scalacheck.Arbitrary._ -import org.scalacheck.Prop.forAll - -import scala.collection.generic.CanBuildFrom -import scala.collection.immutable -import scala.collection.mutable -import scala.util.Try -import scala.collection.mutable.{RedBlackTree => RB} - -package scala.collection.mutable { - - trait Generators { - - def genRedBlackTree[A: Arbitrary: Ordering, B: Arbitrary]: Gen[RB.Tree[A, B]] = { - import org.scalacheck.Gen._ - for { entries <- listOf(arbitrary[(A, B)]) } yield { - val tree = RB.Tree.empty[A, B] - entries.foreach { case (k, v) => RB.insert(tree, k, v) } - tree - } - } - - // Note: in scalacheck 1.12.2 tree maps can be automatically generated without the need for custom - // machinery - def genTreeMap[A: Arbitrary: Ordering, B: Arbitrary]: Gen[mutable.TreeMap[A, B]] = { - import org.scalacheck.Gen._ - for { - keys <- listOf(arbitrary[A]) - values <- listOfN(keys.size, arbitrary[B]) - } yield mutable.TreeMap(keys zip values: _*) - } - - implicit def arbRedBlackTree[A: Arbitrary: Ordering, B: Arbitrary] = Arbitrary(genRedBlackTree[A, B]) - implicit def arbTreeMap[A: Arbitrary: Ordering, B: Arbitrary] = Arbitrary(genTreeMap[A, B]) - } - - object RedBlackTreeProperties extends Properties("mutable.RedBlackTree") with Generators { - type K = String - type V = Int - - property("initial invariants") = forAll { (tree: RB.Tree[K, V]) => - RB.isValid(tree) - } - - property("insert") = forAll { (tree: RB.Tree[K, V], entries: Seq[(K, V)]) => - entries.foreach { case (k, v) => RB.insert(tree, k, v) } - RB.isValid(tree) && entries.toMap.forall { case (k, v) => RB.get(tree, k) == Some(v) } - } - - property("delete") = forAll { (tree: RB.Tree[K, V], ks: Seq[K]) => - ks.foreach { k => RB.delete(tree, k) } - RB.isValid(tree) && ks.toSet.forall { k => RB.get(tree, k) == None } - } - - property("insert & delete") = forAll { (tree: RB.Tree[K, V], ops: Seq[Either[(K, V), K]]) => - ops.foreach { - case Left((k, v)) => RB.insert(tree, k, v) - case Right(k) => RB.delete(tree, k) - } - RB.isValid(tree) - } - - property("min") = forAll { (entries: Seq[(K, V)]) => - val tree = RB.Tree.empty[K, V] - entries.foreach { case (k, v) => RB.insert(tree, k, v) } - RB.min(tree) == (if (entries.isEmpty) None else Some(entries.toMap.min)) - } - - property("max") = forAll { (entries: Seq[(K, V)]) => - val tree = RB.Tree.empty[K, V] - entries.foreach { case (k, v) => RB.insert(tree, k, v) } - RB.max(tree) == (if (entries.isEmpty) None else Some(entries.toMap.max)) - } - } - - object MutableTreeMapProperties extends Properties("mutable.TreeMap") with Generators { - type K = String - type V = Int - - property("get, contains") = forAll { (allEntries: Map[K, V]) => - val entries = allEntries.take(allEntries.size / 2) - - val map = mutable.TreeMap[K, V]() - map ++= entries - - allEntries.forall { case (k, v) => - map.contains(k) == entries.contains(k) && - map.get(k) == entries.get(k) - } - } - - property("size, isEmpty") = forAll { (entries: Map[K, V]) => - val map = mutable.TreeMap[K, V]() - map ++= entries - map.size == entries.size && map.isEmpty == entries.isEmpty - } - - property("+=") = forAll { (map: mutable.TreeMap[K, V], k: K, v: V) => - val oldSize = map.size - val containedKeyBefore = map.contains(k) - val newExpectedSize = if(containedKeyBefore) oldSize else oldSize + 1 - - map += (k -> v) - map.contains(k) && map.get(k) == Some(v) && map.size == newExpectedSize - } - - property("++=") = forAll { (map: mutable.TreeMap[K, V], entries: Seq[(K, V)]) => - val oldEntries = map.toMap - map ++= entries - (oldEntries ++ entries).forall { case (k, v) => map.get(k) == Some(v) } - } - - property("-=") = forAll { (map: mutable.TreeMap[K, V], k: K) => - val oldSize = map.size - val containedKeyBefore = map.contains(k) - val newExpectedSize = if(containedKeyBefore) oldSize - 1 else oldSize - - map -= k - !map.contains(k) && map.get(k) == None && map.size == newExpectedSize - } - - property("--=") = forAll { (map: mutable.TreeMap[K, V], ks: Seq[K]) => - val oldElems = map.toList - map --= ks - val deletedElems = ks.toSet - oldElems.forall { case (k, v) => map.get(k) == (if(deletedElems(k)) None else Some(v)) } - } - - property("iterator") = forAll { (entries: Map[K, V]) => - val map = mutable.TreeMap[K, V]() - map ++= entries - - map.iterator.toSeq == entries.toSeq.sorted - } - - property("iteratorFrom") = forAll { (entries: Map[K, V], k: K) => - val map = mutable.TreeMap[K, V]() - map ++= entries - - map.iteratorFrom(k).toSeq == entries.filterKeys(_ >= k).toSeq.sorted - } - - property("keysIteratorFrom") = forAll { (entries: Map[K, V], k: K) => - val map = mutable.TreeMap[K, V]() - map ++= entries - - map.keysIteratorFrom(k).toSeq == entries.keysIterator.filter(_ >= k).toSeq.sorted - } - - property("valuesIteratorFrom") = forAll { (entries: Map[K, V], k: K) => - val map = mutable.TreeMap[K, V]() - map ++= entries - - map.valuesIteratorFrom(k).toSeq == entries.filterKeys(_ >= k).toSeq.sorted.map(_._2) - } - - property("headOption") = forAll { (map: mutable.TreeMap[K, V]) => - map.headOption == Try(map.iterator.next()).toOption - } - - property("lastOption") = forAll { (map: mutable.TreeMap[K, V]) => - map.lastOption == Try(map.iterator.max).toOption - } - - property("clear") = forAll { (map: mutable.TreeMap[K, V]) => - map.clear() - map.isEmpty && map.size == 0 - } - - property("serializable") = forAll { (map: mutable.TreeMap[K, V]) => - val bytesOut = new ByteArrayOutputStream() - val out = new ObjectOutputStream(bytesOut) - out.writeObject(map) - val bytes = bytesOut.toByteArray - - val in = new ObjectInputStream(new ByteArrayInputStream(bytes)) - val sameMap = in.readObject().asInstanceOf[mutable.TreeMap[K, V]] - map.iterator.toSeq == sameMap.iterator.toSeq - } - - property("same behavior as immutable.TreeMap") = forAll { ops: Seq[Either[(K, V), K]] => - var imap = immutable.TreeMap[K, V]() - val mmap = mutable.TreeMap[K, V]() - - ops.foreach { - case Left((k, v)) => imap += k -> v; mmap += k -> v - case Right(k) => imap -= k; mmap -= k - } - - imap.toList == mmap.toList - } - } - - object MutableTreeMapViewProperties extends Properties("mutable.TreeMapView") with Generators { - type K = String - type V = Int - - implicit val ord = implicitly[Ordering[K]] - - def in(key: K, from: Option[K], until: Option[K]) = - from.fold(true)(_ <= key) && until.fold(true)(_ > key) - - def entriesInView[This <: TraversableOnce[(K, V)], That](entries: This, from: Option[K], until: Option[K])(implicit bf: CanBuildFrom[This, (K, V), That]) = { - (bf.apply(entries) ++= entries.filter { case (k, _) => in(k, from, until) }).result() - } - - property("get, contains") = forAll { (allEntries: Map[K, V], from: Option[K], until: Option[K]) => - val entries = allEntries.take(allEntries.size / 2) - - val map = mutable.TreeMap[K, V]() - map ++= entries - - val mapView = map.rangeImpl(from, until) - allEntries.forall { case (k, v) => - mapView.contains(k) == (in(k, from, until) && entries.contains(k)) && - mapView.get(k) == (if(in(k, from, until)) entries.get(k) else None) - } - } - - property("size, isEmpty") = forAll { (entries: Map[K, V], from: Option[K], until: Option[K]) => - val map = mutable.TreeMap[K, V]() - map ++= entries - - val mapView = map.rangeImpl(from, until) - mapView.size == entriesInView(entries, from, until).size && - mapView.isEmpty == !entries.exists { kv => in(kv._1, from, until) } - } - - property("+=") = forAll { (map: mutable.TreeMap[K, V], k: K, v: V, from: Option[K], until: Option[K]) => - val oldSize = map.size - val containedKeyBefore = map.contains(k) - val newExpectedSize = if(containedKeyBefore) oldSize else oldSize + 1 - val isInRange = in(k, from, until) - - val mapView = map.rangeImpl(from, until) - mapView += (k -> v) - - map.contains(k) && map.get(k) == Some(v) && map.size == newExpectedSize && - mapView.contains(k) == isInRange && - mapView.get(k) == (if(isInRange) Some(v) else None) - } - - property("++=") = forAll { (map: mutable.TreeMap[K, V], entries: Seq[(K, V)], from: Option[K], until: Option[K]) => - val mapView = map.rangeImpl(from, until) - mapView ++= entries - entries.toMap.forall { case (k, v) => - map.get(k) == Some(v) && - mapView.get(k) == (if (in(k, from, until)) Some(v) else None) - } - } - - property("-=") = forAll { (map: mutable.TreeMap[K, V], k: K, from: Option[K], until: Option[K]) => - val oldSize = map.size - val containedKeyBefore = map.contains(k) - val newExpectedSize = if(containedKeyBefore) oldSize - 1 else oldSize - - val mapView = map.rangeImpl(from, until) - mapView -= k - - !map.contains(k) && map.get(k) == None && map.size == newExpectedSize && - !mapView.contains(k) && - mapView.get(k) == None - } - - property("--=") = forAll { (map: mutable.TreeMap[K, V], ks: Seq[K], from: Option[K], until: Option[K]) => - val mapView = map.rangeImpl(from, until) - mapView --= ks - ks.toSet.forall { k => map.get(k) == None && mapView.get(k) == None } - } - - property("iterator") = forAll { (entries: Map[K, V], from: Option[K], until: Option[K]) => - val map = mutable.TreeMap[K, V]() - map ++= entries - - val mapView = map.rangeImpl(from, until) - mapView.iterator.toSeq == entriesInView(entries, from, until).toSeq.sorted - } - - property("iteratorFrom") = forAll { (entries: Map[K, V], k: K, from: Option[K], until: Option[K]) => - val map = mutable.TreeMap[K, V]() - map ++= entries - - val mapView = map.rangeImpl(from, until) - val newLower = Some(from.fold(k)(ord.max(_, k))) - mapView.iteratorFrom(k).toSeq == entriesInView(entries, newLower, until).toSeq.sorted - } - - property("keysIteratorFrom") = forAll { (entries: Map[K, V], k: K, from: Option[K], until: Option[K]) => - val map = mutable.TreeMap[K, V]() - map ++= entries - - val mapView = map.rangeImpl(from, until) - val newLower = Some(from.fold(k)(ord.max(_, k))) - mapView.keysIteratorFrom(k).toSeq == entriesInView(entries, newLower, until).toSeq.sorted.map(_._1) - } - - property("valuesIteratorFrom") = forAll { (entries: Map[K, V], k: K, from: Option[K], until: Option[K]) => - val map = mutable.TreeMap[K, V]() - map ++= entries - - val mapView = map.rangeImpl(from, until) - val newLower = Some(from.fold(k)(ord.max(_, k))) - mapView.valuesIteratorFrom(k).toSeq == entriesInView(entries, newLower, until).toSeq.sorted.map(_._2) - } - - property("headOption") = forAll { (map: mutable.TreeMap[K, V], from: Option[K], until: Option[K]) => - val mapView = map.rangeImpl(from, until) - mapView.headOption == Try(entriesInView(map.iterator, from, until).next()).toOption - } - - property("lastOption") = forAll { (map: mutable.TreeMap[K, V], from: Option[K], until: Option[K]) => - val mapView = map.rangeImpl(from, until) - mapView.lastOption == Try(entriesInView(map.iterator, from, until).max).toOption - } - - property("clear") = forAll { (map: mutable.TreeMap[K, V], from: Option[K], until: Option[K]) => - val mapView = map.rangeImpl(from, until) - mapView.clear() - map.isEmpty && mapView.isEmpty && map.size == 0 && mapView.size == 0 - } - - property("serializable") = forAll { (map: mutable.TreeMap[K, V], from: Option[K], until: Option[K]) => - val mapView = map.rangeImpl(from, until) - - val bytesOut = new ByteArrayOutputStream() - val out = new ObjectOutputStream(bytesOut) - out.writeObject(mapView) - val bytes = bytesOut.toByteArray - - val in = new ObjectInputStream(new ByteArrayInputStream(bytes)) - val sameMapView = in.readObject().asInstanceOf[mutable.TreeMap[K, V]] - mapView.iterator.toSeq == sameMapView.iterator.toSeq - } - } -} - -object Test extends Properties("mutable.TreeMap") { - import scala.collection.mutable._ - include(RedBlackTreeProperties) - include(MutableTreeMapProperties) - include(MutableTreeMapViewProperties) -} diff --git a/test/files/scalacheck/MutableTreeSet.scala b/test/files/scalacheck/MutableTreeSet.scala deleted file mode 100644 index bcb1d0ed94..0000000000 --- a/test/files/scalacheck/MutableTreeSet.scala +++ /dev/null @@ -1,216 +0,0 @@ -import java.io._ - -import org.scalacheck._ -import org.scalacheck.Arbitrary._ -import org.scalacheck.Prop.forAll - -import scala.collection.generic.CanBuildFrom -import scala.collection.immutable -import scala.collection.mutable -import scala.util.Try - -package scala.collection.mutable { - - object MutableTreeSetProperties extends Properties("mutable.TreeSet") { - type K = String - - property("size, isEmpty") = forAll { (elems: Set[K]) => - val set = mutable.TreeSet[K]() - set ++= elems - set.size == elems.size && set.isEmpty == elems.isEmpty - } - - property("+=") = forAll { (set: mutable.TreeSet[K], k: K) => - val oldSize = set.size - val containedKeyBefore = set.contains(k) - val newExpectedSize = if(containedKeyBefore) oldSize else oldSize + 1 - - set += k - set.contains(k) && set.size == newExpectedSize - } - - property("++=") = forAll { (set: mutable.TreeSet[K], ks: Seq[K]) => - val oldElems = set.toList - set ++= ks - (oldElems ++ ks).forall(set.contains) - } - - property("-=") = forAll { (set: mutable.TreeSet[K], k: K) => - val oldSize = set.size - val containedKeyBefore = set.contains(k) - val newExpectedSize = if(containedKeyBefore) oldSize - 1 else oldSize - - set -= k - !set.contains(k) && set.size == newExpectedSize - } - - property("--=") = forAll { (set: mutable.TreeSet[K], ks: Seq[K]) => - val oldElems = set.toList - set --= ks - val deletedElems = ks.toSet - oldElems.forall { e => set.contains(e) == !deletedElems(e) } - } - - property("iterator") = forAll { (ks: Set[K]) => - val set = mutable.TreeSet[K]() - set ++= ks - - set.iterator.toSeq == ks.toSeq.sorted - } - - property("iteratorFrom, keysIteratorFrom") = forAll { (ks: Set[K], k: K) => - val set = mutable.TreeSet[K]() - set ++= ks - - set.iteratorFrom(k).toSeq == ks.filter(_ >= k).toSeq.sorted - set.keysIteratorFrom(k).toSeq == ks.filter(_ >= k).toSeq.sorted - } - - property("headOption") = forAll { (set: mutable.TreeSet[K]) => - set.headOption == Try(set.iterator.next()).toOption - } - - property("lastOption") = forAll { (set: mutable.TreeSet[K]) => - set.lastOption == Try(set.iterator.max).toOption - } - - property("clear") = forAll { (set: mutable.TreeSet[K]) => - set.clear() - set.isEmpty && set.size == 0 - } - - property("serializable") = forAll { (set: mutable.TreeSet[K]) => - val bytesOut = new ByteArrayOutputStream() - val out = new ObjectOutputStream(bytesOut) - out.writeObject(set) - val bytes = bytesOut.toByteArray - - val in = new ObjectInputStream(new ByteArrayInputStream(bytes)) - val sameSet = in.readObject().asInstanceOf[mutable.TreeSet[K]] - set.iterator.toSeq == sameSet.iterator.toSeq - } - - property("same behavior as immutable.TreeMap") = forAll { ops: Seq[Either[K, K]] => - var iset = immutable.TreeSet[K]() - val mset = mutable.TreeSet[K]() - - ops.foreach { - case Left(k) => iset += k; mset += k - case Right(k) => iset -= k; mset -= k - } - - iset.toList == mset.toList - } - } - - object MutableTreeSetViewProperties extends Properties("mutable.TreeSetView") { - type K = String - - implicit val ord = implicitly[Ordering[K]] - - def in(key: K, from: Option[K], until: Option[K]) = - from.fold(true)(_ <= key) && until.fold(true)(_ > key) - - def keysInView[This <: TraversableOnce[K], That](keys: This, from: Option[K], until: Option[K])(implicit bf: CanBuildFrom[This, K, That]) = { - (bf.apply(keys) ++= keys.filter(in(_, from, until))).result() - } - - property("size, isEmpty") = forAll { (keys: Set[K], from: Option[K], until: Option[K]) => - val map = mutable.TreeSet[K]() - map ++= keys - - val mapView = map.rangeImpl(from, until) - mapView.size == keysInView(keys, from, until).size && - mapView.isEmpty == !keys.exists(in(_, from, until)) - } - - property("+=") = forAll { (set: mutable.TreeSet[K], k: K, from: Option[K], until: Option[K]) => - val oldSize = set.size - val containedKeyBefore = set.contains(k) - val newExpectedSize = if(containedKeyBefore) oldSize else oldSize + 1 - val isInRange = in(k, from, until) - - val setView = set.rangeImpl(from, until) - setView += k - - set.contains(k) && set.size == newExpectedSize && setView.contains(k) == isInRange - } - - property("++=") = forAll { (set: mutable.TreeSet[K], ks: Seq[K], from: Option[K], until: Option[K]) => - val setView = set.rangeImpl(from, until) - setView ++= ks - ks.toSet.forall { k => - set.contains(k) && setView.contains(k) == in(k, from, until) - } - } - - property("-=") = forAll { (set: mutable.TreeSet[K], k: K, from: Option[K], until: Option[K]) => - val oldSize = set.size - val containedKeyBefore = set.contains(k) - val newExpectedSize = if(containedKeyBefore) oldSize - 1 else oldSize - - val setView = set.rangeImpl(from, until) - setView -= k - - !set.contains(k) && set.size == newExpectedSize && !setView.contains(k) - } - - property("--=") = forAll { (set: mutable.TreeSet[K], ks: Seq[K], from: Option[K], until: Option[K]) => - val setView = set.rangeImpl(from, until) - setView --= ks - ks.toSet.forall { k => !set.contains(k) && !setView.contains(k) } - } - - property("iterator") = forAll { (ks: Set[K], from: Option[K], until: Option[K]) => - val set = mutable.TreeSet[K]() - set ++= ks - - val setView = set.rangeImpl(from, until) - setView.iterator.toSeq == keysInView(ks, from, until).toSeq.sorted - } - - property("iteratorFrom, keysIteratorFrom") = forAll { (ks: Set[K], k: K, from: Option[K], until: Option[K]) => - val set = mutable.TreeSet[K]() - set ++= ks - - val setView = set.rangeImpl(from, until) - val newLower = Some(from.fold(k)(ord.max(_, k))) - setView.iteratorFrom(k).toSeq == keysInView(ks, newLower, until).toSeq.sorted - } - - property("headOption") = forAll { (set: mutable.TreeSet[K], from: Option[K], until: Option[K]) => - val setView = set.rangeImpl(from, until) - setView.headOption == Try(keysInView(set.iterator, from, until).next()).toOption - } - - property("lastOption") = forAll { (set: mutable.TreeSet[K], from: Option[K], until: Option[K]) => - val setView = set.rangeImpl(from, until) - setView.lastOption == Try(keysInView(set.iterator, from, until).max).toOption - } - - property("clear") = forAll { (set: mutable.TreeSet[K], from: Option[K], until: Option[K]) => - val setView = set.rangeImpl(from, until) - setView.clear() - set.isEmpty && setView.isEmpty && set.size == 0 && setView.size == 0 - } - - property("serializable") = forAll { (set: mutable.TreeSet[K], from: Option[K], until: Option[K]) => - val setView = set.rangeImpl(from, until) - - val bytesOut = new ByteArrayOutputStream() - val out = new ObjectOutputStream(bytesOut) - out.writeObject(setView) - val bytes = bytesOut.toByteArray - - val in = new ObjectInputStream(new ByteArrayInputStream(bytes)) - val sameSetView = in.readObject().asInstanceOf[mutable.TreeSet[K]] - setView.iterator.toSeq == sameSetView.iterator.toSeq - } - } -} - -object Test extends Properties("mutable.TreeSet") { - import scala.collection.mutable._ - include(MutableTreeSetProperties) - include(MutableTreeSetViewProperties) -} diff --git a/test/files/scalacheck/parallel-collections/pc.scala b/test/files/scalacheck/parallel-collections/pc.scala deleted file mode 100644 index a3c1df4054..0000000000 --- a/test/files/scalacheck/parallel-collections/pc.scala +++ /dev/null @@ -1,71 +0,0 @@ -/* - * scalac: -deprecation - * scalacheck: -workers 1 -minSize 0 -maxSize 4000 -minSuccessfulTests 5 - */ - -import org.scalacheck._ -import scala.collection.parallel._ - -// package here to be able access the package-private implementation and shutdown the pool -package scala { - - class ParCollProperties extends Properties("Parallel collections") { - - def includeAllTestsWith(support: TaskSupport) { - // parallel arrays with default task support - include(new mutable.IntParallelArrayCheck(support)) - - // parallel ranges - include(new immutable.ParallelRangeCheck(support)) - - // parallel immutable hash maps (tries) - include(new immutable.IntIntParallelHashMapCheck(support)) - - // parallel immutable hash sets (tries) - include(new immutable.IntParallelHashSetCheck(support)) - - // parallel mutable hash maps (tables) - include(new mutable.IntIntParallelHashMapCheck(support)) - - // parallel ctrie - include(new mutable.IntIntParallelConcurrentTrieMapCheck(support)) - - // parallel mutable hash sets (tables) - include(new mutable.IntParallelHashSetCheck(support)) - - // parallel vectors - include(new immutable.IntParallelVectorCheck(support)) - } - - includeAllTestsWith(defaultTaskSupport) - - val ec = scala.concurrent.ExecutionContext.fromExecutorService(java.util.concurrent.Executors.newFixedThreadPool(5)) - val ectasks = new collection.parallel.ExecutionContextTaskSupport(ec) - includeAllTestsWith(ectasks) - - // no post test hooks in scalacheck, so cannot do: - // ec.shutdown() - - } - -} - - -object Test extends scala.ParCollProperties { - /* - def main(args: Array[String]) { - val pc = new ParCollProperties - org.scalacheck.Test.checkProperties( - org.scalacheck.Test.Params( - rng = new java.util.Random(5134L), - testCallback = new ConsoleReporter(0), - workers = 1, - minSize = 0, - maxSize = 4000, - minSuccessfulTests = 5 - ), - pc - ) - } - */ -} diff --git a/test/files/scalacheck/quasiquotes/Test.scala b/test/files/scalacheck/quasiquotes/Test.scala deleted file mode 100644 index 7a26fa4923..0000000000 --- a/test/files/scalacheck/quasiquotes/Test.scala +++ /dev/null @@ -1,19 +0,0 @@ -import org.scalacheck._ - -object Test extends Properties("quasiquotes") { - include(TermConstructionProps) - include(TermDeconstructionProps) - include(TypeConstructionProps) - include(TypeDeconstructionProps) - include(PatternConstructionProps) - include(PatternDeconstructionProps) - include(LiftableProps) - include(UnliftableProps) - include(ErrorProps) - include(RuntimeErrorProps) - include(DefinitionConstructionProps) - include(DefinitionDeconstructionProps) - include(DeprecationProps) - include(ForProps) - include(TypecheckedProps) -} diff --git a/test/files/scalacheck/redblacktree.scala b/test/files/scalacheck/redblacktree.scala deleted file mode 100644 index 4ded37b35a..0000000000 --- a/test/files/scalacheck/redblacktree.scala +++ /dev/null @@ -1,258 +0,0 @@ -import collection.immutable.{RedBlackTree => RB} -import org.scalacheck._ -import Prop._ -import Gen._ - -/* -Properties of a Red & Black Tree: - -A node is either red or black. -The root is black. (This rule is used in some definitions and not others. Since the -root can always be changed from red to black but not necessarily vice-versa this -rule has little effect on analysis.) -All leaves are black. -Both children of every red node are black. -Every simple path from a given node to any of its descendant leaves contains the same number of black nodes. -*/ - -package scala.collection.immutable.redblacktree { - abstract class RedBlackTreeTest extends Properties("RedBlackTree") { - def minimumSize = 0 - def maximumSize = 5 - - import RB._ - - def nodeAt[A](tree: Tree[String, A], n: Int): Option[(String, A)] = if (n < iterator(tree).size && n >= 0) - Some(iterator(tree).drop(n).next) - else - None - - def treeContains[A](tree: Tree[String, A], key: String) = iterator(tree).map(_._1) contains key - - def height(tree: Tree[_, _]): Int = if (tree eq null) 0 else (1 + math.max(height(tree.left), height(tree.right))) - - def mkTree(level: Int, parentIsBlack: Boolean = false, label: String = ""): Gen[Tree[String, Int]] = - if (level == 0) { - const(null) - } else { - for { - oddOrEven <- choose(0, 2) - tryRed = oddOrEven.sample.get % 2 == 0 // work around arbitrary[Boolean] bug - isRed = parentIsBlack && tryRed - nextLevel = if (isRed) level else level - 1 - left <- mkTree(nextLevel, !isRed, label + "L") - right <- mkTree(nextLevel, !isRed, label + "R") - } yield { - if (isRed) - RedTree(label + "N", 0, left, right) - else - BlackTree(label + "N", 0, left, right) - } - } - - def genTree = for { - depth <- choose(minimumSize, maximumSize + 1) - tree <- mkTree(depth) - } yield tree - - type ModifyParm - def genParm(tree: Tree[String, Int]): Gen[ModifyParm] - def modify(tree: Tree[String, Int], parm: ModifyParm): Tree[String, Int] - - def genInput: Gen[(Tree[String, Int], ModifyParm, Tree[String, Int])] = for { - tree <- genTree - parm <- genParm(tree) - } yield (tree, parm, modify(tree, parm)) - } - - trait RedBlackTreeInvariants { - self: RedBlackTreeTest => - - import RB._ - - def rootIsBlack[A](t: Tree[String, A]) = isBlack(t) - - def areAllLeavesBlack[A](t: Tree[String, A]): Boolean = t match { - case null => isBlack(t) - case ne => List(ne.left, ne.right) forall areAllLeavesBlack - } - - def areRedNodeChildrenBlack[A](t: Tree[String, A]): Boolean = t match { - case RedTree(_, _, left, right) => List(left, right) forall (t => isBlack(t) && areRedNodeChildrenBlack(t)) - case BlackTree(_, _, left, right) => List(left, right) forall areRedNodeChildrenBlack - case null => true - } - - def blackNodesToLeaves[A](t: Tree[String, A]): List[Int] = t match { - case null => List(1) - case BlackTree(_, _, left, right) => List(left, right) flatMap blackNodesToLeaves map (_ + 1) - case RedTree(_, _, left, right) => List(left, right) flatMap blackNodesToLeaves - } - - def areBlackNodesToLeavesEqual[A](t: Tree[String, A]): Boolean = t match { - case null => true - case ne => - ( - blackNodesToLeaves(ne).distinct.size == 1 - && areBlackNodesToLeavesEqual(ne.left) - && areBlackNodesToLeavesEqual(ne.right) - ) - } - - def orderIsPreserved[A](t: Tree[String, A]): Boolean = - iterator(t) zip iterator(t).drop(1) forall { case (x, y) => x._1 < y._1 } - - def heightIsBounded(t: Tree[_, _]): Boolean = height(t) <= (2 * (32 - Integer.numberOfLeadingZeros(count(t) + 2)) - 2) - - def setup(invariant: Tree[String, Int] => Boolean) = forAll(genInput) { case (tree, parm, newTree) => - invariant(newTree) - } - - property("root is black") = setup(rootIsBlack) - property("all leaves are black") = setup(areAllLeavesBlack) - property("children of red nodes are black") = setup(areRedNodeChildrenBlack) - property("black nodes are balanced") = setup(areBlackNodesToLeavesEqual) - property("ordering of keys is preserved") = setup(orderIsPreserved) - property("height is bounded") = setup(heightIsBounded) - } - - object TestInsert extends RedBlackTreeTest with RedBlackTreeInvariants { - import RB._ - - override type ModifyParm = Int - override def genParm(tree: Tree[String, Int]): Gen[ModifyParm] = choose(0, iterator(tree).size + 1) - override def modify(tree: Tree[String, Int], parm: ModifyParm): Tree[String, Int] = update(tree, generateKey(tree, parm), 0, true) - - def generateKey(tree: Tree[String, Int], parm: ModifyParm): String = nodeAt(tree, parm) match { - case Some((key, _)) => key.init.mkString + "MN" - case None => nodeAt(tree, parm - 1) match { - case Some((key, _)) => key.init.mkString + "RN" - case None => "N" - } - } - - property("update adds elements") = forAll(genInput) { case (tree, parm, newTree) => - treeContains(newTree, generateKey(tree, parm)) - } - } - - object TestModify extends RedBlackTreeTest { - import RB._ - - def newValue = 1 - override def minimumSize = 1 - override type ModifyParm = Int - override def genParm(tree: Tree[String, Int]): Gen[ModifyParm] = choose(0, iterator(tree).size) - override def modify(tree: Tree[String, Int], parm: ModifyParm): Tree[String, Int] = nodeAt(tree, parm) map { - case (key, _) => update(tree, key, newValue, true) - } getOrElse tree - - property("update modifies values") = forAll(genInput) { case (tree, parm, newTree) => - nodeAt(tree,parm) forall { case (key, _) => - iterator(newTree) contains (key, newValue) - } - } - } - - object TestDelete extends RedBlackTreeTest with RedBlackTreeInvariants { - import RB._ - - override def minimumSize = 1 - override type ModifyParm = Int - override def genParm(tree: Tree[String, Int]): Gen[ModifyParm] = choose(0, iterator(tree).size) - override def modify(tree: Tree[String, Int], parm: ModifyParm): Tree[String, Int] = nodeAt(tree, parm) map { - case (key, _) => delete(tree, key) - } getOrElse tree - - property("delete removes elements") = forAll(genInput) { case (tree, parm, newTree) => - nodeAt(tree, parm) forall { case (key, _) => - !treeContains(newTree, key) - } - } - } - - object TestRange extends RedBlackTreeTest with RedBlackTreeInvariants { - import RB._ - - override type ModifyParm = (Option[Int], Option[Int]) - override def genParm(tree: Tree[String, Int]): Gen[ModifyParm] = for { - from <- choose(0, iterator(tree).size) - to <- choose(0, iterator(tree).size) suchThat (from <=) - optionalFrom <- oneOf(Some(from), None, Some(from)) // Double Some(n) to get around a bug - optionalTo <- oneOf(Some(to), None, Some(to)) // Double Some(n) to get around a bug - } yield (optionalFrom, optionalTo) - - override def modify(tree: Tree[String, Int], parm: ModifyParm): Tree[String, Int] = { - val from = parm._1 flatMap (nodeAt(tree, _) map (_._1)) - val to = parm._2 flatMap (nodeAt(tree, _) map (_._1)) - rangeImpl(tree, from, to) - } - - property("range boundaries respected") = forAll(genInput) { case (tree, parm, newTree) => - val from = parm._1 flatMap (nodeAt(tree, _) map (_._1)) - val to = parm._2 flatMap (nodeAt(tree, _) map (_._1)) - ("lower boundary" |: (from forall ( key => keysIterator(newTree) forall (key <=)))) && - ("upper boundary" |: (to forall ( key => keysIterator(newTree) forall (key >)))) - } - - property("range returns all elements") = forAll(genInput) { case (tree, parm, newTree) => - val from = parm._1 flatMap (nodeAt(tree, _) map (_._1)) - val to = parm._2 flatMap (nodeAt(tree, _) map (_._1)) - val filteredTree = (keysIterator(tree) - .filter(key => from forall (key >=)) - .filter(key => to forall (key <)) - .toList) - filteredTree == keysIterator(newTree).toList - } - } - - object TestDrop extends RedBlackTreeTest with RedBlackTreeInvariants { - import RB._ - - override type ModifyParm = Int - override def genParm(tree: Tree[String, Int]): Gen[ModifyParm] = choose(0, iterator(tree).size) - override def modify(tree: Tree[String, Int], parm: ModifyParm): Tree[String, Int] = drop(tree, parm) - - property("drop") = forAll(genInput) { case (tree, parm, newTree) => - iterator(tree).drop(parm).toList == iterator(newTree).toList - } - } - - object TestTake extends RedBlackTreeTest with RedBlackTreeInvariants { - import RB._ - - override type ModifyParm = Int - override def genParm(tree: Tree[String, Int]): Gen[ModifyParm] = choose(0, iterator(tree).size) - override def modify(tree: Tree[String, Int], parm: ModifyParm): Tree[String, Int] = take(tree, parm) - - property("take") = forAll(genInput) { case (tree, parm, newTree) => - iterator(tree).take(parm).toList == iterator(newTree).toList - } - } - - object TestSlice extends RedBlackTreeTest with RedBlackTreeInvariants { - import RB._ - - override type ModifyParm = (Int, Int) - override def genParm(tree: Tree[String, Int]): Gen[ModifyParm] = for { - from <- choose(0, iterator(tree).size) - to <- choose(from, iterator(tree).size) - } yield (from, to) - override def modify(tree: Tree[String, Int], parm: ModifyParm): Tree[String, Int] = slice(tree, parm._1, parm._2) - - property("slice") = forAll(genInput) { case (tree, parm, newTree) => - iterator(tree).slice(parm._1, parm._2).toList == iterator(newTree).toList - } - } -} - -object Test extends Properties("RedBlackTree") { - import collection.immutable.redblacktree._ - include(TestInsert) - include(TestModify) - include(TestDelete) - include(TestRange) - include(TestDrop) - include(TestTake) - include(TestSlice) -} diff --git a/test/files/scalacheck/test.scala b/test/files/scalacheck/test.scala deleted file mode 100644 index f69c7fe211..0000000000 --- a/test/files/scalacheck/test.scala +++ /dev/null @@ -1,8 +0,0 @@ -import org.scalacheck._ - - - - - - -object Test extends Properties("Nothing") diff --git a/test/files/scalacheck/testdir/dep.scala b/test/files/scalacheck/testdir/dep.scala deleted file mode 100644 index ab167cbc8b..0000000000 --- a/test/files/scalacheck/testdir/dep.scala +++ /dev/null @@ -1,7 +0,0 @@ - - - - -object Dependency { - val v = 1 -} diff --git a/test/files/scalacheck/testdir/test.scala b/test/files/scalacheck/testdir/test.scala deleted file mode 100644 index d5a5056137..0000000000 --- a/test/files/scalacheck/testdir/test.scala +++ /dev/null @@ -1,10 +0,0 @@ -import org.scalacheck._ - - - - - - -object Test extends Properties("Nothing") { - val d = Dependency.v -} diff --git a/test/junit/scala/collection/mutable/TreeMapTest.scala b/test/junit/scala/collection/mutable/TreeMapTest.scala new file mode 100644 index 0000000000..ce79621c6f --- /dev/null +++ b/test/junit/scala/collection/mutable/TreeMapTest.scala @@ -0,0 +1,34 @@ +package scala.collection.mutable + +import org.junit.Assert.assertEquals +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 + +import scala.collection.mutable + +@RunWith(classOf[JUnit4]) +class TreeMapTest { + + @Test + def rangeMkString() { + + val map = mutable.TreeMap[String, String]() + + List("a", "b", "c", "d").foreach(v => map.put(v, v)) + + val range = map.range("b", "c") + + val valuesRange = range.values + val keysRange = range.keys + + assertEquals(1, valuesRange.size) + assertEquals(1, keysRange.size) + + assertEquals("b", valuesRange.mkString(",")) + assertEquals("b", keysRange.mkString(",")) + assertEquals("b -> b", range.mkString(",")) + + } + +} diff --git a/test/junit/scala/collection/mutable/TreeSetTest.scala b/test/junit/scala/collection/mutable/TreeSetTest.scala new file mode 100644 index 0000000000..50b004befc --- /dev/null +++ b/test/junit/scala/collection/mutable/TreeSetTest.scala @@ -0,0 +1,20 @@ +package scala.collection.mutable + +import org.junit.Assert.assertEquals +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 + +import scala.collection.mutable + + +@RunWith(classOf[JUnit4]) +class TreeSetTest { + + @Test + def rangeMkString() { + + val set = mutable.TreeSet("a", "b", "c", "d") + assertEquals("b", set.range("b", "c").mkString(",")) + } +} diff --git a/test/junit/scala/reflect/internal/PrintersTest.scala b/test/junit/scala/reflect/internal/PrintersTest.scala index 722062ba21..c7cfe0dfbb 100644 --- a/test/junit/scala/reflect/internal/PrintersTest.scala +++ b/test/junit/scala/reflect/internal/PrintersTest.scala @@ -556,7 +556,7 @@ class ClassPrintTest { @Test def testCaseClassWithParams3 = assertPrintedCode(sm""" |{ - | case class X(implicit x: scala.Int, s: scala.Predef.String); + | case class X()(implicit x: scala.Int, s: scala.Predef.String); | () |}""") diff --git a/test/files/scalacheck/CheckCollections.scala b/test/scalacheck/CheckCollections.scala index 329d505b47..d94b71d150 100644 --- a/test/files/scalacheck/CheckCollections.scala +++ b/test/scalacheck/CheckCollections.scala @@ -3,7 +3,7 @@ import org.scalacheck.Prop._ import scala.reflect.internal.util.Collections._ -object Test extends Properties("reflect.internal.util.Collections") { +object CheckCollectionsTest extends Properties("reflect.internal.util.Collections") { def map2ConserveOld[A <: AnyRef, B](xs: List[A], ys: List[B])(f: (A, B) => A): List[A] = if (xs.isEmpty || ys.isEmpty) xs else { diff --git a/test/files/scalacheck/CheckEither.scala b/test/scalacheck/CheckEither.scala index f0ec797045..48b90c1d9b 100644 --- a/test/files/scalacheck/CheckEither.scala +++ b/test/scalacheck/CheckEither.scala @@ -5,7 +5,7 @@ import org.scalacheck.Prop._ import org.scalacheck.Test.check import Function.tupled -object Test extends Properties("Either") { +object CheckEitherTest extends Properties("Either") { implicit def arbitraryEither[X, Y](implicit xa: Arbitrary[X], ya: Arbitrary[Y]): Arbitrary[Either[X, Y]] = Arbitrary[Either[X, Y]](oneOf(arbitrary[X].map(Left(_)), arbitrary[Y].map(Right(_)))) diff --git a/test/files/scalacheck/Ctrie.scala b/test/scalacheck/Ctrie.scala index eef9d06f37..8a24079ad3 100644 --- a/test/files/scalacheck/Ctrie.scala +++ b/test/scalacheck/Ctrie.scala @@ -1,6 +1,3 @@ - - - import org.scalacheck._ import Prop._ import org.scalacheck.Gen._ @@ -16,7 +13,7 @@ case class Wrap(i: Int) { /** A check mainly oriented towards checking snapshot correctness. */ -object Test extends Properties("concurrent.TrieMap") { +object CtrieTest extends Properties("concurrent.TrieMap") { /* generators */ diff --git a/test/files/scalacheck/MutablePriorityQueue.scala b/test/scalacheck/MutablePriorityQueue.scala index 687e2e7c62..1df432d811 100644 --- a/test/files/scalacheck/MutablePriorityQueue.scala +++ b/test/scalacheck/MutablePriorityQueue.scala @@ -3,7 +3,7 @@ import org.scalacheck._ import Prop._ import Arbitrary._ -object Test extends Properties("PriorityQueue") { +object MutablePriorityQueueTest extends Properties("PriorityQueue") { type E = Int // the element type used for most/all of the tests def checkInvariant[A](pq: PriorityQueue[A])(implicit ord: Ordering[A]): Boolean = { diff --git a/test/files/scalacheck/ReflectionExtractors.scala b/test/scalacheck/ReflectionExtractors.scala index a2615feb3e..23076662fd 100644 --- a/test/files/scalacheck/ReflectionExtractors.scala +++ b/test/scalacheck/ReflectionExtractors.scala @@ -6,7 +6,7 @@ import Arbitrary._ import scala.reflect.runtime.universe._ import Flag._ -object Test extends Properties("reflection extractors") { +object ReflectionExtractorsTest extends Properties("reflection extractors") { val genFlag = oneOf( TRAIT, INTERFACE, MUTABLE, MACRO, DEFERRED, ABSTRACT, FINAL, SEALED, @@ -49,4 +49,4 @@ object Test extends Properties("reflection extractors") { priv == mods.privateWithin && annots == mods.annotations } -}
\ No newline at end of file +} diff --git a/test/files/scalacheck/Unrolled.scala b/test/scalacheck/Unrolled.scala index 34604b8667..ad6e9d3cc8 100644 --- a/test/files/scalacheck/Unrolled.scala +++ b/test/scalacheck/Unrolled.scala @@ -4,7 +4,7 @@ import Gen._ import collection.mutable.UnrolledBuffer -object Test extends Properties("UnrolledBuffer") { +object UnrolledTest extends Properties("UnrolledBuffer") { property("concat size") = forAll { (l1: List[Int], l2: List[Int]) => val u1 = new UnrolledBuffer[Int] diff --git a/test/files/scalacheck/array-new.scala b/test/scalacheck/array-new.scala index d8c69ead78..de2df68b3a 100644 --- a/test/files/scalacheck/array-new.scala +++ b/test/scalacheck/array-new.scala @@ -7,7 +7,7 @@ import util._ import Buildable._ import scala.collection.mutable.ArraySeq -object Test extends Properties("Array") { +object ArrayNewTest extends Properties("Array") { /** At this moment the authentic scalacheck Array Builder/Arb bits are commented out. */ implicit def arbArray[T](implicit a: Arbitrary[T], m: ClassTag[T]): Arbitrary[Array[T]] = @@ -34,4 +34,4 @@ object Test extends Properties("Array") { val flattened = arr flatMap (x => x) flatMap (x => x) flattened.length == i1 * i2 * i3 } -}
\ No newline at end of file +} diff --git a/test/files/scalacheck/array-old.scala b/test/scalacheck/array-old.scala index 03c0217180..9532636660 100644 --- a/test/files/scalacheck/array-old.scala +++ b/test/scalacheck/array-old.scala @@ -6,7 +6,7 @@ import util._ import Buildable._ import scala.collection.mutable.ArraySeq -object Test extends Properties("Array") { +object ArrayOldTest extends Properties("Array") { /** At this moment the authentic scalacheck Array Builder/Arb bits are commented out. */ implicit def arbArray[T](implicit a: Arbitrary[T], m: Manifest[T]): Arbitrary[Array[T]] = diff --git a/test/files/scalacheck/concurrent-map.scala b/test/scalacheck/concurrent-map.scala index 7c9b8d4169..0dae7a98bd 100755 --- a/test/files/scalacheck/concurrent-map.scala +++ b/test/scalacheck/concurrent-map.scala @@ -1,6 +1,3 @@ - - - import java.util.concurrent._ import scala.collection._ import scala.collection.JavaConverters._ @@ -8,14 +5,11 @@ import org.scalacheck._ import org.scalacheck.Prop._ import org.scalacheck.Gen._ +object ConcurrentMapTest extends Properties("concurrent.TrieMap") { - -case class Wrap(i: Int) { - override def hashCode = i * 0x9e3775cd -} - - -object Test extends Properties("concurrent.TrieMap") { + case class Wrap(i: Int) { + override def hashCode = i * 0x9e3775cd + } /* generators */ diff --git a/test/files/scalacheck/duration.scala b/test/scalacheck/duration.scala index 5e93638614..89cb9ff955 100644 --- a/test/files/scalacheck/duration.scala +++ b/test/scalacheck/duration.scala @@ -5,7 +5,7 @@ import Arbitrary._ import math._ import concurrent.duration.Duration.fromNanos -object Test extends Properties("Division of Duration by Long") { +object DurationTest extends Properties("Division of Duration by Long") { val weightedLong = frequency( diff --git a/test/files/scalacheck/list.scala b/test/scalacheck/list.scala index 5f6de95237..3531f620f9 100644 --- a/test/files/scalacheck/list.scala +++ b/test/scalacheck/list.scala @@ -2,7 +2,7 @@ import org.scalacheck._ import Prop._ import Gen._ -object Test extends Properties("List") { +object ListTest extends Properties("List") { def sorted(xs: List[Int]) = xs sortWith (_ < _) property("concat size") = forAll { (l1: List[Int], l2: List[Int]) => (l1.size + l2.size) == (l1 ::: l2).size } diff --git a/test/files/scalacheck/nan-ordering.scala b/test/scalacheck/nan-ordering.scala index 05e97a13c9..be57b27178 100644 --- a/test/files/scalacheck/nan-ordering.scala +++ b/test/scalacheck/nan-ordering.scala @@ -2,7 +2,7 @@ import org.scalacheck._ import Gen._ import Prop._ -object Test extends Properties("NaN-Ordering") { +object NanOrderingTest extends Properties("NaN-Ordering") { val specFloats: Gen[Float] = oneOf( Float.MaxValue, diff --git a/test/files/scalacheck/primitive-eqeq.scala b/test/scalacheck/primitive-eqeq.scala index 60fe63c207..fda8087bb0 100644 --- a/test/files/scalacheck/primitive-eqeq.scala +++ b/test/scalacheck/primitive-eqeq.scala @@ -2,7 +2,7 @@ import org.scalacheck._ import Prop._ import Gen._ -object Test extends Properties("==") { +object PrimitiveEqEqTest extends Properties("==") { def equalObjectsEqualHashcodes(x: Any, y: Any) = (x != y) || (x == y && x.## == y.##) // ticket #2087 diff --git a/test/files/scalacheck/range.scala b/test/scalacheck/range.scala index ac24b52f8d..bbd7de2149 100644 --- a/test/files/scalacheck/range.scala +++ b/test/scalacheck/range.scala @@ -288,16 +288,6 @@ object TooLargeRange extends Properties("Too Large Range") { } } -object Test extends Properties("Range") { - import org.scalacheck.{ Test => STest } - - include(NormalRangeTest) - include(InclusiveRangeTest) - include(ByOneRangeTest) - include(InclusiveByOneRangeTest) - include(TooLargeRange) -} - /* Mini-benchmark def testRange(i: Int, j: Int, k: Int) = { var count = 0 diff --git a/test/scalacheck/redblacktree.scala b/test/scalacheck/redblacktree.scala new file mode 100644 index 0000000000..09c3839752 --- /dev/null +++ b/test/scalacheck/redblacktree.scala @@ -0,0 +1,247 @@ +package scala.collection.immutable.redblacktree + +import collection.immutable.{RedBlackTree => RB} +import org.scalacheck._ +import Prop._ +import Gen._ + +/* +Properties of a Red & Black Tree: + +A node is either red or black. +The root is black. (This rule is used in some definitions and not others. Since the +root can always be changed from red to black but not necessarily vice-versa this +rule has little effect on analysis.) +All leaves are black. +Both children of every red node are black. +Every simple path from a given node to any of its descendant leaves contains the same number of black nodes. +*/ + +abstract class RedBlackTreeTest extends Properties("RedBlackTree") { + def minimumSize = 0 + def maximumSize = 5 + + import RB._ + + def nodeAt[A](tree: Tree[String, A], n: Int): Option[(String, A)] = if (n < iterator(tree).size && n >= 0) + Some(iterator(tree).drop(n).next) + else + None + + def treeContains[A](tree: Tree[String, A], key: String) = iterator(tree).map(_._1) contains key + + def height(tree: Tree[_, _]): Int = if (tree eq null) 0 else (1 + math.max(height(tree.left), height(tree.right))) + + def mkTree(level: Int, parentIsBlack: Boolean = false, label: String = ""): Gen[Tree[String, Int]] = + if (level == 0) { + const(null) + } else { + for { + oddOrEven <- choose(0, 2) + tryRed = oddOrEven.sample.get % 2 == 0 // work around arbitrary[Boolean] bug + isRed = parentIsBlack && tryRed + nextLevel = if (isRed) level else level - 1 + left <- mkTree(nextLevel, !isRed, label + "L") + right <- mkTree(nextLevel, !isRed, label + "R") + } yield { + if (isRed) + RedTree(label + "N", 0, left, right) + else + BlackTree(label + "N", 0, left, right) + } + } + + def genTree = for { + depth <- choose(minimumSize, maximumSize + 1) + tree <- mkTree(depth) + } yield tree + + type ModifyParm + def genParm(tree: Tree[String, Int]): Gen[ModifyParm] + def modify(tree: Tree[String, Int], parm: ModifyParm): Tree[String, Int] + + def genInput: Gen[(Tree[String, Int], ModifyParm, Tree[String, Int])] = for { + tree <- genTree + parm <- genParm(tree) + } yield (tree, parm, modify(tree, parm)) +} + +trait RedBlackTreeInvariants { + self: RedBlackTreeTest => + + import RB._ + + def rootIsBlack[A](t: Tree[String, A]) = isBlack(t) + + def areAllLeavesBlack[A](t: Tree[String, A]): Boolean = t match { + case null => isBlack(t) + case ne => List(ne.left, ne.right) forall areAllLeavesBlack + } + + def areRedNodeChildrenBlack[A](t: Tree[String, A]): Boolean = t match { + case RedTree(_, _, left, right) => List(left, right) forall (t => isBlack(t) && areRedNodeChildrenBlack(t)) + case BlackTree(_, _, left, right) => List(left, right) forall areRedNodeChildrenBlack + case null => true + } + + def blackNodesToLeaves[A](t: Tree[String, A]): List[Int] = t match { + case null => List(1) + case BlackTree(_, _, left, right) => List(left, right) flatMap blackNodesToLeaves map (_ + 1) + case RedTree(_, _, left, right) => List(left, right) flatMap blackNodesToLeaves + } + + def areBlackNodesToLeavesEqual[A](t: Tree[String, A]): Boolean = t match { + case null => true + case ne => + ( + blackNodesToLeaves(ne).distinct.size == 1 + && areBlackNodesToLeavesEqual(ne.left) + && areBlackNodesToLeavesEqual(ne.right) + ) + } + + def orderIsPreserved[A](t: Tree[String, A]): Boolean = + iterator(t) zip iterator(t).drop(1) forall { case (x, y) => x._1 < y._1 } + + def heightIsBounded(t: Tree[_, _]): Boolean = height(t) <= (2 * (32 - Integer.numberOfLeadingZeros(count(t) + 2)) - 2) + + def setup(invariant: Tree[String, Int] => Boolean) = forAll(genInput) { case (tree, parm, newTree) => + invariant(newTree) + } + + property("root is black") = setup(rootIsBlack) + property("all leaves are black") = setup(areAllLeavesBlack) + property("children of red nodes are black") = setup(areRedNodeChildrenBlack) + property("black nodes are balanced") = setup(areBlackNodesToLeavesEqual) + property("ordering of keys is preserved") = setup(orderIsPreserved) + property("height is bounded") = setup(heightIsBounded) +} + +object TestInsert extends RedBlackTreeTest with RedBlackTreeInvariants { + import RB._ + + override type ModifyParm = Int + override def genParm(tree: Tree[String, Int]): Gen[ModifyParm] = choose(0, iterator(tree).size + 1) + override def modify(tree: Tree[String, Int], parm: ModifyParm): Tree[String, Int] = update(tree, generateKey(tree, parm), 0, true) + + def generateKey(tree: Tree[String, Int], parm: ModifyParm): String = nodeAt(tree, parm) match { + case Some((key, _)) => key.init.mkString + "MN" + case None => nodeAt(tree, parm - 1) match { + case Some((key, _)) => key.init.mkString + "RN" + case None => "N" + } + } + + property("update adds elements") = forAll(genInput) { case (tree, parm, newTree) => + treeContains(newTree, generateKey(tree, parm)) + } +} + +object TestModify extends RedBlackTreeTest { + import RB._ + + def newValue = 1 + override def minimumSize = 1 + override type ModifyParm = Int + override def genParm(tree: Tree[String, Int]): Gen[ModifyParm] = choose(0, iterator(tree).size) + override def modify(tree: Tree[String, Int], parm: ModifyParm): Tree[String, Int] = nodeAt(tree, parm) map { + case (key, _) => update(tree, key, newValue, true) + } getOrElse tree + + property("update modifies values") = forAll(genInput) { case (tree, parm, newTree) => + nodeAt(tree,parm) forall { case (key, _) => + iterator(newTree) contains (key, newValue) + } + } +} + +object TestDelete extends RedBlackTreeTest with RedBlackTreeInvariants { + import RB._ + + override def minimumSize = 1 + override type ModifyParm = Int + override def genParm(tree: Tree[String, Int]): Gen[ModifyParm] = choose(0, iterator(tree).size) + override def modify(tree: Tree[String, Int], parm: ModifyParm): Tree[String, Int] = nodeAt(tree, parm) map { + case (key, _) => delete(tree, key) + } getOrElse tree + + property("delete removes elements") = forAll(genInput) { case (tree, parm, newTree) => + nodeAt(tree, parm) forall { case (key, _) => + !treeContains(newTree, key) + } + } +} + +object TestRange extends RedBlackTreeTest with RedBlackTreeInvariants { + import RB._ + + override type ModifyParm = (Option[Int], Option[Int]) + override def genParm(tree: Tree[String, Int]): Gen[ModifyParm] = for { + from <- choose(0, iterator(tree).size) + to <- choose(0, iterator(tree).size) suchThat (from <=) + optionalFrom <- oneOf(Some(from), None, Some(from)) // Double Some(n) to get around a bug + optionalTo <- oneOf(Some(to), None, Some(to)) // Double Some(n) to get around a bug + } yield (optionalFrom, optionalTo) + + override def modify(tree: Tree[String, Int], parm: ModifyParm): Tree[String, Int] = { + val from = parm._1 flatMap (nodeAt(tree, _) map (_._1)) + val to = parm._2 flatMap (nodeAt(tree, _) map (_._1)) + rangeImpl(tree, from, to) + } + + property("range boundaries respected") = forAll(genInput) { case (tree, parm, newTree) => + val from = parm._1 flatMap (nodeAt(tree, _) map (_._1)) + val to = parm._2 flatMap (nodeAt(tree, _) map (_._1)) + ("lower boundary" |: (from forall ( key => keysIterator(newTree) forall (key <=)))) && + ("upper boundary" |: (to forall ( key => keysIterator(newTree) forall (key >)))) + } + + property("range returns all elements") = forAll(genInput) { case (tree, parm, newTree) => + val from = parm._1 flatMap (nodeAt(tree, _) map (_._1)) + val to = parm._2 flatMap (nodeAt(tree, _) map (_._1)) + val filteredTree = (keysIterator(tree) + .filter(key => from forall (key >=)) + .filter(key => to forall (key <)) + .toList) + filteredTree == keysIterator(newTree).toList + } +} + +object TestDrop extends RedBlackTreeTest with RedBlackTreeInvariants { + import RB._ + + override type ModifyParm = Int + override def genParm(tree: Tree[String, Int]): Gen[ModifyParm] = choose(0, iterator(tree).size) + override def modify(tree: Tree[String, Int], parm: ModifyParm): Tree[String, Int] = drop(tree, parm) + + property("drop") = forAll(genInput) { case (tree, parm, newTree) => + iterator(tree).drop(parm).toList == iterator(newTree).toList + } +} + +object TestTake extends RedBlackTreeTest with RedBlackTreeInvariants { + import RB._ + + override type ModifyParm = Int + override def genParm(tree: Tree[String, Int]): Gen[ModifyParm] = choose(0, iterator(tree).size) + override def modify(tree: Tree[String, Int], parm: ModifyParm): Tree[String, Int] = take(tree, parm) + + property("take") = forAll(genInput) { case (tree, parm, newTree) => + iterator(tree).take(parm).toList == iterator(newTree).toList + } +} + +object TestSlice extends RedBlackTreeTest with RedBlackTreeInvariants { + import RB._ + + override type ModifyParm = (Int, Int) + override def genParm(tree: Tree[String, Int]): Gen[ModifyParm] = for { + from <- choose(0, iterator(tree).size) + to <- choose(from, iterator(tree).size) + } yield (from, to) + override def modify(tree: Tree[String, Int], parm: ModifyParm): Tree[String, Int] = slice(tree, parm._1, parm._2) + + property("slice") = forAll(genInput) { case (tree, parm, newTree) => + iterator(tree).slice(parm._1, parm._2).toList == iterator(newTree).toList + } +} diff --git a/test/scalacheck/scala/collection/mutable/MutableTreeMap.scala b/test/scalacheck/scala/collection/mutable/MutableTreeMap.scala new file mode 100644 index 0000000000..e3c19b8841 --- /dev/null +++ b/test/scalacheck/scala/collection/mutable/MutableTreeMap.scala @@ -0,0 +1,337 @@ +package scala.collection.mutable + +import java.io._ + +import org.scalacheck._ +import org.scalacheck.Arbitrary._ +import org.scalacheck.Prop.forAll + +import scala.collection.generic.CanBuildFrom +import scala.collection.immutable +import scala.collection.mutable +import scala.util.Try +import scala.collection.mutable.{RedBlackTree => RB} + +trait Generators { + + def genRedBlackTree[A: Arbitrary: Ordering, B: Arbitrary]: Gen[RB.Tree[A, B]] = { + import org.scalacheck.Gen._ + for { entries <- listOf(arbitrary[(A, B)]) } yield { + val tree = RB.Tree.empty[A, B] + entries.foreach { case (k, v) => RB.insert(tree, k, v) } + tree + } + } + + // Note: in scalacheck 1.12.2 tree maps can be automatically generated without the need for custom + // machinery + def genTreeMap[A: Arbitrary: Ordering, B: Arbitrary]: Gen[mutable.TreeMap[A, B]] = { + import org.scalacheck.Gen._ + for { + keys <- listOf(arbitrary[A]) + values <- listOfN(keys.size, arbitrary[B]) + } yield mutable.TreeMap(keys zip values: _*) + } + + implicit def arbRedBlackTree[A: Arbitrary: Ordering, B: Arbitrary] = Arbitrary(genRedBlackTree[A, B]) + implicit def arbTreeMap[A: Arbitrary: Ordering, B: Arbitrary] = Arbitrary(genTreeMap[A, B]) +} + +object RedBlackTreeProperties extends Properties("mutable.RedBlackTree") with Generators { + type K = String + type V = Int + + property("initial invariants") = forAll { (tree: RB.Tree[K, V]) => + RB.isValid(tree) + } + + property("insert") = forAll { (tree: RB.Tree[K, V], entries: Seq[(K, V)]) => + entries.foreach { case (k, v) => RB.insert(tree, k, v) } + RB.isValid(tree) && entries.toMap.forall { case (k, v) => RB.get(tree, k) == Some(v) } + } + + property("delete") = forAll { (tree: RB.Tree[K, V], ks: Seq[K]) => + ks.foreach { k => RB.delete(tree, k) } + RB.isValid(tree) && ks.toSet.forall { k => RB.get(tree, k) == None } + } + + property("insert & delete") = forAll { (tree: RB.Tree[K, V], ops: Seq[Either[(K, V), K]]) => + ops.foreach { + case Left((k, v)) => RB.insert(tree, k, v) + case Right(k) => RB.delete(tree, k) + } + RB.isValid(tree) + } + + property("min") = forAll { (entries: Seq[(K, V)]) => + val tree = RB.Tree.empty[K, V] + entries.foreach { case (k, v) => RB.insert(tree, k, v) } + RB.min(tree) == (if (entries.isEmpty) None else Some(entries.toMap.min)) + } + + property("max") = forAll { (entries: Seq[(K, V)]) => + val tree = RB.Tree.empty[K, V] + entries.foreach { case (k, v) => RB.insert(tree, k, v) } + RB.max(tree) == (if (entries.isEmpty) None else Some(entries.toMap.max)) + } +} + +object MutableTreeMapProperties extends Properties("mutable.TreeMap") with Generators { + type K = String + type V = Int + + property("get, contains") = forAll { (allEntries: Map[K, V]) => + val entries = allEntries.take(allEntries.size / 2) + + val map = mutable.TreeMap[K, V]() + map ++= entries + + allEntries.forall { case (k, v) => + map.contains(k) == entries.contains(k) && + map.get(k) == entries.get(k) + } + } + + property("size, isEmpty") = forAll { (entries: Map[K, V]) => + val map = mutable.TreeMap[K, V]() + map ++= entries + map.size == entries.size && map.isEmpty == entries.isEmpty + } + + property("+=") = forAll { (map: mutable.TreeMap[K, V], k: K, v: V) => + val oldSize = map.size + val containedKeyBefore = map.contains(k) + val newExpectedSize = if(containedKeyBefore) oldSize else oldSize + 1 + + map += (k -> v) + map.contains(k) && map.get(k) == Some(v) && map.size == newExpectedSize + } + + property("++=") = forAll { (map: mutable.TreeMap[K, V], entries: Seq[(K, V)]) => + val oldEntries = map.toMap + map ++= entries + (oldEntries ++ entries).forall { case (k, v) => map.get(k) == Some(v) } + } + + property("-=") = forAll { (map: mutable.TreeMap[K, V], k: K) => + val oldSize = map.size + val containedKeyBefore = map.contains(k) + val newExpectedSize = if(containedKeyBefore) oldSize - 1 else oldSize + + map -= k + !map.contains(k) && map.get(k) == None && map.size == newExpectedSize + } + + property("--=") = forAll { (map: mutable.TreeMap[K, V], ks: Seq[K]) => + val oldElems = map.toList + map --= ks + val deletedElems = ks.toSet + oldElems.forall { case (k, v) => map.get(k) == (if(deletedElems(k)) None else Some(v)) } + } + + property("iterator") = forAll { (entries: Map[K, V]) => + val map = mutable.TreeMap[K, V]() + map ++= entries + + map.iterator.toSeq == entries.toSeq.sorted + } + + property("iteratorFrom") = forAll { (entries: Map[K, V], k: K) => + val map = mutable.TreeMap[K, V]() + map ++= entries + + map.iteratorFrom(k).toSeq == entries.filterKeys(_ >= k).toSeq.sorted + } + + property("keysIteratorFrom") = forAll { (entries: Map[K, V], k: K) => + val map = mutable.TreeMap[K, V]() + map ++= entries + + map.keysIteratorFrom(k).toSeq == entries.keysIterator.filter(_ >= k).toSeq.sorted + } + + property("valuesIteratorFrom") = forAll { (entries: Map[K, V], k: K) => + val map = mutable.TreeMap[K, V]() + map ++= entries + + map.valuesIteratorFrom(k).toSeq == entries.filterKeys(_ >= k).toSeq.sorted.map(_._2) + } + + property("headOption") = forAll { (map: mutable.TreeMap[K, V]) => + map.headOption == Try(map.iterator.next()).toOption + } + + property("lastOption") = forAll { (map: mutable.TreeMap[K, V]) => + map.lastOption == Try(map.iterator.max).toOption + } + + property("clear") = forAll { (map: mutable.TreeMap[K, V]) => + map.clear() + map.isEmpty && map.size == 0 + } + + property("serializable") = forAll { (map: mutable.TreeMap[K, V]) => + val bytesOut = new ByteArrayOutputStream() + val out = new ObjectOutputStream(bytesOut) + out.writeObject(map) + val bytes = bytesOut.toByteArray + + val in = new ObjectInputStream(new ByteArrayInputStream(bytes)) + val sameMap = in.readObject().asInstanceOf[mutable.TreeMap[K, V]] + map.iterator.toSeq == sameMap.iterator.toSeq + } + + property("same behavior as immutable.TreeMap") = forAll { ops: Seq[Either[(K, V), K]] => + var imap = immutable.TreeMap[K, V]() + val mmap = mutable.TreeMap[K, V]() + + ops.foreach { + case Left((k, v)) => imap += k -> v; mmap += k -> v + case Right(k) => imap -= k; mmap -= k + } + + imap.toList == mmap.toList + } +} + +object MutableTreeMapViewProperties extends Properties("mutable.TreeMapView") with Generators { + type K = String + type V = Int + + implicit val ord = implicitly[Ordering[K]] + + def in(key: K, from: Option[K], until: Option[K]) = + from.fold(true)(_ <= key) && until.fold(true)(_ > key) + + def entriesInView[This <: TraversableOnce[(K, V)], That](entries: This, from: Option[K], until: Option[K])(implicit bf: CanBuildFrom[This, (K, V), That]) = { + (bf.apply(entries) ++= entries.filter { case (k, _) => in(k, from, until) }).result() + } + + property("get, contains") = forAll { (allEntries: Map[K, V], from: Option[K], until: Option[K]) => + val entries = allEntries.take(allEntries.size / 2) + + val map = mutable.TreeMap[K, V]() + map ++= entries + + val mapView = map.rangeImpl(from, until) + allEntries.forall { case (k, v) => + mapView.contains(k) == (in(k, from, until) && entries.contains(k)) && + mapView.get(k) == (if(in(k, from, until)) entries.get(k) else None) + } + } + + property("size, isEmpty") = forAll { (entries: Map[K, V], from: Option[K], until: Option[K]) => + val map = mutable.TreeMap[K, V]() + map ++= entries + + val mapView = map.rangeImpl(from, until) + mapView.size == entriesInView(entries, from, until).size && + mapView.isEmpty == !entries.exists { kv => in(kv._1, from, until) } + } + + property("+=") = forAll { (map: mutable.TreeMap[K, V], k: K, v: V, from: Option[K], until: Option[K]) => + val oldSize = map.size + val containedKeyBefore = map.contains(k) + val newExpectedSize = if(containedKeyBefore) oldSize else oldSize + 1 + val isInRange = in(k, from, until) + + val mapView = map.rangeImpl(from, until) + mapView += (k -> v) + + map.contains(k) && map.get(k) == Some(v) && map.size == newExpectedSize && + mapView.contains(k) == isInRange && + mapView.get(k) == (if(isInRange) Some(v) else None) + } + + property("++=") = forAll { (map: mutable.TreeMap[K, V], entries: Seq[(K, V)], from: Option[K], until: Option[K]) => + val mapView = map.rangeImpl(from, until) + mapView ++= entries + entries.toMap.forall { case (k, v) => + map.get(k) == Some(v) && + mapView.get(k) == (if (in(k, from, until)) Some(v) else None) + } + } + + property("-=") = forAll { (map: mutable.TreeMap[K, V], k: K, from: Option[K], until: Option[K]) => + val oldSize = map.size + val containedKeyBefore = map.contains(k) + val newExpectedSize = if(containedKeyBefore) oldSize - 1 else oldSize + + val mapView = map.rangeImpl(from, until) + mapView -= k + + !map.contains(k) && map.get(k) == None && map.size == newExpectedSize && + !mapView.contains(k) && + mapView.get(k) == None + } + + property("--=") = forAll { (map: mutable.TreeMap[K, V], ks: Seq[K], from: Option[K], until: Option[K]) => + val mapView = map.rangeImpl(from, until) + mapView --= ks + ks.toSet.forall { k => map.get(k) == None && mapView.get(k) == None } + } + + property("iterator") = forAll { (entries: Map[K, V], from: Option[K], until: Option[K]) => + val map = mutable.TreeMap[K, V]() + map ++= entries + + val mapView = map.rangeImpl(from, until) + mapView.iterator.toSeq == entriesInView(entries, from, until).toSeq.sorted + } + + property("iteratorFrom") = forAll { (entries: Map[K, V], k: K, from: Option[K], until: Option[K]) => + val map = mutable.TreeMap[K, V]() + map ++= entries + + val mapView = map.rangeImpl(from, until) + val newLower = Some(from.fold(k)(ord.max(_, k))) + mapView.iteratorFrom(k).toSeq == entriesInView(entries, newLower, until).toSeq.sorted + } + + property("keysIteratorFrom") = forAll { (entries: Map[K, V], k: K, from: Option[K], until: Option[K]) => + val map = mutable.TreeMap[K, V]() + map ++= entries + + val mapView = map.rangeImpl(from, until) + val newLower = Some(from.fold(k)(ord.max(_, k))) + mapView.keysIteratorFrom(k).toSeq == entriesInView(entries, newLower, until).toSeq.sorted.map(_._1) + } + + property("valuesIteratorFrom") = forAll { (entries: Map[K, V], k: K, from: Option[K], until: Option[K]) => + val map = mutable.TreeMap[K, V]() + map ++= entries + + val mapView = map.rangeImpl(from, until) + val newLower = Some(from.fold(k)(ord.max(_, k))) + mapView.valuesIteratorFrom(k).toSeq == entriesInView(entries, newLower, until).toSeq.sorted.map(_._2) + } + + property("headOption") = forAll { (map: mutable.TreeMap[K, V], from: Option[K], until: Option[K]) => + val mapView = map.rangeImpl(from, until) + mapView.headOption == Try(entriesInView(map.iterator, from, until).next()).toOption + } + + property("lastOption") = forAll { (map: mutable.TreeMap[K, V], from: Option[K], until: Option[K]) => + val mapView = map.rangeImpl(from, until) + mapView.lastOption == Try(entriesInView(map.iterator, from, until).max).toOption + } + + property("clear") = forAll { (map: mutable.TreeMap[K, V], from: Option[K], until: Option[K]) => + val mapView = map.rangeImpl(from, until) + mapView.clear() + map.isEmpty && mapView.isEmpty && map.size == 0 && mapView.size == 0 + } + + property("serializable") = forAll { (map: mutable.TreeMap[K, V], from: Option[K], until: Option[K]) => + val mapView = map.rangeImpl(from, until) + + val bytesOut = new ByteArrayOutputStream() + val out = new ObjectOutputStream(bytesOut) + out.writeObject(mapView) + val bytes = bytesOut.toByteArray + + val in = new ObjectInputStream(new ByteArrayInputStream(bytes)) + val sameMapView = in.readObject().asInstanceOf[mutable.TreeMap[K, V]] + mapView.iterator.toSeq == sameMapView.iterator.toSeq + } +} diff --git a/test/scalacheck/scala/collection/mutable/MutableTreeSet.scala b/test/scalacheck/scala/collection/mutable/MutableTreeSet.scala new file mode 100644 index 0000000000..d2f5a238c0 --- /dev/null +++ b/test/scalacheck/scala/collection/mutable/MutableTreeSet.scala @@ -0,0 +1,209 @@ +package scala.collection.mutable + +import java.io._ + +import org.scalacheck._ +import org.scalacheck.Arbitrary._ +import org.scalacheck.Prop.forAll + +import scala.collection.generic.CanBuildFrom +import scala.collection.immutable +import scala.collection.mutable +import scala.util.Try + +object MutableTreeSetProperties extends Properties("mutable.TreeSet") { + type K = String + + property("size, isEmpty") = forAll { (elems: Set[K]) => + val set = mutable.TreeSet[K]() + set ++= elems + set.size == elems.size && set.isEmpty == elems.isEmpty + } + + property("+=") = forAll { (set: mutable.TreeSet[K], k: K) => + val oldSize = set.size + val containedKeyBefore = set.contains(k) + val newExpectedSize = if(containedKeyBefore) oldSize else oldSize + 1 + + set += k + set.contains(k) && set.size == newExpectedSize + } + + property("++=") = forAll { (set: mutable.TreeSet[K], ks: Seq[K]) => + val oldElems = set.toList + set ++= ks + (oldElems ++ ks).forall(set.contains) + } + + property("-=") = forAll { (set: mutable.TreeSet[K], k: K) => + val oldSize = set.size + val containedKeyBefore = set.contains(k) + val newExpectedSize = if(containedKeyBefore) oldSize - 1 else oldSize + + set -= k + !set.contains(k) && set.size == newExpectedSize + } + + property("--=") = forAll { (set: mutable.TreeSet[K], ks: Seq[K]) => + val oldElems = set.toList + set --= ks + val deletedElems = ks.toSet + oldElems.forall { e => set.contains(e) == !deletedElems(e) } + } + + property("iterator") = forAll { (ks: Set[K]) => + val set = mutable.TreeSet[K]() + set ++= ks + + set.iterator.toSeq == ks.toSeq.sorted + } + + property("iteratorFrom, keysIteratorFrom") = forAll { (ks: Set[K], k: K) => + val set = mutable.TreeSet[K]() + set ++= ks + + set.iteratorFrom(k).toSeq == ks.filter(_ >= k).toSeq.sorted + set.keysIteratorFrom(k).toSeq == ks.filter(_ >= k).toSeq.sorted + } + + property("headOption") = forAll { (set: mutable.TreeSet[K]) => + set.headOption == Try(set.iterator.next()).toOption + } + + property("lastOption") = forAll { (set: mutable.TreeSet[K]) => + set.lastOption == Try(set.iterator.max).toOption + } + + property("clear") = forAll { (set: mutable.TreeSet[K]) => + set.clear() + set.isEmpty && set.size == 0 + } + + property("serializable") = forAll { (set: mutable.TreeSet[K]) => + val bytesOut = new ByteArrayOutputStream() + val out = new ObjectOutputStream(bytesOut) + out.writeObject(set) + val bytes = bytesOut.toByteArray + + val in = new ObjectInputStream(new ByteArrayInputStream(bytes)) + val sameSet = in.readObject().asInstanceOf[mutable.TreeSet[K]] + set.iterator.toSeq == sameSet.iterator.toSeq + } + + property("same behavior as immutable.TreeMap") = forAll { ops: Seq[Either[K, K]] => + var iset = immutable.TreeSet[K]() + val mset = mutable.TreeSet[K]() + + ops.foreach { + case Left(k) => iset += k; mset += k + case Right(k) => iset -= k; mset -= k + } + + iset.toList == mset.toList + } +} + +object MutableTreeSetViewProperties extends Properties("mutable.TreeSetView") { + type K = String + + implicit val ord = implicitly[Ordering[K]] + + def in(key: K, from: Option[K], until: Option[K]) = + from.fold(true)(_ <= key) && until.fold(true)(_ > key) + + def keysInView[This <: TraversableOnce[K], That](keys: This, from: Option[K], until: Option[K])(implicit bf: CanBuildFrom[This, K, That]) = { + (bf.apply(keys) ++= keys.filter(in(_, from, until))).result() + } + + property("size, isEmpty") = forAll { (keys: Set[K], from: Option[K], until: Option[K]) => + val map = mutable.TreeSet[K]() + map ++= keys + + val mapView = map.rangeImpl(from, until) + mapView.size == keysInView(keys, from, until).size && + mapView.isEmpty == !keys.exists(in(_, from, until)) + } + + property("+=") = forAll { (set: mutable.TreeSet[K], k: K, from: Option[K], until: Option[K]) => + val oldSize = set.size + val containedKeyBefore = set.contains(k) + val newExpectedSize = if(containedKeyBefore) oldSize else oldSize + 1 + val isInRange = in(k, from, until) + + val setView = set.rangeImpl(from, until) + setView += k + + set.contains(k) && set.size == newExpectedSize && setView.contains(k) == isInRange + } + + property("++=") = forAll { (set: mutable.TreeSet[K], ks: Seq[K], from: Option[K], until: Option[K]) => + val setView = set.rangeImpl(from, until) + setView ++= ks + ks.toSet.forall { k => + set.contains(k) && setView.contains(k) == in(k, from, until) + } + } + + property("-=") = forAll { (set: mutable.TreeSet[K], k: K, from: Option[K], until: Option[K]) => + val oldSize = set.size + val containedKeyBefore = set.contains(k) + val newExpectedSize = if(containedKeyBefore) oldSize - 1 else oldSize + + val setView = set.rangeImpl(from, until) + setView -= k + + !set.contains(k) && set.size == newExpectedSize && !setView.contains(k) + } + + property("--=") = forAll { (set: mutable.TreeSet[K], ks: Seq[K], from: Option[K], until: Option[K]) => + val setView = set.rangeImpl(from, until) + setView --= ks + ks.toSet.forall { k => !set.contains(k) && !setView.contains(k) } + } + + property("iterator") = forAll { (ks: Set[K], from: Option[K], until: Option[K]) => + val set = mutable.TreeSet[K]() + set ++= ks + + val setView = set.rangeImpl(from, until) + setView.iterator.toSeq == keysInView(ks, from, until).toSeq.sorted + } + + property("iteratorFrom, keysIteratorFrom") = forAll { (ks: Set[K], k: K, from: Option[K], until: Option[K]) => + val set = mutable.TreeSet[K]() + set ++= ks + + val setView = set.rangeImpl(from, until) + val newLower = Some(from.fold(k)(ord.max(_, k))) + setView.iteratorFrom(k).toSeq == keysInView(ks, newLower, until).toSeq.sorted + } + + property("headOption") = forAll { (set: mutable.TreeSet[K], from: Option[K], until: Option[K]) => + val setView = set.rangeImpl(from, until) + setView.headOption == Try(keysInView(set.iterator, from, until).next()).toOption + } + + property("lastOption") = forAll { (set: mutable.TreeSet[K], from: Option[K], until: Option[K]) => + val setView = set.rangeImpl(from, until) + setView.lastOption == Try(keysInView(set.iterator, from, until).max).toOption + } + + property("clear") = forAll { (set: mutable.TreeSet[K], from: Option[K], until: Option[K]) => + val setView = set.rangeImpl(from, until) + setView.clear() + set.isEmpty && setView.isEmpty && set.size == 0 && setView.size == 0 + } + + property("serializable") = forAll { (set: mutable.TreeSet[K], from: Option[K], until: Option[K]) => + val setView = set.rangeImpl(from, until) + + val bytesOut = new ByteArrayOutputStream() + val out = new ObjectOutputStream(bytesOut) + out.writeObject(setView) + val bytes = bytesOut.toByteArray + + val in = new ObjectInputStream(new ByteArrayInputStream(bytes)) + val sameSetView = in.readObject().asInstanceOf[mutable.TreeSet[K]] + setView.iterator.toSeq == sameSetView.iterator.toSeq + } +} diff --git a/test/files/scalacheck/parallel-collections/IntOperators.scala b/test/scalacheck/scala/collection/parallel/IntOperators.scala index 4a74b91da8..c7f43b6526 100644 --- a/test/files/scalacheck/parallel-collections/IntOperators.scala +++ b/test/scalacheck/scala/collection/parallel/IntOperators.scala @@ -108,22 +108,3 @@ trait IntSeqOperators extends IntOperators with SeqOperators[Int] { List(-4, -3, -2, -1) ) } - - - - - - - - - - - - - - - - - - - diff --git a/test/files/scalacheck/parallel-collections/IntValues.scala b/test/scalacheck/scala/collection/parallel/IntValues.scala index cab60ead76..cab60ead76 100644 --- a/test/files/scalacheck/parallel-collections/IntValues.scala +++ b/test/scalacheck/scala/collection/parallel/IntValues.scala diff --git a/test/files/scalacheck/parallel-collections/Operators.scala b/test/scalacheck/scala/collection/parallel/Operators.scala index 72133a5009..72133a5009 100644 --- a/test/files/scalacheck/parallel-collections/Operators.scala +++ b/test/scalacheck/scala/collection/parallel/Operators.scala diff --git a/test/files/scalacheck/parallel-collections/PairOperators.scala b/test/scalacheck/scala/collection/parallel/PairOperators.scala index fe851114be..fe851114be 100644 --- a/test/files/scalacheck/parallel-collections/PairOperators.scala +++ b/test/scalacheck/scala/collection/parallel/PairOperators.scala diff --git a/test/files/scalacheck/parallel-collections/PairValues.scala b/test/scalacheck/scala/collection/parallel/PairValues.scala index 864dad2425..864dad2425 100644 --- a/test/files/scalacheck/parallel-collections/PairValues.scala +++ b/test/scalacheck/scala/collection/parallel/PairValues.scala diff --git a/test/files/scalacheck/parallel-collections/ParallelHashTrieCheck.scala b/test/scalacheck/scala/collection/parallel/ParallelHashTrieCheck.scala index 9e29be5429..e1df95e051 100644 --- a/test/files/scalacheck/parallel-collections/ParallelHashTrieCheck.scala +++ b/test/scalacheck/scala/collection/parallel/ParallelHashTrieCheck.scala @@ -47,7 +47,7 @@ abstract class ParallelHashMapCheck[K, V](tp: String) extends ParallelMapCheck[K } -class IntIntParallelHashMapCheck(val tasksupport: TaskSupport) extends ParallelHashMapCheck[Int, Int]("Int, Int") +abstract class IntIntParallelHashMapCheck(val tasksupport: TaskSupport, descriptor: String) extends ParallelHashMapCheck[Int, Int](s"Int, Int ($descriptor)") with PairOperators[Int, Int] with PairValues[Int, Int] { @@ -109,7 +109,7 @@ abstract class ParallelHashSetCheck[T](tp: String) extends ParallelSetCheck[T](" } -class IntParallelHashSetCheck(val tasksupport: TaskSupport) extends ParallelHashSetCheck[Int]("Int") +abstract class IntParallelHashSetCheck(val tasksupport: TaskSupport, descriptor: String) extends ParallelHashSetCheck[Int](s"Int ($descriptor)") with IntOperators with IntValues { diff --git a/test/files/scalacheck/parallel-collections/ParallelIterableCheck.scala b/test/scalacheck/scala/collection/parallel/ParallelIterableCheck.scala index 7e7ef2ce1b..7e7ef2ce1b 100644 --- a/test/files/scalacheck/parallel-collections/ParallelIterableCheck.scala +++ b/test/scalacheck/scala/collection/parallel/ParallelIterableCheck.scala diff --git a/test/files/scalacheck/parallel-collections/ParallelMapCheck1.scala b/test/scalacheck/scala/collection/parallel/ParallelMapCheck1.scala index 50aa4ad0c7..50aa4ad0c7 100644 --- a/test/files/scalacheck/parallel-collections/ParallelMapCheck1.scala +++ b/test/scalacheck/scala/collection/parallel/ParallelMapCheck1.scala diff --git a/test/files/scalacheck/parallel-collections/ParallelRangeCheck.scala b/test/scalacheck/scala/collection/parallel/ParallelRangeCheck.scala index a80d1a27a1..5b783fadf2 100644 --- a/test/files/scalacheck/parallel-collections/ParallelRangeCheck.scala +++ b/test/scalacheck/scala/collection/parallel/ParallelRangeCheck.scala @@ -17,7 +17,7 @@ import scala.collection.parallel.ops._ -class ParallelRangeCheck(val tasksupport: TaskSupport) extends ParallelSeqCheck[Int]("ParallelRange[Int]") with ops.IntSeqOperators { +abstract class ParallelRangeCheck(val tasksupport: TaskSupport, descriptor: String) extends ParallelSeqCheck[Int](s"ParallelRange[Int] ($descriptor)") with ops.IntSeqOperators { // ForkJoinTasks.defaultForkJoinPool.setMaximumPoolSize(Runtime.getRuntime.availableProcessors * 2) // ForkJoinTasks.defaultForkJoinPool.setParallelism(Runtime.getRuntime.availableProcessors * 2) diff --git a/test/files/scalacheck/parallel-collections/ParallelSeqCheck.scala b/test/scalacheck/scala/collection/parallel/ParallelSeqCheck.scala index 48c3d3f745..48c3d3f745 100644 --- a/test/files/scalacheck/parallel-collections/ParallelSeqCheck.scala +++ b/test/scalacheck/scala/collection/parallel/ParallelSeqCheck.scala diff --git a/test/files/scalacheck/parallel-collections/ParallelSetCheck.scala b/test/scalacheck/scala/collection/parallel/ParallelSetCheck.scala index c22dddf96d..c22dddf96d 100644 --- a/test/files/scalacheck/parallel-collections/ParallelSetCheck.scala +++ b/test/scalacheck/scala/collection/parallel/ParallelSetCheck.scala diff --git a/test/files/scalacheck/parallel-collections/ParallelVectorCheck.scala b/test/scalacheck/scala/collection/parallel/immutable/ParallelVectorCheck.scala index bbebd51919..1afcf2ce4c 100644 --- a/test/files/scalacheck/parallel-collections/ParallelVectorCheck.scala +++ b/test/scalacheck/scala/collection/parallel/immutable/ParallelVectorCheck.scala @@ -53,7 +53,7 @@ abstract class ParallelVectorCheck[T](tp: String) extends collection.parallel.Pa -class IntParallelVectorCheck(val tasksupport: TaskSupport) extends ParallelVectorCheck[Int]("Int") with IntSeqOperators with IntValues { +abstract class IntParallelVectorCheck(val tasksupport: TaskSupport, descriptor: String) extends ParallelVectorCheck[Int](s"Int ($descriptor)") with IntSeqOperators with IntValues { override def instances(vals: Seq[Gen[Int]]) = oneOf(super.instances(vals), sized { sz => (0 until sz).toArray.toSeq }, sized { sz => diff --git a/test/files/scalacheck/parallel-collections/ParallelArrayCheck.scala b/test/scalacheck/scala/collection/parallel/mutable/ParallelArrayCheck.scala index 605c16857a..39370f8c38 100644 --- a/test/files/scalacheck/parallel-collections/ParallelArrayCheck.scala +++ b/test/scalacheck/scala/collection/parallel/mutable/ParallelArrayCheck.scala @@ -53,20 +53,10 @@ abstract class ParallelArrayCheck[T](tp: String) extends ParallelSeqCheck[T]("Pa } -class IntParallelArrayCheck(val tasksupport: TaskSupport) extends ParallelArrayCheck[Int]("Int") with IntSeqOperators with IntValues { +abstract class IntParallelArrayCheck(val tasksupport: TaskSupport, descriptor: String) extends ParallelArrayCheck[Int](s"Int ($descriptor)") with IntSeqOperators with IntValues { override def instances(vals: Seq[Gen[Int]]) = oneOf(super.instances(vals), sized { sz => (0 until sz).toArray.toSeq }, sized { sz => (-sz until 0).toArray.toSeq }) } - - - - - - - - - - diff --git a/test/files/scalacheck/parallel-collections/ParallelArrayTest.scala b/test/scalacheck/scala/collection/parallel/mutable/ParallelArrayTest.scala index db2b1ea01e..db2b1ea01e 100644 --- a/test/files/scalacheck/parallel-collections/ParallelArrayTest.scala +++ b/test/scalacheck/scala/collection/parallel/mutable/ParallelArrayTest.scala diff --git a/test/files/scalacheck/parallel-collections/ParallelArrayViewCheck.scala b/test/scalacheck/scala/collection/parallel/mutable/ParallelArrayViewCheck.scala index fb09a5bbb7..fb09a5bbb7 100644 --- a/test/files/scalacheck/parallel-collections/ParallelArrayViewCheck.scala +++ b/test/scalacheck/scala/collection/parallel/mutable/ParallelArrayViewCheck.scala diff --git a/test/files/scalacheck/parallel-collections/ParallelCtrieCheck.scala b/test/scalacheck/scala/collection/parallel/mutable/ParallelCtrieCheck.scala index cf15afb3b9..ebdcf78bea 100644 --- a/test/files/scalacheck/parallel-collections/ParallelCtrieCheck.scala +++ b/test/scalacheck/scala/collection/parallel/mutable/ParallelCtrieCheck.scala @@ -48,7 +48,7 @@ abstract class ParallelConcurrentTrieMapCheck[K, V](tp: String) extends Parallel } -class IntIntParallelConcurrentTrieMapCheck(val tasksupport: TaskSupport) extends ParallelConcurrentTrieMapCheck[Int, Int]("Int, Int") +abstract class IntIntParallelConcurrentTrieMapCheck(val tasksupport: TaskSupport, descriptor: String) extends ParallelConcurrentTrieMapCheck[Int, Int](s"Int, Int ($descriptor)") with PairOperators[Int, Int] with PairValues[Int, Int] { diff --git a/test/files/scalacheck/parallel-collections/ParallelHashMapCheck.scala b/test/scalacheck/scala/collection/parallel/mutable/ParallelHashMapCheck.scala index 34b3f33de2..06fdb66080 100644 --- a/test/files/scalacheck/parallel-collections/ParallelHashMapCheck.scala +++ b/test/scalacheck/scala/collection/parallel/mutable/ParallelHashMapCheck.scala @@ -47,7 +47,7 @@ abstract class ParallelHashMapCheck[K, V](tp: String) extends ParallelMapCheck[K } -class IntIntParallelHashMapCheck(val tasksupport: TaskSupport) extends ParallelHashMapCheck[Int, Int]("Int, Int") +abstract class IntIntParallelHashMapCheck(val tasksupport: TaskSupport, descriptor: String) extends ParallelHashMapCheck[Int, Int](s"Int, Int ($descriptor)") with PairOperators[Int, Int] with PairValues[Int, Int] { diff --git a/test/files/scalacheck/parallel-collections/ParallelHashSetCheck.scala b/test/scalacheck/scala/collection/parallel/mutable/ParallelHashSetCheck.scala index 91de2472a7..a968ed053f 100644 --- a/test/files/scalacheck/parallel-collections/ParallelHashSetCheck.scala +++ b/test/scalacheck/scala/collection/parallel/mutable/ParallelHashSetCheck.scala @@ -47,7 +47,7 @@ abstract class ParallelHashSetCheck[T](tp: String) extends ParallelSetCheck[T](" } -class IntParallelHashSetCheck(val tasksupport: TaskSupport) extends ParallelHashSetCheck[Int]("Int") +abstract class IntParallelHashSetCheck(val tasksupport: TaskSupport, descriptor: String) extends ParallelHashSetCheck[Int](s"Int ($descriptor)") with IntOperators with IntValues { diff --git a/test/scalacheck/scala/pc.scala b/test/scalacheck/scala/pc.scala new file mode 100644 index 0000000000..10d0643be8 --- /dev/null +++ b/test/scalacheck/scala/pc.scala @@ -0,0 +1,61 @@ +// package here to be able access the package-private implementation and shutdown the pool +package scala + +import org.scalacheck._ +import scala.collection.parallel._ + +class ParCollProperties extends Properties("Parallel collections") { + + def includeAllTestsWith(support: TaskSupport, descriptor: String) { + // parallel arrays with default task support + include(new mutable.IntParallelArrayCheck(support, descriptor) { }) + + // parallel ranges + include(new immutable.ParallelRangeCheck(support, descriptor) { }) + + // parallel immutable hash maps (tries) + include(new immutable.IntIntParallelHashMapCheck(support, descriptor) { }) + + // parallel immutable hash sets (tries) + include(new immutable.IntParallelHashSetCheck(support, descriptor) { }) + + // parallel mutable hash maps (tables) + include(new mutable.IntIntParallelHashMapCheck(support, descriptor) { }) + + // parallel ctrie + include(new mutable.IntIntParallelConcurrentTrieMapCheck(support, descriptor) { }) + + // parallel mutable hash sets (tables) + include(new mutable.IntParallelHashSetCheck(support, descriptor) { }) + + // parallel vectors + include(new immutable.IntParallelVectorCheck(support, descriptor) { }) + } + + includeAllTestsWith(defaultTaskSupport, "defaultTaskSupport") + + val ec = scala.concurrent.ExecutionContext.fromExecutorService(java.util.concurrent.Executors.newFixedThreadPool(5)) + val ectasks = new collection.parallel.ExecutionContextTaskSupport(ec) + includeAllTestsWith(ectasks, "ectasks") + + // no post test hooks in scalacheck, so cannot do: + // ec.shutdown() + +} + +/* +def main(args: Array[String]) { + val pc = new ParCollProperties + org.scalacheck.Test.checkProperties( + org.scalacheck.Test.Params( + rng = new java.util.Random(5134L), + testCallback = new ConsoleReporter(0), + workers = 1, + minSize = 0, + maxSize = 4000, + minSuccessfulTests = 5 + ), + pc + ) +} +*/ diff --git a/test/files/scalacheck/quasiquotes/ArbitraryTreesAndNames.scala b/test/scalacheck/scala/reflect/quasiquotes/ArbitraryTreesAndNames.scala index ab1056dd86..2f2be70403 100644 --- a/test/files/scalacheck/quasiquotes/ArbitraryTreesAndNames.scala +++ b/test/scalacheck/scala/reflect/quasiquotes/ArbitraryTreesAndNames.scala @@ -1,3 +1,5 @@ +package scala.reflect.quasiquotes + import org.scalacheck._, Prop._, Gen._, Arbitrary._ import scala.reflect.runtime.universe._, internal._, Flag._ diff --git a/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala b/test/scalacheck/scala/reflect/quasiquotes/DefinitionConstructionProps.scala index 4ab8bb8531..9d35c9229d 100644 --- a/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala +++ b/test/scalacheck/scala/reflect/quasiquotes/DefinitionConstructionProps.scala @@ -1,3 +1,5 @@ +package scala.reflect.quasiquotes + import org.scalacheck._, Prop._, Gen._, Arbitrary._ import scala.reflect.runtime.universe._, Flag._, internal.reificationSupport.ScalaDot diff --git a/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala b/test/scalacheck/scala/reflect/quasiquotes/DefinitionDeconstructionProps.scala index 2c0e100b5a..54ec966836 100644 --- a/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala +++ b/test/scalacheck/scala/reflect/quasiquotes/DefinitionDeconstructionProps.scala @@ -1,3 +1,5 @@ +package scala.reflect.quasiquotes + import org.scalacheck._, Prop._, Gen._, Arbitrary._ import scala.reflect.runtime.universe._, Flag._, internal.reificationSupport.SyntacticClassDef diff --git a/test/files/scalacheck/quasiquotes/DeprecationProps.scala b/test/scalacheck/scala/reflect/quasiquotes/DeprecationProps.scala index 8e1601cf9d..9662586aef 100644 --- a/test/files/scalacheck/quasiquotes/DeprecationProps.scala +++ b/test/scalacheck/scala/reflect/quasiquotes/DeprecationProps.scala @@ -1,3 +1,5 @@ +package scala.reflect.quasiquotes + import org.scalacheck._, Prop._, Gen._, Arbitrary._ import scala.reflect.runtime.universe._ diff --git a/test/files/scalacheck/quasiquotes/ErrorProps.scala b/test/scalacheck/scala/reflect/quasiquotes/ErrorProps.scala index 0c24149372..4f1c61eeff 100644 --- a/test/files/scalacheck/quasiquotes/ErrorProps.scala +++ b/test/scalacheck/scala/reflect/quasiquotes/ErrorProps.scala @@ -1,3 +1,5 @@ +package scala.reflect.quasiquotes + import org.scalacheck._, Prop._, Gen._, Arbitrary._ object ErrorProps extends QuasiquoteProperties("errors") { diff --git a/test/files/scalacheck/quasiquotes/ForProps.scala b/test/scalacheck/scala/reflect/quasiquotes/ForProps.scala index b14d345edd..d19ead8792 100644 --- a/test/files/scalacheck/quasiquotes/ForProps.scala +++ b/test/scalacheck/scala/reflect/quasiquotes/ForProps.scala @@ -1,3 +1,5 @@ +package scala.reflect.quasiquotes + import org.scalacheck._, Prop._, Gen._, Arbitrary._ import scala.reflect.runtime.universe._, Flag._, internal.reificationSupport._ diff --git a/test/files/scalacheck/quasiquotes/LiftableProps.scala b/test/scalacheck/scala/reflect/quasiquotes/LiftableProps.scala index a4c57ac359..90e5adba58 100644 --- a/test/files/scalacheck/quasiquotes/LiftableProps.scala +++ b/test/scalacheck/scala/reflect/quasiquotes/LiftableProps.scala @@ -1,3 +1,5 @@ +package scala.reflect.quasiquotes + import org.scalacheck._, Prop._, Gen._, Arbitrary._ import scala.reflect.runtime.universe._, Flag._ diff --git a/test/files/scalacheck/quasiquotes/PatternConstructionProps.scala b/test/scalacheck/scala/reflect/quasiquotes/PatternConstructionProps.scala index 7ed95fa984..e62a004adc 100644 --- a/test/files/scalacheck/quasiquotes/PatternConstructionProps.scala +++ b/test/scalacheck/scala/reflect/quasiquotes/PatternConstructionProps.scala @@ -1,3 +1,5 @@ +package scala.reflect.quasiquotes + import org.scalacheck._, Prop._, Gen._, Arbitrary._ import scala.reflect.runtime.universe._, Flag._ diff --git a/test/files/scalacheck/quasiquotes/PatternDeconstructionProps.scala b/test/scalacheck/scala/reflect/quasiquotes/PatternDeconstructionProps.scala index ad3266bcec..182e905c04 100644 --- a/test/files/scalacheck/quasiquotes/PatternDeconstructionProps.scala +++ b/test/scalacheck/scala/reflect/quasiquotes/PatternDeconstructionProps.scala @@ -1,3 +1,5 @@ +package scala.reflect.quasiquotes + import org.scalacheck._, Prop._, Gen._, Arbitrary._ import scala.reflect.runtime.universe._, Flag._ diff --git a/test/files/scalacheck/quasiquotes/QuasiquoteProperties.scala b/test/scalacheck/scala/reflect/quasiquotes/QuasiquoteProperties.scala index 6132244227..13e231891d 100644 --- a/test/files/scalacheck/quasiquotes/QuasiquoteProperties.scala +++ b/test/scalacheck/scala/reflect/quasiquotes/QuasiquoteProperties.scala @@ -1,9 +1,11 @@ +package scala.reflect.quasiquotes + import org.scalacheck._, Prop._, Gen._, Arbitrary._ import scala.tools.reflect.{ToolBox, ToolBoxError} import scala.reflect.runtime.currentMirror import scala.reflect.runtime.universe._, Flag._, internal.reificationSupport.setSymbol -class QuasiquoteProperties(name: String) extends Properties(name) with ArbitraryTreesAndNames with Helpers +abstract class QuasiquoteProperties(name: String) extends Properties(name) with ArbitraryTreesAndNames with Helpers trait Helpers { /** Runs a code block and returns proof confirmation diff --git a/test/files/scalacheck/quasiquotes/RuntimeErrorProps.scala b/test/scalacheck/scala/reflect/quasiquotes/RuntimeErrorProps.scala index 40fb42d63c..4e389f1560 100644 --- a/test/files/scalacheck/quasiquotes/RuntimeErrorProps.scala +++ b/test/scalacheck/scala/reflect/quasiquotes/RuntimeErrorProps.scala @@ -1,3 +1,5 @@ +package scala.reflect.quasiquotes + import org.scalacheck._, Prop._, Gen._, Arbitrary._ import scala.reflect.runtime.universe._, Flag._ diff --git a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala b/test/scalacheck/scala/reflect/quasiquotes/TermConstructionProps.scala index 409f07037e..61faaefe51 100644 --- a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala +++ b/test/scalacheck/scala/reflect/quasiquotes/TermConstructionProps.scala @@ -1,3 +1,5 @@ +package scala.reflect.quasiquotes + import org.scalacheck._, Prop._, Gen._, Arbitrary._ import scala.reflect.runtime.universe._, Flag._ diff --git a/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala b/test/scalacheck/scala/reflect/quasiquotes/TermDeconstructionProps.scala index 07e8f3faac..73bfba41bc 100644 --- a/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala +++ b/test/scalacheck/scala/reflect/quasiquotes/TermDeconstructionProps.scala @@ -1,3 +1,5 @@ +package scala.reflect.quasiquotes + import org.scalacheck._, Prop._, Gen._, Arbitrary._ import scala.reflect.runtime.universe._, Flag._ diff --git a/test/files/scalacheck/quasiquotes/TypeConstructionProps.scala b/test/scalacheck/scala/reflect/quasiquotes/TypeConstructionProps.scala index 27ad4c50e9..c96018b317 100644 --- a/test/files/scalacheck/quasiquotes/TypeConstructionProps.scala +++ b/test/scalacheck/scala/reflect/quasiquotes/TypeConstructionProps.scala @@ -1,3 +1,5 @@ +package scala.reflect.quasiquotes + import org.scalacheck._, Prop._, Gen._, Arbitrary._ import scala.reflect.runtime.universe._, Flag._, internal.reificationSupport.ScalaDot diff --git a/test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala b/test/scalacheck/scala/reflect/quasiquotes/TypeDeconstructionProps.scala index 7572b27b52..fc8554d61f 100644 --- a/test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala +++ b/test/scalacheck/scala/reflect/quasiquotes/TypeDeconstructionProps.scala @@ -1,3 +1,5 @@ +package scala.reflect.quasiquotes + import org.scalacheck._, Prop._, Gen._, Arbitrary._ import scala.reflect.runtime.universe._, Flag._ diff --git a/test/files/scalacheck/quasiquotes/TypecheckedProps.scala b/test/scalacheck/scala/reflect/quasiquotes/TypecheckedProps.scala index 07bff40f13..4646388c86 100644 --- a/test/files/scalacheck/quasiquotes/TypecheckedProps.scala +++ b/test/scalacheck/scala/reflect/quasiquotes/TypecheckedProps.scala @@ -1,3 +1,5 @@ +package scala.reflect.quasiquotes + import org.scalacheck._, Prop._, Gen._, Arbitrary._ import scala.reflect.runtime.universe._, Flag._, internal.reificationSupport._ diff --git a/test/files/scalacheck/quasiquotes/UnliftableProps.scala b/test/scalacheck/scala/reflect/quasiquotes/UnliftableProps.scala index 659b18edab..4c2f2280ca 100644 --- a/test/files/scalacheck/quasiquotes/UnliftableProps.scala +++ b/test/scalacheck/scala/reflect/quasiquotes/UnliftableProps.scala @@ -1,3 +1,5 @@ +package scala.reflect.quasiquotes + import org.scalacheck._, Prop._, Gen._, Arbitrary._ import scala.reflect.runtime.universe._, Flag._ diff --git a/test/scaladoc/scalacheck/CommentFactoryTest.scala b/test/scalacheck/scala/tools/nsc/scaladoc/CommentFactoryTest.scala index d30b78087c..afee3eed86 100644 --- a/test/scaladoc/scalacheck/CommentFactoryTest.scala +++ b/test/scalacheck/scala/tools/nsc/scaladoc/CommentFactoryTest.scala @@ -1,3 +1,5 @@ +package scala.tools.nsc.scaladoc + import org.scalacheck._ import org.scalacheck.Prop._ @@ -34,7 +36,7 @@ class Factory(val g: Global, val s: doc.Settings) parse(s, "", scala.tools.nsc.util.NoPosition, null).body } -object Test extends Properties("CommentFactory") { +object CommentFactoryTest extends Properties("CommentFactory") { val factory = { val settings = new doc.Settings((str: String) => {}) val reporter = new scala.tools.nsc.reporters.ConsoleReporter(settings) diff --git a/test/scaladoc/scalacheck/HtmlFactoryTest.scala b/test/scalacheck/scala/tools/nsc/scaladoc/HtmlFactoryTest.scala index ab2c058a03..740eb68d99 100644 --- a/test/scaladoc/scalacheck/HtmlFactoryTest.scala +++ b/test/scalacheck/scala/tools/nsc/scaladoc/HtmlFactoryTest.scala @@ -1,3 +1,5 @@ +package scala.tools.nsc.scaladoc + import org.scalacheck._ import org.scalacheck.Prop._ @@ -22,7 +24,7 @@ object XMLUtil { } } -object Test extends Properties("HtmlFactory") { +object HtmlFactoryTest extends Properties("HtmlFactory") { final val RESOURCES = "test/scaladoc/resources/" diff --git a/test/scaladoc/scalacheck/IndexScriptTest.scala b/test/scalacheck/scala/tools/nsc/scaladoc/IndexScriptTest.scala index 61f462186d..fb4dc55c98 100644 --- a/test/scaladoc/scalacheck/IndexScriptTest.scala +++ b/test/scalacheck/scala/tools/nsc/scaladoc/IndexScriptTest.scala @@ -1,3 +1,5 @@ +package scala.tools.nsc.scaladoc + import org.scalacheck._ import org.scalacheck.Prop._ @@ -5,7 +7,7 @@ import scala.tools.nsc.doc import scala.tools.nsc.doc.html.page.IndexScript import java.net.{URLClassLoader, URLDecoder} -object Test extends Properties("IndexScript") { +object IndexScriptTest extends Properties("IndexScript") { def getClasspath = { // these things can be tricky diff --git a/test/files/scalacheck/scan.scala b/test/scalacheck/scan.scala index fc214d739c..4d2abafdef 100644 --- a/test/files/scalacheck/scan.scala +++ b/test/scalacheck/scan.scala @@ -2,10 +2,7 @@ import org.scalacheck._ import Prop._ import Gen._ - - - -object Test extends Properties("TraversableLike.scanLeft") { +object ScanTest extends Properties("TraversableLike.scanLeft") { property("scanLeft") = forAll { (xs: List[Int], z: Int) => { val sums = xs.scanLeft(z)(_ + _) (xs.size == 0) || sums.zip(sums.tail).map(x => x._2 - x._1) == xs diff --git a/test/files/scalacheck/substringTests.scala b/test/scalacheck/substringTests.scala index 76260b9dd2..df3d18be0b 100644 --- a/test/files/scalacheck/substringTests.scala +++ b/test/scalacheck/substringTests.scala @@ -1,7 +1,6 @@ import org.scalacheck._ - -object Test extends Properties("String") { +object SubstringTest extends Properties("String") { property("startsWith") = Prop.forAll((a: String, b: String) => (a+b).startsWith(a)) property("endsWith") = Prop.forAll((a: String, b: String) => (a+b).endsWith(b)) diff --git a/test/files/scalacheck/t2460.scala b/test/scalacheck/t2460.scala index ab2911447a..42ff3ecfe6 100644 --- a/test/files/scalacheck/t2460.scala +++ b/test/scalacheck/t2460.scala @@ -3,7 +3,7 @@ import org.scalacheck.Properties import org.scalacheck.{Test => SCTest} import org.scalacheck.Gen -object Test extends Properties("Regex : Ticket 2460") { +object SI2460Test extends Properties("Regex : Ticket 2460") { val vowel = Gen.oneOf("a", "z") diff --git a/test/files/scalacheck/t4147.scala b/test/scalacheck/t4147.scala index 72f6e9afd5..c58abb99f0 100644 --- a/test/files/scalacheck/t4147.scala +++ b/test/scalacheck/t4147.scala @@ -6,7 +6,7 @@ import org.scalacheck.Gen import collection.mutable -object Test extends Properties("Mutable TreeSet") { +object SI4147Test extends Properties("Mutable TreeSet") { val generator = Gen.listOfN(1000, Gen.chooseNum(0, 1000)) diff --git a/test/files/scalacheck/treemap.scala b/test/scalacheck/treemap.scala index f672637c57..6978ca3145 100644 --- a/test/files/scalacheck/treemap.scala +++ b/test/scalacheck/treemap.scala @@ -6,7 +6,7 @@ import Arbitrary._ import util._ import Buildable._ -object Test extends Properties("TreeMap") { +object TreeMapTest extends Properties("TreeMap") { def genTreeMap[A: Arbitrary: Ordering, B: Arbitrary]: Gen[TreeMap[A, B]] = for { keys <- listOf(arbitrary[A]) @@ -36,7 +36,7 @@ object Test extends Properties("TreeMap") { val values = (1 to highest).reverse val subject = TreeMap(values zip values: _*) val it = subject.iterator - try { while (it.hasNext) it.next; true } catch { case _ => false } + try { while (it.hasNext) it.next; true } catch { case _: Throwable => false } } property("sorted") = forAll { (subject: TreeMap[Int, String]) => (subject.size >= 3) ==> { diff --git a/test/files/scalacheck/treeset.scala b/test/scalacheck/treeset.scala index 4b9b77dd7e..ec6de40693 100644 --- a/test/files/scalacheck/treeset.scala +++ b/test/scalacheck/treeset.scala @@ -5,7 +5,7 @@ import Gen._ import Arbitrary._ import util._ -object Test extends Properties("TreeSet") { +object TreeSetTest extends Properties("TreeSet") { def genTreeSet[A: Arbitrary: Ordering]: Gen[TreeSet[A]] = for { elements <- listOf(arbitrary[A]) @@ -34,7 +34,7 @@ object Test extends Properties("TreeSet") { val values = (1 to highest).reverse val subject = TreeSet(values: _*) val it = subject.iterator - try { while (it.hasNext) it.next; true } catch { case _ => false } + try { while (it.hasNext) it.next; true } catch { case _: Throwable => false } } property("sorted") = forAll { (subject: TreeSet[Int]) => (subject.size >= 3) ==> { diff --git a/test/scaladoc/scalacheck/HtmlFactoryTest.flags b/test/scaladoc/scalacheck/HtmlFactoryTest.flags deleted file mode 100644 index b2264ec4f4..0000000000 --- a/test/scaladoc/scalacheck/HtmlFactoryTest.flags +++ /dev/null @@ -1 +0,0 @@ --encoding UTF-8
\ No newline at end of file diff --git a/versions.properties b/versions.properties index 24ca670f26..72ae971ac9 100644 --- a/versions.properties +++ b/versions.properties @@ -16,14 +16,12 @@ scala.binary.version=2.12 # external modules shipped with distribution, as specified by scala-library-all's pom scala-xml.version.number=1.0.6 -scala-parser-combinators.version.number=1.0.4 +scala-parser-combinators.version.number=1.0.5 scala-swing.version.number=2.0.0-M2 scala-swing.version.osgi=2.0.0.M2 -jline.version=2.14.1 +jline.version=2.14.3 # this one is shaded and embedded in scala-compiler.jar scala-asm.version=5.1.0-scala-1 # external modules, used internally (not shipped) -partest.version.number=1.0.17 - -scalacheck.version.number=1.11.6 +partest.version.number=1.1.0 |