summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--META-INF/MANIFEST.MF51
-rw-r--r--README.md2
-rw-r--r--bincompat-backward.whitelist.conf214
-rw-r--r--bincompat-forward.whitelist.conf478
-rw-r--r--build.sbt166
-rw-r--r--doc/LICENSE.md1
-rw-r--r--doc/licenses/bsd_scalacheck.txt32
-rw-r--r--project/MiMa.scala8
-rw-r--r--project/Osgi.scala19
-rw-r--r--project/PartestUtil.scala5
-rw-r--r--spec/03-types.md10
-rw-r--r--spec/04-basic-declarations-and-definitions.md2
-rw-r--r--spec/05-classes-and-objects.md6
-rw-r--r--spec/06-expressions.md14
-rw-r--r--spec/11-annotations.md8
-rw-r--r--spec/12-the-scala-standard-library.md8
-rw-r--r--spec/README.md4
-rw-r--r--src/build/genprod.scala2
-rw-r--r--src/compiler/rootdoc.txt7
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala2
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Scanners.scala58
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala13
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala1
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BCodeSyncAndTry.scala48
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/opt/InlineInfoAttribute.scala2
-rw-r--r--src/compiler/scala/tools/nsc/javac/JavaScanners.scala23
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala8
-rw-r--r--src/compiler/scala/tools/nsc/transform/Mixin.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/UnCurry.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala4
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala21
-rw-r--r--src/library/scala/Array.scala3
-rw-r--r--src/library/scala/Immutable.scala2
-rw-r--r--src/library/scala/Int.scala4
-rw-r--r--src/library/scala/Option.scala2
-rw-r--r--src/library/scala/Product1.scala2
-rw-r--r--src/library/scala/Product10.scala2
-rw-r--r--src/library/scala/Product11.scala2
-rw-r--r--src/library/scala/Product12.scala2
-rw-r--r--src/library/scala/Product13.scala2
-rw-r--r--src/library/scala/Product14.scala2
-rw-r--r--src/library/scala/Product15.scala2
-rw-r--r--src/library/scala/Product16.scala2
-rw-r--r--src/library/scala/Product17.scala2
-rw-r--r--src/library/scala/Product18.scala2
-rw-r--r--src/library/scala/Product19.scala2
-rw-r--r--src/library/scala/Product2.scala2
-rw-r--r--src/library/scala/Product20.scala2
-rw-r--r--src/library/scala/Product21.scala2
-rw-r--r--src/library/scala/Product22.scala2
-rw-r--r--src/library/scala/Product3.scala2
-rw-r--r--src/library/scala/Product4.scala2
-rw-r--r--src/library/scala/Product5.scala2
-rw-r--r--src/library/scala/Product6.scala2
-rw-r--r--src/library/scala/Product7.scala2
-rw-r--r--src/library/scala/Product8.scala2
-rw-r--r--src/library/scala/Product9.scala2
-rw-r--r--src/library/scala/collection/Iterator.scala27
-rw-r--r--src/library/scala/collection/Parallelizable.scala2
-rw-r--r--src/library/scala/collection/SetLike.scala4
-rw-r--r--src/library/scala/collection/SortedSet.scala2
-rw-r--r--src/library/scala/collection/generic/GenTraversableFactory.scala2
-rw-r--r--src/library/scala/collection/immutable/List.scala4
-rw-r--r--src/library/scala/collection/immutable/SetProxy.scala3
-rw-r--r--src/library/scala/collection/immutable/SortedSet.scala2
-rw-r--r--src/library/scala/collection/immutable/Vector.scala9
-rw-r--r--src/library/scala/collection/mutable/ArrayBuffer.scala2
-rw-r--r--src/library/scala/collection/mutable/HashTable.scala2
-rw-r--r--src/library/scala/collection/mutable/History.scala2
-rw-r--r--src/library/scala/collection/mutable/PriorityQueue.scala2
-rw-r--r--src/library/scala/collection/mutable/ResizableArray.scala2
-rw-r--r--src/library/scala/collection/mutable/ReusableBuilder.scala4
-rw-r--r--src/library/scala/collection/parallel/TaskSupport.scala4
-rw-r--r--src/library/scala/collection/parallel/immutable/ParRange.scala1
-rw-r--r--src/library/scala/concurrent/duration/Duration.scala14
-rw-r--r--src/library/scala/concurrent/impl/ExecutionContextImpl.scala2
-rw-r--r--src/library/scala/concurrent/impl/Promise.scala2
-rw-r--r--src/library/scala/io/Source.scala2
-rw-r--r--src/library/scala/math/BigInt.scala4
-rw-r--r--src/library/scala/reflect/ClassManifestDeprecatedApis.scala4
-rw-r--r--src/library/scala/sys/process/ProcessBuilder.scala2
-rw-r--r--src/library/scala/sys/process/package.scala4
-rw-r--r--src/library/scala/util/Either.scala2
-rw-r--r--src/library/scala/util/Properties.scala6
-rw-r--r--src/manual/scala/man1/scalac.scala4
-rw-r--r--src/manual/scala/man1/scalap.scala2
-rw-r--r--src/partest-extras/scala/org/scalacheck/Arbitrary.scala433
-rw-r--r--src/partest-extras/scala/org/scalacheck/Commands.scala146
-rw-r--r--src/partest-extras/scala/org/scalacheck/Commands2.scala150
-rw-r--r--src/partest-extras/scala/org/scalacheck/Gen.scala813
-rw-r--r--src/partest-extras/scala/org/scalacheck/Prop.scala953
-rw-r--r--src/partest-extras/scala/org/scalacheck/Properties.scala82
-rw-r--r--src/partest-extras/scala/org/scalacheck/ScalaCheckFramework.scala93
-rw-r--r--src/partest-extras/scala/org/scalacheck/Shrink.scala215
-rw-r--r--src/partest-extras/scala/org/scalacheck/Test.scala372
-rw-r--r--src/partest-extras/scala/org/scalacheck/util/Buildable.scala77
-rw-r--r--src/partest-extras/scala/org/scalacheck/util/CmdLineParser.scala41
-rw-r--r--src/partest-extras/scala/org/scalacheck/util/ConsoleReporter.scala44
-rw-r--r--src/partest-extras/scala/org/scalacheck/util/FreqMap.scala65
-rw-r--r--src/partest-extras/scala/org/scalacheck/util/Pretty.scala129
-rw-r--r--src/partest-extras/scala/tools/partest/JavapTest.scala2
-rw-r--r--src/partest-extras/scala/tools/partest/ReplTest.scala2
-rw-r--r--src/reflect/scala/reflect/api/Internals.scala2
-rw-r--r--src/reflect/scala/reflect/api/StandardDefinitions.scala2
-rw-r--r--src/reflect/scala/reflect/api/Types.scala2
-rw-r--r--src/reflect/scala/reflect/internal/AnnotationInfos.scala2
-rw-r--r--src/reflect/scala/reflect/internal/BaseTypeSeqs.scala2
-rw-r--r--src/reflect/scala/reflect/internal/Constants.scala4
-rw-r--r--src/reflect/scala/reflect/internal/Names.scala4
-rw-r--r--src/reflect/scala/reflect/internal/Symbols.scala2
-rw-r--r--src/reflect/scala/reflect/internal/TreeGen.scala2
-rw-r--r--src/reflect/scala/reflect/internal/tpe/FindMembers.scala4
-rw-r--r--src/reflect/scala/reflect/internal/util/SourceFile.scala23
-rw-r--r--src/reflect/scala/reflect/runtime/JavaUniverse.scala2
-rw-r--r--src/repl/scala/tools/nsc/interpreter/InteractiveReader.scala2
-rw-r--r--src/repl/scala/tools/nsc/interpreter/Phased.scala2
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/ScaladocAnalyzer.scala106
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/base/MemberLookupBase.scala2
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DotDiagramGenerator.scala2
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/html/resource/lib/scheduler.js4
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.css2
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/model/Entity.scala8
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala4
-rw-r--r--test/files/jvm/future-spec/FutureTests.scala2
-rw-r--r--test/files/jvm/serialization-new.check8
-rw-r--r--test/files/jvm/serialization.check8
-rw-r--r--test/files/neg/t9953.check6
-rw-r--r--test/files/neg/t9953.flags1
-rw-r--r--test/files/neg/t9953.scala13
-rw-r--r--test/files/pos/t6734.scala17
-rw-r--r--test/files/pos/t6978.flags1
-rw-r--r--test/files/pos/t6978/J.java5
-rw-r--r--test/files/pos/t6978/S.scala7
-rw-r--r--test/files/run/t10032.check82
-rw-r--r--test/files/run/t10032.scala164
-rw-r--r--test/files/run/t10059/A.java3
-rw-r--r--test/files/run/t10059/Test.scala9
-rw-r--r--test/files/run/t8433.check2
-rw-r--r--test/files/run/t8433.scala46
-rw-r--r--test/files/run/t9375.scala2
-rw-r--r--test/files/run/t9689.check14
-rw-r--r--test/files/run/t9689/Test_2.scala12
-rw-r--r--test/files/run/t9689/bug_1.scala8
-rw-r--r--test/files/run/t9915/C_1.java20
-rw-r--r--test/files/run/t9915/Test_2.scala12
-rwxr-xr-xtest/files/run/t9944.check12
-rw-r--r--test/files/run/t9944.scala7
-rw-r--r--test/junit/scala/collection/IteratorTest.scala6
-rw-r--r--test/junit/scala/collection/parallel/immutable/ParRangeTest.scala15
-rw-r--r--test/junit/scala/reflect/internal/util/SourceFileTest.scala19
-rw-r--r--test/junit/scala/util/SpecVersionTest.scala11
-rw-r--r--test/scaladoc/resources/SI-10027.java5
-rw-r--r--test/scaladoc/run/SI-10027.check1
-rw-r--r--test/scaladoc/run/SI-10027.scala12
-rw-r--r--versions.properties15
157 files changed, 954 insertions, 4793 deletions
diff --git a/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF
deleted file mode 100644
index 4ee2d086ac..0000000000
--- a/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,51 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Scala Distribution
-Bundle-SymbolicName: org.scala-ide.scala.compiler;singleton:=true
-Bundle-Version: 2.10.0.alpha
-Eclipse-LazyStart: true
-Bundle-ClassPath:
- .,
- bin,
- lib/jline.jar,
-Export-Package:
- scala.tools.nsc,
- scala.tools.nsc.ast,
- scala.tools.nsc.ast.parser,
- scala.tools.nsc.backend,
- scala.tools.nsc.backend.icode,
- scala.tools.nsc.backend.icode.analysis,
- scala.tools.nsc.backend.jvm,
- scala.tools.nsc.backend.opt,
- scala.tools.nsc.dependencies,
- scala.tools.nsc.doc,
- scala.tools.nsc.doc.html,
- scala.tools.nsc.doc.html.page,
- scala.tools.nsc.doc.model,
- scala.tools.nsc.doc.model.comment,
- scala.tools.nsc.interactive,
- scala.tools.nsc.interpreter,
- scala.tools.nsc.io,
- scala.tools.nsc.javac,
- scala.tools.nsc.matching,
- scala.tools.nsc.plugins,
- scala.tools.nsc.reporters,
- scala.tools.nsc.settings,
- scala.tools.nsc.symtab,
- scala.tools.nsc.symtab.classfile,
- scala.tools.nsc.transform,
- scala.tools.nsc.typechecker,
- scala.tools.nsc.util,
- scala.tools.util,
- scala.reflect.internal,
- scala.reflect.internal.pickling,
- scala.reflect.internal.settings,
- scala.reflect.internal.util,
- scala.reflect.macros,
- scala.reflect.runtime,
- scala.reflect.internal.transform,
- scala.reflect.api,
-Require-Bundle:
- org.apache.ant,
- org.scala-ide.scala.library
-
diff --git a/README.md b/README.md
index 8679f080c2..c5460ffb7d 100644
--- a/README.md
+++ b/README.md
@@ -135,7 +135,7 @@ To perform a bootstrap using sbt
- then a separate invocation of sbt (using the previously built version as `starr`)
is used to build / publish the actual build.
-Assume the current `starr` version is `2.12.0-M4` (defined in
+Assume the current `starr` version is `2.12.0` (defined in
[versions.properties](versions.properties)) and the current version is `2.12.0-SNAPSHOT`
(defined in [build.sbt](build.sbt)). To perform a local bootstrap:
- Run `publishLocal` (you may want to specify a custom version suffix and skip
diff --git a/bincompat-backward.whitelist.conf b/bincompat-backward.whitelist.conf
index 637bd586e0..bb94f4be6c 100644
--- a/bincompat-backward.whitelist.conf
+++ b/bincompat-backward.whitelist.conf
@@ -5,218 +5,14 @@ filter {
# "scala.reflect.runtime"
]
problems=[
- // see SI-8372
{
- matchName="scala.collection.mutable.ArrayOps#ofChar.unzip"
- problemName=IncompatibleMethTypeProblem
+ matchName="scala.reflect.runtime.JavaMirrors#JavaMirror.unpickleClass"
+ problemName=IncompatibleMethTypeProblem
},
{
- matchName="scala.collection.mutable.ArrayOps#ofChar.unzip3"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofByte.unzip"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofByte.unzip3"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofShort.unzip"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofShort.unzip3"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofLong.unzip"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofLong.unzip3"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofInt.unzip"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofInt.unzip3"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps.unzip"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps.unzip3"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps.unzip"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps.unzip3"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofFloat.unzip"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofFloat.unzip3"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofBoolean.unzip"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofBoolean.unzip3"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofRef.unzip"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofRef.unzip3"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofUnit.unzip"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofUnit.unzip3"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofDouble.unzip"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofDouble.unzip3"
- problemName=IncompatibleMethTypeProblem
- },
- // see SI-8200
- {
- matchName="scala.reflect.api.StandardLiftables#StandardLiftableInstances.liftTree"
- problemName=MissingMethodProblem
- },
- // see SI-8331
- {
- matchName="scala.reflect.api.Internals#ReificationSupportApi#SyntacticTypeAppliedExtractor.unapply"
- problemName=IncompatibleResultTypeProblem
- },
- {
- matchName="scala.reflect.api.Internals#ReificationSupportApi#SyntacticTypeAppliedExtractor.unapply"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.api.Internals#ReificationSupportApi.SyntacticSelectType"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.api.Internals#ReificationSupportApi.SyntacticAppliedType"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.api.Internals#ReificationSupportApi.SyntacticSelectTerm"
- problemName=MissingMethodProblem
- },
- // see SI-8366
- {
- matchName="scala.reflect.api.Internals#ReificationSupportApi.SyntacticPartialFunction"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.api.Mirror.symbolOf"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.api.Mirror.typeOf"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.api.Mirror.weakTypeOf"
- problemName=MissingMethodProblem
- },
- // see SI-8388
- {
- matchName="scala.reflect.api.Internals$ReificationSupportApi$SyntacticIdentExtractor"
- problemName=MissingClassProblem
- },
- {
- matchName="scala.reflect.api.Internals#ReificationSupportApi.SyntacticIdent"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.api.Internals#ReificationSupportApi.SyntacticSingletonType"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.api.Internals#ReificationSupportApi.SyntacticTermIdent"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.api.Internals#ReificationSupportApi.SyntacticTypeIdent"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.api.Internals#ReificationSupportApi.SyntacticCompoundType"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.api.Internals#ReificationSupportApi.SyntacticAnnotatedType"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.api.Internals#ReificationSupportApi.SyntacticTypeProjection"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.api.Internals#ReificationSupportApi.SyntacticExistentialType"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.runtime.SynchronizedOps.newNestedScope"
- problemName=MissingMethodProblem
- },
- // see github.com/scala/scala/pull/3925, SI-8627, SI-6440
- {
- matchName="scala.collection.TraversableLike.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.immutable.Stream.filteredTail"
- problemName=MissingMethodProblem
- },
- // https://github.com/scala/scala/pull/3848 -- SI-8680
- {
- matchName="scala.collection.immutable.Stream.scala$collection$immutable$Stream$$loop$6"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.immutable.Stream.scala$collection$immutable$Stream$$loop$5"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.immutable.Stream.scala$collection$immutable$Stream$$loop$4"
- problemName=MissingMethodProblem
- },
- // SI-8946
- {
- matchName="scala.reflect.runtime.ThreadLocalStorage#MyThreadLocalStorage.values"
- problemName=MissingMethodProblem
- },
- // the below method was the unused private (sic!) method but the compatibility checker was complaining about it
- {
- matchName="scala.reflect.io.ZipArchive.scala$reflect$io$ZipArchive$$walkIterator"
- problemName=MissingMethodProblem
+ matchName="scala.reflect.runtime.SymbolLoaders#TopClassCompleter.this"
+ problemName=IncompatibleMethTypeProblem
}
+
]
}
diff --git a/bincompat-forward.whitelist.conf b/bincompat-forward.whitelist.conf
index be4a44c4da..705fa031ab 100644
--- a/bincompat-forward.whitelist.conf
+++ b/bincompat-forward.whitelist.conf
@@ -5,483 +5,13 @@ filter {
# "scala.reflect.runtime"
]
problems=[
- // see SI-8372
{
- matchName="scala.collection.mutable.ArrayOps#ofChar.unzip"
- problemName=IncompatibleMethTypeProblem
+ matchName="scala.reflect.runtime.JavaMirrors#JavaMirror.unpickleClass"
+ problemName=IncompatibleMethTypeProblem
},
{
- matchName="scala.collection.mutable.ArrayOps#ofChar.unzip3"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofByte.unzip"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofByte.unzip3"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofShort.unzip"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofShort.unzip3"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofLong.unzip"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofLong.unzip3"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofInt.unzip"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofInt.unzip3"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps.unzip"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps.unzip3"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps.unzip"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps.unzip3"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofFloat.unzip"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofFloat.unzip3"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofBoolean.unzip"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofBoolean.unzip3"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofRef.unzip"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofRef.unzip3"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofUnit.unzip"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofUnit.unzip3"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofDouble.unzip"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofDouble.unzip3"
- problemName=IncompatibleMethTypeProblem
- },
- // see SI-8200
- {
- matchName="scala.reflect.api.Liftables#Liftable.liftTree"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.api.StandardLiftables#StandardLiftableInstances.liftTree"
- problemName=MissingMethodProblem
- },
- // see SI-8331
- {
- matchName="scala.reflect.api.Internals#ReificationSupportApi.SyntacticSelectType"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.api.Internals#ReificationSupportApi.SyntacticAppliedType"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.api.Internals#ReificationSupportApi.SyntacticSelectTerm"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.api.Internals$ReificationSupportApi$SyntacticSelectTermExtractor"
- problemName=MissingClassProblem
- },
- {
- matchName="scala.reflect.api.Internals#ReificationSupportApi#SyntacticTypeAppliedExtractor.unapply"
- problemName=IncompatibleResultTypeProblem
- },
- {
- matchName="scala.reflect.api.Internals#ReificationSupportApi#SyntacticTypeAppliedExtractor.unapply"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.api.Internals$ReificationSupportApi$SyntacticSelectTypeExtractor"
- problemName=MissingClassProblem
- },
- // see SI-8366
- {
- matchName="scala.reflect.api.Internals$ReificationSupportApi$SyntacticPartialFunctionExtractor"
- problemName=MissingClassProblem
- },
- {
- matchName="scala.reflect.api.Internals#ReificationSupportApi.SyntacticPartialFunction"
- problemName=MissingMethodProblem
- },
- // see SI-8428
- {
- matchName="scala.collection.Iterator#ConcatIterator.this"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.api.Mirror.symbolOf"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.api.Mirror.typeOf"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.api.Mirror.weakTypeOf"
- problemName=MissingMethodProblem
- },
- // see SI-8388
- {
- matchName="scala.reflect.api.Internals#ReificationSupportApi.SyntacticSingletonType"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.api.Internals#ReificationSupportApi.SyntacticTermIdent"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.api.Internals#ReificationSupportApi.SyntacticTypeIdent"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.api.Internals#ReificationSupportApi.SyntacticCompoundType"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.api.Internals#ReificationSupportApi.SyntacticAnnotatedType"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.api.Internals#ReificationSupportApi.SyntacticTypeProjection"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.api.Internals#ReificationSupportApi.SyntacticExistentialType"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.api.Internals#ReificationSupportApi.SyntacticIdent"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.api.Internals$ReificationSupportApi$SyntacticAnnotatedTypeExtractor"
- problemName=MissingClassProblem
- },
- {
- matchName="scala.reflect.api.Internals$ReificationSupportApi$SyntacticTermIdentExtractor"
- problemName=MissingClassProblem
- },
- {
- matchName="scala.reflect.api.Internals$ReificationSupportApi$SyntacitcSingletonTypeExtractor"
- problemName=MissingClassProblem
- },
- {
- matchName="scala.reflect.api.Internals$ReificationSupportApi$SyntacticTypeIdentExtractor"
- problemName=MissingClassProblem
- },
- {
- matchName="scala.reflect.api.Internals$ReificationSupportApi$SyntacticCompoundTypeExtractor"
- problemName=MissingClassProblem
- },
- {
- matchName="scala.reflect.api.Internals$ReificationSupportApi$SyntacticExistentialTypeExtractor"
- problemName=MissingClassProblem
- },
- {
- matchName="scala.reflect.api.Internals$ReificationSupportApi$SyntacticTypeProjectionExtractor"
- problemName=MissingClassProblem
- },
- {
- matchName="scala.reflect.runtime.JavaMirrors#JavaMirror.scala$reflect$runtime$JavaMirrors$JavaMirror$$followStatic"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.runtime.SynchronizedOps.newNestedScope"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.runtime.JavaUniverse"
- problemName=MissingTypesProblem
- },
- {
- matchName="scala.reflect.runtime.JavaUniverse.reporter"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.runtime.JavaUniverse$PerRunReporting"
- problemName=MissingClassProblem
- },
- {
- matchName="scala.reflect.runtime.JavaUniverse.currentRun"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.runtime.JavaUniverse.PerRunReporting"
- problemName=MissingMethodProblem
- },
- // see SI-5919
- {
- matchName="scala.reflect.api.TypeTags$PredefTypeCreator"
- problemName=MissingTypesProblem
- },
- {
- matchName="scala.reflect.api.TreeCreator"
- problemName=MissingTypesProblem
- },
- {
- matchName="scala.reflect.api.TypeCreator"
- problemName=MissingTypesProblem
- },
- {
- matchName="scala.reflect.api.PredefTypeCreator"
- problemName=MissingClassProblem
- },
- // see github.com/scala/scala/pull/3925, SI-8627, SI-6440
- {
- matchName="scala.collection.IterableViewLike#AbstractTransformed.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.AbstractTraversable.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.TraversableViewLike#AbstractTransformed.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.TraversableLike.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.SeqViewLike#AbstractTransformed.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.immutable.TreeSet.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.immutable.Stream.filteredTail"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.immutable.Stream.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.immutable.Stream.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.immutable.StringOps.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.immutable.TreeMap.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.concurrent.TrieMap.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofByte.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofLong.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofUnit.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofInt.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofChar.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofRef.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofDouble.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofFloat.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofBoolean.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofShort.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.mutable.TreeSet.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.io.AbstractFile.filterImpl"
- problemName=MissingMethodProblem
- },
- // https://github.com/scala/scala/pull/3848 -- SI-8680
- {
- matchName="scala.collection.immutable.Stream.scala$collection$immutable$Stream$$loop$6"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.immutable.Stream.scala$collection$immutable$Stream$$loop$5"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.immutable.Stream.scala$collection$immutable$Stream$$loop$4"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.immutable.Stream.scala$collection$immutable$Stream$$loop$3"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.immutable.Stream.scala$collection$immutable$Stream$$loop$2"
- problemName=MissingMethodProblem
- },
- // changes needed by ZipArchiveFileLookup (the flat classpath representation)
- {
- matchName="scala.reflect.io.FileZipArchive.allDirs"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.io.FileZipArchive.root"
- problemName=MissingMethodProblem
- },
- // introduced the harmless method (instead of the repeated code in several places)
- {
- matchName="scala.reflect.runtime.Settings#MultiStringSetting.valueSetByUser"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.runtime.Settings#BooleanSetting.valueSetByUser"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.runtime.Settings#IntSetting.valueSetByUser"
- problemName=MissingMethodProblem
- },
- // SI-9059
- {
- matchName="scala.util.Random.scala$util$Random$$nextAlphaNum$1"
- problemName=MissingMethodProblem
- },
- // Nominally private but in practice JVM-visible methods for reworked scala.util.Sorting
- {
- matchName="scala.util.Sorting.scala$util$Sorting$$mergeSort$default$5"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.util.Sorting.scala$util$Sorting$$mergeSort$mBc$sp"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.util.Sorting.scala$util$Sorting$$mergeSort$mFc$sp"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.util.Sorting.scala$util$Sorting$$mergeSort$mJc$sp"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.util.Sorting.scala$util$Sorting$$mergeSort"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.util.Sorting.scala$util$Sorting$$mergeSort$mCc$sp"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.util.Sorting.scala$util$Sorting$$mergeSort$mSc$sp"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.util.Sorting.scala$util$Sorting$$insertionSort"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.util.Sorting.scala$util$Sorting$$mergeSort$mZc$sp"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.util.Sorting.scala$util$Sorting$$mergeSort$mDc$sp"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.util.Sorting.scala$util$Sorting$$mergeSort$mIc$sp"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.util.Sorting.scala$util$Sorting$$mergeSorted"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.util.Sorting.scala$util$Sorting$$booleanSort"
- problemName=MissingMethodProblem
- },
- // SI-8362: AbstractPromise extends AtomicReference
- // It's ok to change a package-protected class in an impl package,
- // even though it's not clear why it changed -- bug in generic signature generation?
- // -public class scala.concurrent.impl.Promise$DefaultPromise<T> extends scala.concurrent.impl.AbstractPromise implements scala.concurrent.impl.Promise<T>
- // +public class scala.concurrent.impl.Promise$DefaultPromise<T extends java.lang.Object> extends scala.concurrent.impl.AbstractPromise implements scala.concurrent.impl.Promise<T>
- {
- matchName="scala.concurrent.impl.Promise$DefaultPromise"
- problemName=MissingTypesProblem
- },
- {
- matchName="scala.reflect.runtime.Settings.YpartialUnification"
- problemName=MissingMethodProblem
+ matchName="scala.reflect.runtime.SymbolLoaders#TopClassCompleter.this"
+ problemName=IncompatibleMethTypeProblem
}
]
}
diff --git a/build.sbt b/build.sbt
index 6868baa65e..2e5cafc37e 100644
--- a/build.sbt
+++ b/build.sbt
@@ -39,6 +39,7 @@ 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"
@@ -88,7 +89,9 @@ lazy val publishSettings : Seq[Setting[_]] = Seq(
globalVersionSettings
baseVersion in Global := "2.12.1"
baseVersionSuffix in Global := "SNAPSHOT"
-mimaReferenceVersion in Global := Some("2.12.0-RC1")
+mimaReferenceVersion in Global := Some("2.12.0")
+
+scalaVersion in Global := versionProps("starr.version")
lazy val commonSettings = clearSourceAndResourceDirectories ++ publishSettings ++ Seq[Setting[_]](
organization := "org.scala-lang",
@@ -103,12 +106,15 @@ lazy val commonSettings = clearSourceAndResourceDirectories ++ publishSettings +
// sbt claims that s.isManagedVersion is false even though s was resolved by Ivy
// We create a managed copy to prevent sbt from putting it on the classpath where we don't want it
if(s.isManagedVersion) s else {
- val s2 = new ScalaInstance(s.version, s.loader, s.libraryJar, s.compilerJar, s.extraJars, Some(s.actualVersion))
+ val jars = s.jars
+ val libraryJar = jars.find(_.getName contains "-library").get
+ val compilerJar = jars.find(_.getName contains "-compiler").get
+ val extraJars = jars.filter(f => (f ne libraryJar) && (f ne compilerJar))
+ val s2 = new ScalaInstance(s.version, s.loader, libraryJar, compilerJar, extraJars, Some(s.actualVersion))
assert(s2.isManagedVersion)
s2
}
},
- scalaVersion := (scalaVersion in bootstrap).value,
// As of sbt 0.13.12 (sbt/sbt#2634) sbt endeavours to align both scalaOrganization and scalaVersion
// in the Scala artefacts, for example scala-library and scala-compiler.
// This doesn't work in the scala/scala build because the version of scala-library and the scalaVersion of
@@ -146,7 +152,7 @@ lazy val commonSettings = clearSourceAndResourceDirectories ++ publishSettings +
"-sourcepath", (baseDirectory in ThisBuild).value.toString,
"-doc-source-url", s"https://github.com/scala/scala/tree/${versionProperties.value.githubTree}€{FILE_PATH}.scala#L1"
),
- incOptions <<= (incOptions in LocalProject("root")),
+ incOptions := (incOptions in LocalProject("root")).value,
homepage := Some(url("http://www.scala-lang.org")),
startYear := Some(2002),
licenses += (("BSD 3-Clause", url("http://www.scala-lang.org/license.html"))),
@@ -303,7 +309,7 @@ def filterDocSources(ff: FileFilter): Seq[Setting[_]] = Seq(
// binaries of the library on the classpath. Specifically, we get this error:
// (library/compile:doc) scala.reflect.internal.FatalError: package class scala does not have a member Int
dependencyClasspath in (Compile, doc) += (classDirectory in Compile).value,
- doc in Compile <<= doc in Compile dependsOn (compile in Compile)
+ doc in Compile := (doc in Compile).dependsOn(compile in Compile).value
)
def regexFileFilter(s: String): FileFilter = new FileFilter {
@@ -312,13 +318,11 @@ def regexFileFilter(s: String): FileFilter = new FileFilter {
}
// This project provides the STARR scalaInstance for bootstrapping
-lazy val bootstrap = (project in file("target/bootstrap")).settings(
- scalaVersion := versionProps("starr.version")
-)
+lazy val bootstrap = project in file("target/bootstrap")
lazy val library = configureAsSubproject(project)
- .settings(generatePropertiesFileSettings: _*)
- .settings(Osgi.settings: _*)
+ .settings(generatePropertiesFileSettings)
+ .settings(Osgi.settings)
.settings(
name := "scala-library",
description := "Scala Standard Library",
@@ -332,6 +336,8 @@ lazy val library = configureAsSubproject(project)
"-doc-root-content", (sourceDirectory in Compile).value + "/rootdoc.txt"
)
},
+ // macros in library+reflect are hard-wired to implementations with `FastTrack`.
+ incOptions := incOptions.value.withRecompileOnMacroDef(false),
includeFilter in unmanagedResources in Compile := "*.tmpl" | "*.xml" | "*.js" | "*.css" | "rootdoc.txt",
// Include *.txt files in source JAR:
mappings in Compile in packageSrc ++= {
@@ -350,15 +356,17 @@ lazy val library = configureAsSubproject(project)
)
.settings(filterDocSources("*.scala" -- (regexFileFilter(".*/runtime/.*\\$\\.scala") ||
regexFileFilter(".*/runtime/ScalaRunTime\\.scala") ||
- regexFileFilter(".*/runtime/StringAdd\\.scala"))): _*)
- .settings(MiMa.settings: _*)
+ regexFileFilter(".*/runtime/StringAdd\\.scala"))))
+ .settings(MiMa.settings)
lazy val reflect = configureAsSubproject(project)
- .settings(generatePropertiesFileSettings: _*)
- .settings(Osgi.settings: _*)
+ .settings(generatePropertiesFileSettings)
+ .settings(Osgi.settings)
.settings(
name := "scala-reflect",
description := "Scala Reflection Library",
+ // macros in library+reflect are hard-wired to implementations with `FastTrack`.
+ incOptions := incOptions.value.withRecompileOnMacroDef(false),
Osgi.bundleName := "Scala Reflect",
scalacOptions in Compile in doc ++= Seq(
"-skip-packages", "scala.reflect.macros.internal:scala.reflect.internal:scala.reflect.io"
@@ -373,13 +381,13 @@ lazy val reflect = configureAsSubproject(project)
"/project/packaging" -> <packaging>jar</packaging>
)
)
- .settings(MiMa.settings: _*)
+ .settings(MiMa.settings)
.dependsOn(library)
lazy val compiler = configureAsSubproject(project)
- .settings(generatePropertiesFileSettings: _*)
- .settings(generateBuildCharacterFileSettings: _*)
- .settings(Osgi.settings: _*)
+ .settings(generatePropertiesFileSettings)
+ .settings(generateBuildCharacterFileSettings)
+ .settings(Osgi.settings)
.settings(
name := "scala-compiler",
description := "Scala Compiler",
@@ -410,6 +418,16 @@ lazy val compiler = configureAsSubproject(project)
(unmanagedResourceDirectories in Compile in LocalProject("repl")).value
base ** ((includeFilter in unmanagedResources in Compile).value || "*.scala" || "*.psd" || "*.ai" || "*.java") pair relativeTo(base)
},
+ // Include the additional projects in the scaladoc JAR:
+ sources in Compile in doc ++= {
+ val base =
+ (unmanagedSourceDirectories in Compile in LocalProject("interactive")).value ++
+ (unmanagedSourceDirectories in Compile in LocalProject("scaladoc")).value ++
+ (unmanagedSourceDirectories in Compile in LocalProject("repl")).value
+ ((base ** ("*.scala" || "*.java"))
+ --- (base ** "Scaladoc*ModelTest.scala") // exclude test classes that depend on partest
+ ).get
+ },
scalacOptions in Compile in doc ++= Seq(
"-doc-root-content", (sourceDirectory in Compile).value + "/rootdoc.txt"
),
@@ -436,8 +454,8 @@ lazy val compiler = configureAsSubproject(project)
.dependsOn(library, reflect)
lazy val interactive = configureAsSubproject(project)
- .settings(disableDocs: _*)
- .settings(disablePublishing: _*)
+ .settings(disableDocs)
+ .settings(disablePublishing)
.settings(
name := "scala-compiler-interactive",
description := "Scala Interactive Compiler"
@@ -445,17 +463,17 @@ lazy val interactive = configureAsSubproject(project)
.dependsOn(compiler)
lazy val repl = configureAsSubproject(project)
- .settings(disableDocs: _*)
- .settings(disablePublishing: _*)
+ .settings(disableDocs)
+ .settings(disablePublishing)
.settings(
connectInput in run := true,
- run <<= (run in Compile).partialInput(" -usejavacp") // Automatically add this so that `repl/run` works without additional arguments.
+ run := (run in Compile).partialInput(" -usejavacp").evaluated // Automatically add this so that `repl/run` works without additional arguments.
)
.dependsOn(compiler, interactive)
lazy val replJline = configureAsSubproject(Project("repl-jline", file(".") / "src" / "repl-jline"))
- .settings(disableDocs: _*)
- .settings(disablePublishing: _*)
+ .settings(disableDocs)
+ .settings(disablePublishing)
.settings(
libraryDependencies += jlineDep,
name := "scala-repl-jline"
@@ -463,8 +481,8 @@ lazy val replJline = configureAsSubproject(Project("repl-jline", file(".") / "sr
.dependsOn(repl)
lazy val replJlineEmbedded = Project("repl-jline-embedded", file(".") / "target" / "repl-jline-embedded-src-dummy")
- .settings(scalaSubprojectSettings: _*)
- .settings(disablePublishing: _*)
+ .settings(scalaSubprojectSettings)
+ .settings(disablePublishing)
.settings(
name := "scala-repl-jline-embedded",
// There is nothing to compile for this project. Instead we use the compile task to create
@@ -472,7 +490,7 @@ lazy val replJlineEmbedded = Project("repl-jline-embedded", file(".") / "target"
// quick/repl-jline and quick/repl-jline-shaded on the classpath for quick/bin scripts.
// This is different from the Ant build where all parts are combined into quick/repl, but
// it is cleaner because it avoids circular dependencies.
- compile in Compile <<= (compile in Compile).dependsOn(Def.task {
+ compile in Compile := (compile in Compile).dependsOn(Def.task {
import java.util.jar._
import collection.JavaConverters._
val inputs: Iterator[JarJar.Entry] = {
@@ -494,15 +512,15 @@ lazy val replJlineEmbedded = Project("repl-jline-embedded", file(".") / "target"
)
val outdir = (classDirectory in Compile).value
JarJar(inputs, outdir, config)
- }),
+ }).value,
connectInput in run := true
)
.dependsOn(replJline)
lazy val scaladoc = configureAsSubproject(project)
- .settings(disableDocs: _*)
- .settings(disablePublishing: _*)
+ .settings(disableDocs)
+ .settings(disablePublishing)
.settings(
name := "scala-compiler-doc",
description := "Scala Documentation Generator",
@@ -526,11 +544,11 @@ lazy val scalap = configureAsSubproject(project)
lazy val partestExtras = Project("partest-extras", file(".") / "src" / "partest-extras")
.dependsOn(replJlineEmbedded)
- .settings(commonSettings: _*)
- .settings(generatePropertiesFileSettings: _*)
- .settings(clearSourceAndResourceDirectories: _*)
- .settings(disableDocs: _*)
- .settings(disablePublishing: _*)
+ .settings(commonSettings)
+ .settings(generatePropertiesFileSettings)
+ .settings(clearSourceAndResourceDirectories)
+ .settings(disableDocs)
+ .settings(disablePublishing)
.settings(
name := "scala-partest-extras",
description := "Scala Compiler Testing Tool (compiler-specific extras)",
@@ -540,16 +558,17 @@ lazy val partestExtras = Project("partest-extras", file(".") / "src" / "partest-
lazy val junit = project.in(file("test") / "junit")
.dependsOn(library, reflect, compiler, partestExtras, scaladoc)
- .settings(clearSourceAndResourceDirectories: _*)
- .settings(commonSettings: _*)
- .settings(disableDocs: _*)
- .settings(disablePublishing: _*)
+ .settings(clearSourceAndResourceDirectories)
+ .settings(commonSettings)
+ .settings(disableDocs)
+ .settings(disablePublishing)
.settings(
fork in Test := true,
javaOptions in Test += "-Xss1M",
libraryDependencies ++= Seq(junitDep, junitInterfaceDep, jolDep),
testOptions += Tests.Argument(TestFrameworks.JUnit, "-a", "-v"),
- testFrameworks -= new TestFramework("org.scalacheck.ScalaCheckFramework"),
+ // testFrameworks -= new TestFramework("org.scalacheck.ScalaCheckFramework"),
+ unmanagedSourceDirectories in Compile := Nil,
unmanagedSourceDirectories in Test := List(baseDirectory.value)
)
@@ -563,10 +582,10 @@ lazy val osgiTestEclipse = osgiTestProject(
def osgiTestProject(p: Project, framework: ModuleID) = p
.dependsOn(library, reflect, compiler)
- .settings(clearSourceAndResourceDirectories: _*)
- .settings(commonSettings: _*)
- .settings(disableDocs: _*)
- .settings(disablePublishing: _*)
+ .settings(clearSourceAndResourceDirectories)
+ .settings(commonSettings)
+ .settings(disableDocs)
+ .settings(disablePublishing)
.settings(
fork in Test := true,
parallelExecution in Test := false,
@@ -586,7 +605,7 @@ def osgiTestProject(p: Project, framework: ModuleID) = p
framework % "test"
)
},
- Keys.test in Test <<= Keys.test in Test dependsOn (packageBin in Compile),
+ Keys.test in Test := (Keys.test in Test).dependsOn(packageBin in Compile).value,
testOptions += Tests.Argument(TestFrameworks.JUnit, "-a", "-v", "-q"),
unmanagedSourceDirectories in Test := List((baseDirectory in ThisBuild).value / "test" / "osgi" / "src"),
unmanagedResourceDirectories in Compile := (unmanagedSourceDirectories in Test).value,
@@ -603,9 +622,9 @@ def osgiTestProject(p: Project, framework: ModuleID) = p
)
lazy val partestJavaAgent = Project("partest-javaagent", file(".") / "src" / "partest-javaagent")
- .settings(commonSettings: _*)
- .settings(generatePropertiesFileSettings: _*)
- .settings(disableDocs: _*)
+ .settings(commonSettings)
+ .settings(generatePropertiesFileSettings)
+ .settings(disableDocs)
.settings(
libraryDependencies += asmDep,
publishLocal := {},
@@ -623,12 +642,12 @@ lazy val partestJavaAgent = Project("partest-javaagent", file(".") / "src" / "pa
lazy val test = project
.dependsOn(compiler, interactive, replJlineEmbedded, scalap, partestExtras, partestJavaAgent, scaladoc)
.configs(IntegrationTest)
- .settings(commonSettings: _*)
- .settings(disableDocs: _*)
- .settings(disablePublishing: _*)
- .settings(Defaults.itSettings: _*)
+ .settings(commonSettings)
+ .settings(disableDocs)
+ .settings(disablePublishing)
+ .settings(Defaults.itSettings)
.settings(
- libraryDependencies ++= Seq(asmDep, partestDep, scalaXmlDep),
+ libraryDependencies ++= Seq(asmDep, partestDep, scalaXmlDep, scalacheckDep),
libraryDependencies ++= {
// Resolve the JARs for all test/files/lib/*.jar.desired.sha1 files through Ivy
val baseDir = (baseDirectory in ThisBuild).value
@@ -645,7 +664,7 @@ 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"),
+ // 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 { () =>
@@ -677,16 +696,16 @@ lazy val test = project
)
lazy val manual = configureAsSubproject(project)
- .settings(disableDocs: _*)
- .settings(disablePublishing: _*)
+ .settings(disableDocs)
+ .settings(disablePublishing)
.settings(
libraryDependencies ++= Seq(scalaXmlDep, antDep, "org.scala-lang" % "scala-library" % scalaVersion.value),
classDirectory in Compile := (target in Compile).value / "classes"
)
lazy val libraryAll = Project("library-all", file(".") / "target" / "library-all-src-dummy")
- .settings(commonSettings: _*)
- .settings(disableDocs: _*)
+ .settings(commonSettings)
+ .settings(disableDocs)
.settings(
name := "scala-library-all",
publishArtifact in (Compile, packageBin) := false,
@@ -701,8 +720,8 @@ lazy val libraryAll = Project("library-all", file(".") / "target" / "library-all
.dependsOn(library, reflect)
lazy val scalaDist = Project("scala-dist", file(".") / "target" / "scala-dist-dist-src-dummy")
- .settings(commonSettings: _*)
- .settings(disableDocs: _*)
+ .settings(commonSettings)
+ .settings(disableDocs)
.settings(
mappings in Compile in packageBin ++= {
val binBaseDir = buildDirectory.value / "pack"
@@ -747,15 +766,13 @@ lazy val scalaDist = Project("scala-dist", file(".") / "target" / "scala-dist-di
.dependsOn(libraryAll, compiler, scalap)
lazy val root: Project = (project in file("."))
- .settings(disableDocs: _*)
- .settings(disablePublishing: _*)
- .settings(generateBuildCharacterFileSettings: _*)
+ .settings(disableDocs)
+ .settings(disablePublishing)
+ .settings(generateBuildCharacterFileSettings)
.settings(
- publish := {},
- publishLocal := {},
commands ++= ScriptCommands.all,
extractBuildCharacterPropertiesFile := {
- val jar = (scalaInstance in bootstrap).value.compilerJar
+ val jar = (scalaInstance in bootstrap).value.allJars.find(_.getName contains "-compiler").get
val bc = buildCharacterPropertiesFile.value
val packagedName = "scala-buildcharacter.properties"
IO.withTemporaryDirectory { tmp =>
@@ -867,15 +884,15 @@ lazy val dist = (project in file("dist"))
.settings(
libraryDependencies ++= Seq(scalaSwingDep, jlineDep),
mkBin := mkBinImpl.value,
- mkQuick <<= Def.task {
+ mkQuick := Def.task {
val cp = (fullClasspath in IntegrationTest in LocalProject("test")).value
val propsFile = (buildDirectory in ThisBuild).value / "quick" / "partest.properties"
val props = new java.util.Properties()
props.setProperty("partest.classpath", cp.map(_.data.getAbsolutePath).mkString(sys.props("path.separator")))
IO.write(props, null, propsFile)
(buildDirectory in ThisBuild).value / "quick"
- } dependsOn ((distDependencies.map(products in Runtime in _) :+ mkBin): _*),
- mkPack <<= Def.task { (buildDirectory in ThisBuild).value / "pack" } dependsOn (packagedArtifact in (Compile, packageBin), mkBin),
+ }.dependsOn((distDependencies.map(products in Runtime in _) :+ mkBin): _*).value,
+ mkPack := Def.task { (buildDirectory in ThisBuild).value / "pack" }.dependsOn(packagedArtifact in (Compile, packageBin), mkBin).value,
target := (baseDirectory in ThisBuild).value / "target" / thisProject.value.id,
packageBin in Compile := {
val extraDeps = Set(scalaSwingDep, scalaParserCombinatorsDep, scalaXmlDep)
@@ -892,7 +909,10 @@ lazy val dist = (project in file("dist"))
},
cleanFiles += (buildDirectory in ThisBuild).value / "quick",
cleanFiles += (buildDirectory in ThisBuild).value / "pack",
- packagedArtifact in (Compile, packageBin) <<= (packagedArtifact in (Compile, packageBin)).dependsOn(distDependencies.map(packagedArtifact in (Compile, packageBin) in _): _*)
+ packagedArtifact in (Compile, packageBin) :=
+ (packagedArtifact in (Compile, packageBin))
+ .dependsOn(distDependencies.map(packagedArtifact in (Compile, packageBin) in _): _*)
+ .value
)
.dependsOn(distDependencies.map(p => p: ClasspathDep[ProjectReference]): _*)
@@ -910,8 +930,8 @@ lazy val dist = (project in file("dist"))
def configureAsSubproject(project: Project): Project = {
val base = file(".") / "src" / project.id
(project in base)
- .settings(scalaSubprojectSettings: _*)
- .settings(generatePropertiesFileSettings: _*)
+ .settings(scalaSubprojectSettings)
+ .settings(generatePropertiesFileSettings)
}
lazy val buildDirectory = settingKey[File]("The directory where all build products go. By default ./build")
diff --git a/doc/LICENSE.md b/doc/LICENSE.md
index 0718c43e05..a07ba32e0b 100644
--- a/doc/LICENSE.md
+++ b/doc/LICENSE.md
@@ -46,7 +46,6 @@ This license is used by the following third-party libraries:
This license is used by the following third-party libraries:
* jline
- * scalacheck
### [BSD 3-Clause License](http://opensource.org/licenses/BSD-3-Clause)
This license is used by the following third-party libraries:
diff --git a/doc/licenses/bsd_scalacheck.txt b/doc/licenses/bsd_scalacheck.txt
deleted file mode 100644
index f1920752e0..0000000000
--- a/doc/licenses/bsd_scalacheck.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-ScalaCheck LICENSE
-
-Copyright (c) 2007-2013, Rickard Nilsson
-All rights reserved.
-
-Permission to use, copy, modify, and distribute this software in source
-or binary form for any purpose with or without fee is hereby granted,
-provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- 3. Neither the name of the author nor the names of its contributors
- may be used to endorse or promote products derived from this
- software without specific prior written permission.
-
-
-THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
diff --git a/project/MiMa.scala b/project/MiMa.scala
index 6c6f5efd51..8963699c17 100644
--- a/project/MiMa.scala
+++ b/project/MiMa.scala
@@ -24,7 +24,7 @@ object MiMa {
def runOnce(prev: java.io.File, curr: java.io.File, isForward: Boolean): Unit = {
val direction = if (isForward) "forward" else "backward"
log.info(s"Checking $direction binary compatibility")
- log.debug(s"prev = $prev, curr = $curr")
+ log.info(s"prev = $prev, curr = $curr")
runMima(
prev = if (isForward) curr else prev,
curr = if (isForward) prev else curr,
@@ -48,7 +48,11 @@ object MiMa {
"--prev", prev.getAbsolutePath,
"--curr", curr.getAbsolutePath,
"--filters", filter.getAbsolutePath,
- "--generate-filters"
+ "--generate-filters",
+ // !!! Command line MiMa (which we call rathan the SBT Plugin for reasons alluded to in f2d0f1e85) incorrectly
+ // defaults to no checking (!) if this isn't specified. Fixed in https://github.com/typesafehub/migration-manager/pull/138
+ // TODO: Try out the new "--direction both" mode of MiMa
+ "--direction", "backwards"
)
val exitCode = TrapExit(com.typesafe.tools.mima.cli.Main.main(args), log)
if (exitCode != 0)
diff --git a/project/Osgi.scala b/project/Osgi.scala
index 8a62c9128a..082fd91ed1 100644
--- a/project/Osgi.scala
+++ b/project/Osgi.scala
@@ -36,12 +36,12 @@ object Osgi {
)
},
jarlist := false,
- bundle <<= Def.task {
- val res = (products in Compile in packageBin).value
- bundleTask(headers.value.toMap, jarlist.value, (products in Compile in packageBin).value,
- (artifactPath in (Compile, packageBin)).value, res, streams.value)
- },
- packagedArtifact in (Compile, packageBin) <<= (artifact in (Compile, packageBin), bundle).identityMap,
+ bundle := Def.task {
+ val cp = (products in Compile in packageBin).value
+ bundleTask(headers.value.toMap, jarlist.value, cp,
+ (artifactPath in (Compile, packageBin)).value, cp, streams.value)
+ }.value,
+ packagedArtifact in (Compile, packageBin) := (((artifact in (Compile, packageBin)).value, bundle.value)),
// Also create OSGi source bundles:
packageOptions in (Compile, packageSrc) += Package.ManifestAttributes(
"Bundle-Name" -> (description.value + " Sources"),
@@ -57,7 +57,12 @@ object Osgi {
val builder = new Builder
builder.setClasspath(fullClasspath.toArray)
headers foreach { case (k, v) => builder.setProperty(k, v) }
- val includeRes = resourceDirectories.filter(_.exists).map(_.getAbsolutePath).mkString(",")
+
+ // https://github.com/scala/scala-dev/issues/254
+ // Must be careful not to include scala-asm.jar within scala-compiler.jar!
+ def resourceDirectoryRef(f: File) = (if (f.isDirectory) "" else "@") + f.getAbsolutePath
+
+ val includeRes = resourceDirectories.filter(_.exists).map(resourceDirectoryRef).mkString(",")
if(!includeRes.isEmpty) builder.setProperty(INCLUDERESOURCE, includeRes)
builder.getProperties.asScala.foreach { case (k, v) => log.debug(s"bnd: $k: $v") }
// builder.build is not thread-safe because it uses a static SimpleDateFormat. This ensures
diff --git a/project/PartestUtil.scala b/project/PartestUtil.scala
index 99b978515c..897881d2b6 100644
--- a/project/PartestUtil.scala
+++ b/project/PartestUtil.scala
@@ -86,7 +86,10 @@ object PartestUtil {
srcPath = path
opt + " " + path
}
- val P = oneOf(knownUnaryOptions.map(x => token(x))) | SrcPath | TestPathParser | Grep
+
+ val ScalacOptsParser = (token("-Dpartest.scalac_opts=") ~ token(NotSpace)) map { case opt ~ v => opt + v }
+
+ val P = oneOf(knownUnaryOptions.map(x => token(x))) | SrcPath | TestPathParser | Grep | ScalacOptsParser
(Space ~> repsep(P, oneOrMore(Space))).map(_.mkString(" ")).?.map(_.getOrElse("")) <~ OptSpace
}
}
diff --git a/spec/03-types.md b/spec/03-types.md
index 2ad16e50cb..d2f41daabf 100644
--- a/spec/03-types.md
+++ b/spec/03-types.md
@@ -587,7 +587,7 @@ corresponding function type.
The declarations
-```
+```scala
def a: Int
def b (x: Int): Boolean
def c (x: Int) (y: String, z: String): String
@@ -642,7 +642,7 @@ the corresponding type parameter clause.
Consider this fragment of the `Iterable[+X]` class:
-```
+```scala
trait Iterable[+X] {
def flatMap[newType[+X] <: Iterable[X], S](f: X => newType[S]): newType[S]
}
@@ -660,7 +660,7 @@ same name, we model
An overloaded type consisting of type alternatives $T_1 \commadots T_n (n \geq 2)$ is denoted internally $T_1 \overload \ldots \overload T_n$.
###### Example
-```
+```scala
def println: Unit
def println(s: String): Unit = $\ldots$
def println(x: Float): Unit = $\ldots$
@@ -678,7 +678,7 @@ println: => Unit $\overload$
```
###### Example
-```
+```scala
def f(x: T): T = $\ldots$
val f = 0
```
@@ -979,7 +979,7 @@ after applying [eta-expansion](06-expressions.html#eta-expansion). If $T$ is a m
Given the definitions
-```
+```scala
def foo(x: Int => String): Unit
def foo(x: ToString): Unit
diff --git a/spec/04-basic-declarations-and-definitions.md b/spec/04-basic-declarations-and-definitions.md
index f6068eb9d8..49ca80b124 100644
--- a/spec/04-basic-declarations-and-definitions.md
+++ b/spec/04-basic-declarations-and-definitions.md
@@ -88,7 +88,7 @@ The class definition `case class X(), Y(n: Int) extends Z` expands to
`case class X extends Z; case class Y(n: Int) extends Z`.
- The object definition `case object Red, Green, Blue extends Color`~
expands to
-```
+```scala
case object Red extends Color
case object Green extends Color
case object Blue extends Color .
diff --git a/spec/05-classes-and-objects.md b/spec/05-classes-and-objects.md
index 739fd28eb1..75620f57d4 100644
--- a/spec/05-classes-and-objects.md
+++ b/spec/05-classes-and-objects.md
@@ -725,7 +725,7 @@ Here,
- $t$ is a [template](#templates) of the form
- ```
+ ```scala
$sc$ with $mt_1$ with $\ldots$ with $mt_m$ { $\mathit{stats}$ } // $m \geq 0$
```
@@ -1103,8 +1103,8 @@ Note that the value defined by an object definition is instantiated
lazily. The `new $m$\$cls` constructor is evaluated
not at the point of the object definition, but is instead evaluated
the first time $m$ is dereferenced during execution of the program
-(which might be never at all). An attempt to dereference $m$ again in
-the course of evaluation of the constructor leads to a infinite loop
+(which might be never at all). An attempt to dereference $m$ again
+during evaluation of the constructor will lead to an infinite loop
or run-time error.
Other threads trying to dereference $m$ while the
constructor is being evaluated block until evaluation is complete.
diff --git a/spec/06-expressions.md b/spec/06-expressions.md
index 30fd94c1a8..48cff1725a 100644
--- a/spec/06-expressions.md
+++ b/spec/06-expressions.md
@@ -655,7 +655,7 @@ precedence, with characters on the same line having the same precedence.
```
That is, operators starting with a letter have lowest precedence,
-followed by operators starting with ``|`', etc.
+followed by operators starting with ‘`|`’, etc.
There's one exception to this rule, which concerns
[_assignment operators_](#assignment-operators).
@@ -664,7 +664,7 @@ of simple assignment `(=)`. That is, it is lower than the
precedence of any other operator.
The _associativity_ of an operator is determined by the operator's
-last character. Operators ending in a colon ``:`' are
+last character. Operators ending in a colon ‘`:`’ are
right-associative. All other operators are left-associative.
Precedence and associativity of operators determine the grouping of
@@ -945,7 +945,7 @@ comprehensions have been eliminated.
`$e$.foreach { case $p$ => $e'$ }`.
- A for comprehension
- ```
+ ```scala
for ($p$ <- $e$; $p'$ <- $e'; \ldots$) yield $e''$
```
@@ -953,13 +953,13 @@ comprehensions have been eliminated.
sequence of generators, definitions, or guards,
is translated to
- ```
+ ```scala
$e$.flatMap { case $p$ => for ($p'$ <- $e'; \ldots$) yield $e''$ }
```
- A for loop
- ```
+ ```scala
for ($p$ <- $e$; $p'$ <- $e'; \ldots$) $e''$
```
@@ -967,7 +967,7 @@ comprehensions have been eliminated.
sequence of generators, definitions, or guards,
is translated to
- ```
+ ```scala
$e$.foreach { case $p$ => for ($p'$ <- $e'; \ldots$) $e''$ }
```
@@ -980,7 +980,7 @@ comprehensions have been eliminated.
`$p'$ = $e'$` is translated to the following generator of pairs of values, where
$x$ and $x'$ are fresh names:
- ```
+ ```scala
($p$, $p'$) <- for ($x @ p$ <- $e$) yield { val $x' @ p'$ = $e'$; ($x$, $x'$) }
```
diff --git a/spec/11-annotations.md b/spec/11-annotations.md
index e54a0dd2b0..68faee53e6 100644
--- a/spec/11-annotations.md
+++ b/spec/11-annotations.md
@@ -56,7 +56,7 @@ Java platform, the following annotations have a standard meaning.
This is equivalent to a the following field
definition in Java:
- ```
+ ```java
private final static SerialVersionUID = <longlit>
```
@@ -103,7 +103,7 @@ Java platform, the following annotations have a standard meaning.
matches which would otherwise be emitted. For instance, no warnings
would be produced for the method definition below.
- ```
+ ```scala
def f(x: Option[Int]) = (x: @unchecked) match {
case Some(y) => y
}
@@ -117,7 +117,7 @@ Java platform, the following annotations have a standard meaning.
value to appear in a path, even if its type is [volatile](03-types.html#volatile-types).
For instance, the following member definitions are legal:
- ```
+ ```scala
type A { type T }
type B
@uncheckedStable val x: A with B // volatile type
@@ -140,7 +140,7 @@ Java platform, the following annotations have a standard meaning.
For instance, the following code would generate specialized traits for
`Unit`, `Int` and `Double`
- ```
+ ```scala
trait Function0[@specialized(Unit, Int, Double) T] {
def apply: T
}
diff --git a/spec/12-the-scala-standard-library.md b/spec/12-the-scala-standard-library.md
index 8f65191312..a1d4516a1f 100644
--- a/spec/12-the-scala-standard-library.md
+++ b/spec/12-the-scala-standard-library.md
@@ -777,7 +777,7 @@ The available high-priority implicits include definitions falling into the follo
* An implicit wrapper that adds `ensuring` methods
with the following overloaded variants to type `Any`.
- ```
+ ```scala
def ensuring(cond: Boolean): A = { assert(cond); x }
def ensuring(cond: Boolean, msg: Any): A = { assert(cond, msg); x }
def ensuring(cond: A => Boolean): A = { assert(cond(x)); x }
@@ -787,7 +787,7 @@ The available high-priority implicits include definitions falling into the follo
* An implicit wrapper that adds a `->` method with the following implementation
to type `Any`.
- ```
+ ```scala
def -> [B](y: B): (A, B) = (x, y)
```
@@ -801,7 +801,7 @@ The available high-priority implicits include definitions falling into the follo
* An implicit wrapper that adds `+` and `formatted` method with the following
implementations to type `Any`.
- ```
+ ```scala
def +(other: String) = String.valueOf(self) + other
def formatted(fmtstr: String): String = fmtstr format self
```
@@ -835,7 +835,7 @@ The available high-priority implicits include definitions falling into the follo
* An implicit definition that generates instances of type `T <:< T`, for
any type `T`. Here, `<:<` is a class defined as follows.
- ```
+ ```scala
sealed abstract class <:<[-From, +To] extends (From => To)
```
diff --git a/spec/README.md b/spec/README.md
index 9fd7c9f6ae..b19ce6441f 100644
--- a/spec/README.md
+++ b/spec/README.md
@@ -36,5 +36,5 @@ and open http://0.0.0.0:4000/. Jekyll will rebuild as you edit the markdown, but
### Unicode Character replacements
-- The unicode left and right single quotation marks (‘ and ’) have been used in place of ` and ', where the quotation marks are intended to be paired. These can be typed on a mac using Option+] for a left quote and Option+Shift+] for the right quote.
-- Similarly for left and right double quotation marks (“ and ”) in place of ". These can be typed on a mac using Option+[ and Option+Shift+].
+- The unicode left and right single quotation marks (‘ and ’ (U+2018 and U+2019, respectively)) have been used in place of ` and ', where the quotation marks are intended to be paired. These can be typed on a mac using Option+] for a left quote and Option+Shift+] for the right quote.
+- Similarly for left and right double quotation marks (“ and ” (U+201C and U+201D, respectively)) in place of ". These can be typed on a mac using Option+[ and Option+Shift+].
diff --git a/src/build/genprod.scala b/src/build/genprod.scala
index 74adb6237e..a45dc752cc 100644
--- a/src/build/genprod.scala
+++ b/src/build/genprod.scala
@@ -380,7 +380,7 @@ object {className} {{
Some(x)
}}
-/** {className} is a cartesian product of {i} component{s}.
+/** {className} is a Cartesian product of {i} component{s}.
* @since 2.3
*/
trait {className}{covariantArgs} extends Any with Product {{
diff --git a/src/compiler/rootdoc.txt b/src/compiler/rootdoc.txt
index 173f604098..25808dec89 100644
--- a/src/compiler/rootdoc.txt
+++ b/src/compiler/rootdoc.txt
@@ -1,6 +1 @@
-The Scala compiler API.
-
-The following resources are useful for Scala plugin/compiler development:
- - [[http://www.scala-lang.org/node/215 Scala development tutorials]] on [[http://www.scala-lang.org www.scala-lang.org]]
- - [[https://wiki.scala-lang.org/display/SIW/ Scala Internals wiki]]
- - [[http://lampwww.epfl.ch/~magarcia/ScalaCompilerCornerReloaded/ Scala compiler corner]], maintained by Miguel
+The Scala compiler and reflection APIs.
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index 64ed687c07..a7880c72d7 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -1297,7 +1297,7 @@ class Global(var currentSettings: Settings, var reporter: Reporter)
/** does this run compile given class, module, or case factory? */
// NOTE: Early initialized members temporarily typechecked before the enclosing class, see typedPrimaryConstrBody!
- // Here we work around that wrinkle by claiming that a early-initialized member is compiled in
+ // Here we work around that wrinkle by claiming that a pre-initialized member is compiled in
// *every* run. This approximation works because this method is exclusively called with `this` == `currentRun`.
def compiles(sym: Symbol): Boolean =
if (sym == NoSymbol) false
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
index 891858ba7b..a8cc7f91c2 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
@@ -38,6 +38,27 @@ trait ScannersCommon {
def deprecationWarning(off: Offset, msg: String, since: String): Unit
}
+ // Hooks for ScaladocUnitScanner and ScaladocJavaUnitScanner
+ trait DocScanner {
+ protected def beginDocComment(prefix: String): Unit = {}
+ protected def processCommentChar(): Unit = {}
+ protected def finishDocComment(): Unit = {}
+
+ private var lastDoc: DocComment = null
+ // get last doc comment
+ def flushDoc(): DocComment = try lastDoc finally lastDoc = null
+ def registerDocComment(raw: String, pos: Position) = {
+ lastDoc = DocComment(raw, pos)
+ signalParsedDocComment(raw, pos)
+ }
+
+ /** To prevent doc comments attached to expressions from leaking out of scope
+ * onto the next documentable entity, they are discarded upon passing a right
+ * brace, bracket, or parenthesis.
+ */
+ def discardDocBuffer(): Unit = {}
+ }
+
def createKeywordArray(keywords: Seq[(Name, Token)], defaultToken: Token): (Token, Array[Token]) = {
val names = keywords sortBy (_._1.start) map { case (k, v) => (k.start, v) }
val low = names.head._1
@@ -103,11 +124,11 @@ trait Scanners extends ScannersCommon {
}
}
- abstract class Scanner extends CharArrayReader with TokenData with ScannerData with ScannerCommon {
+ abstract class Scanner extends CharArrayReader with TokenData with ScannerData with ScannerCommon with DocScanner {
private def isDigit(c: Char) = java.lang.Character isDigit c
private var openComments = 0
- protected def putCommentChar(): Unit = nextChar()
+ final protected def putCommentChar(): Unit = { processCommentChar(); nextChar() }
@tailrec private def skipLineComment(): Unit = ch match {
case SU | CR | LF =>
@@ -134,8 +155,6 @@ trait Scanners extends ScannersCommon {
case SU => incompleteInputError("unclosed comment")
case _ => putCommentChar() ; skipNestedComments()
}
- def skipDocComment(): Unit = skipNestedComments()
- def skipBlockComment(): Unit = skipNestedComments()
private def skipToCommentEnd(isLineComment: Boolean): Unit = {
nextChar()
@@ -147,27 +166,23 @@ trait Scanners extends ScannersCommon {
// Check for the amazing corner case of /**/
if (ch == '/')
nextChar()
- else
- skipDocComment()
+ else {
+ beginDocComment("/**")
+ skipNestedComments()
+ }
}
- else skipBlockComment()
+ else skipNestedComments()
}
}
/** @pre ch == '/'
* Returns true if a comment was skipped.
*/
- def skipComment(): Boolean = ch match {
- case '/' | '*' => skipToCommentEnd(isLineComment = ch == '/') ; true
+ final def skipComment(): Boolean = ch match {
+ case '/' | '*' => skipToCommentEnd(isLineComment = ch == '/') ; finishDocComment(); true
case _ => false
}
- def flushDoc(): DocComment = null
- /** To prevent doc comments attached to expressions from leaking out of scope
- * onto the next documentable entity, they are discarded upon passing a right
- * brace, bracket, or parenthesis.
- */
- def discardDocBuffer(): Unit = ()
def isAtEnd = charOffset >= buf.length
@@ -246,6 +261,14 @@ trait Scanners extends ScannersCommon {
private def inMultiLineInterpolation =
inStringInterpolation && sepRegions.tail.nonEmpty && sepRegions.tail.head == STRINGPART
+ /** Are we in a `${ }` block? such that RBRACE exits back into multiline string. */
+ private def inMultiLineInterpolatedExpression = {
+ sepRegions match {
+ case RBRACE :: STRINGLIT :: STRINGPART :: rest => true
+ case _ => false
+ }
+ }
+
/** read next token and return last offset
*/
def skipToken(): Offset = {
@@ -312,7 +335,7 @@ trait Scanners extends ScannersCommon {
lastOffset -= 1
}
if (inStringInterpolation) fetchStringPart() else fetchToken()
- if(token == ERROR) {
+ if (token == ERROR) {
if (inMultiLineInterpolation)
sepRegions = sepRegions.tail.tail
else if (inStringInterpolation)
@@ -547,7 +570,8 @@ trait Scanners extends ScannersCommon {
case ')' =>
nextChar(); token = RPAREN
case '}' =>
- nextChar(); token = RBRACE
+ if (inMultiLineInterpolatedExpression) nextRawChar() else nextChar()
+ token = RBRACE
case '[' =>
nextChar(); token = LBRACKET
case ']' =>
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala
index 0b07e12917..b0815b0008 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala
@@ -488,16 +488,11 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
bc emitRETURN returnType
case nextCleanup :: rest =>
if (saveReturnValue) {
- if (insideCleanupBlock) {
- reporter.warning(r.pos, "Return statement found in finally-clause, discarding its return-value in favor of that of a more deeply nested return.")
- bc drop returnType
- } else {
- // regarding return value, the protocol is: in place of a `return-stmt`, a sequence of `adapt, store, jump` are inserted.
- if (earlyReturnVar == null) {
- earlyReturnVar = locals.makeLocal(returnType, "earlyReturnVar")
- }
- locals.store(earlyReturnVar)
+ // regarding return value, the protocol is: in place of a `return-stmt`, a sequence of `adapt, store, jump` are inserted.
+ if (earlyReturnVar == null) {
+ earlyReturnVar = locals.makeLocal(returnType, "earlyReturnVar")
}
+ locals.store(earlyReturnVar)
}
bc goTo nextCleanup
shouldEmitCleanup = true
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala
index dbad37cd5b..fdb5687311 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala
@@ -255,7 +255,6 @@ abstract class BCodeSkelBuilder extends BCodeHelpers {
// used by genLoadTry() and genSynchronized()
var earlyReturnVar: Symbol = null
var shouldEmitCleanup = false
- var insideCleanupBlock = false
// line numbers
var lastEmittedLineNr = -1
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeSyncAndTry.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeSyncAndTry.scala
index 466793010f..add2c5ffe6 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeSyncAndTry.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeSyncAndTry.scala
@@ -36,7 +36,7 @@ abstract class BCodeSyncAndTry extends BCodeBodyBuilder {
// if the synchronized block returns a result, store it in a local variable.
// Just leaving it on the stack is not valid in MSIL (stack is cleaned when leaving try-blocks).
val hasResult = (expectedType != UNIT)
- val monitorResult: Symbol = if (hasResult) locals.makeLocal(tpeTK(args.head), "monitorResult") else null;
+ val monitorResult: Symbol = if (hasResult) locals.makeLocal(tpeTK(args.head), "monitorResult") else null
/* ------ (1) pushing and entering the monitor, also keeping a reference to it in a local var. ------ */
genLoadQualifier(fun)
@@ -215,7 +215,7 @@ abstract class BCodeSyncAndTry extends BCodeBodyBuilder {
* please notice `tmp` has type tree.tpe, while `earlyReturnVar` has the method return type.
* Because those two types can be different, dedicated vars are needed.
*/
- val tmp = if (guardResult) locals.makeLocal(tpeTK(tree), "tmp") else null;
+ val tmp = if (guardResult) locals.makeLocal(tpeTK(tree), "tmp") else null
/*
* upon early return from the try-body or one of its EHs (but not the EH-version of the finally-clause)
@@ -238,6 +238,34 @@ abstract class BCodeSyncAndTry extends BCodeBodyBuilder {
val endTryBody = currProgramPoint()
bc goTo postHandlers
+ /**
+ * A return within a `try` or `catch` block where a `finally` is present ("early return")
+ * emits a store of the result to a local, jump to a "cleanup" version of the `finally` block,
+ * and sets `shouldEmitCleanup = true` (see [[PlainBodyBuilder.genReturn]]).
+ *
+ * If the try-catch is nested, outer `finally` blocks need to be emitted in a cleanup version
+ * as well, so the `shouldEmitCleanup` variable remains `true` until the outermost `finally`.
+ * Nested cleanup `finally` blocks jump to the next enclosing one. For the outermost, we emit
+ * a read of the local variable, a return, and we set `shouldEmitCleanup = false` (see
+ * [[pendingCleanups]]).
+ *
+ * Now, assume we have
+ *
+ * try { return 1 } finally {
+ * try { println() } finally { println() }
+ * }
+ *
+ * Here, the outer `finally` needs a cleanup version, but the inner one does not. The method
+ * here makes sure that `shouldEmitCleanup` is only propagated outwards, not inwards to
+ * nested `finally` blocks.
+ */
+ def withFreshCleanupScope(body: => Unit) = {
+ val savedShouldEmitCleanup = shouldEmitCleanup
+ shouldEmitCleanup = false
+ body
+ shouldEmitCleanup = savedShouldEmitCleanup || shouldEmitCleanup
+ }
+
/* ------ (2) One EH for each case-clause (this does not include the EH-version of the finally-clause)
* An EH in (2) is reached upon abrupt termination of (1).
* An EH in (2) is protected by:
@@ -246,8 +274,7 @@ abstract class BCodeSyncAndTry extends BCodeBodyBuilder {
* ------
*/
- for (ch <- caseHandlers) {
-
+ for (ch <- caseHandlers) withFreshCleanupScope {
// (2.a) emit case clause proper
val startHandler = currProgramPoint()
var endHandler: asm.Label = null
@@ -277,9 +304,13 @@ abstract class BCodeSyncAndTry extends BCodeBodyBuilder {
protect(startTryBody, endTryBody, startHandler, excType)
// (2.c) emit jump to the program point where the finally-clause-for-normal-exit starts, or in effect `after` if no finally-clause was given.
bc goTo postHandlers
-
}
+ // Need to save the state of `shouldEmitCleanup` at this point: while emitting the first
+ // version of the `finally` block below, the variable may become true. But this does not mean
+ // that we need a cleanup version for the current block, only for the enclosing ones.
+ val currentFinallyBlockNeedsCleanup = shouldEmitCleanup
+
/* ------ (3.A) The exception-handler-version of the finally-clause.
* Reached upon abrupt termination of (1) or one of the EHs in (2).
* Protected only by whatever protects the whole try-catch-finally expression.
@@ -288,7 +319,7 @@ abstract class BCodeSyncAndTry extends BCodeBodyBuilder {
// a note on terminology: this is not "postHandlers", despite appearances.
// "postHandlers" as in the source-code view. And from that perspective, both (3.A) and (3.B) are invisible implementation artifacts.
- if (hasFinally) {
+ if (hasFinally) withFreshCleanupScope {
nopIfNeeded(startTryBody)
val finalHandler = currProgramPoint() // version of the finally-clause reached via unhandled exception.
protect(startTryBody, finalHandler, finalHandler, null)
@@ -316,14 +347,11 @@ abstract class BCodeSyncAndTry extends BCodeBodyBuilder {
// this is not "postHandlers" either.
// `shouldEmitCleanup` can be set, and at the same time this try expression may lack a finally-clause.
// In other words, all combinations of (hasFinally, shouldEmitCleanup) are valid.
- if (hasFinally && shouldEmitCleanup) {
- val savedInsideCleanup = insideCleanupBlock
- insideCleanupBlock = true
+ if (hasFinally && currentFinallyBlockNeedsCleanup) {
markProgramPoint(finCleanup)
// regarding return value, the protocol is: in place of a `return-stmt`, a sequence of `adapt, store, jump` are inserted.
emitFinalizer(finalizer, null, isDuplicate = true)
pendingCleanups()
- insideCleanupBlock = savedInsideCleanup
}
/* ------ (4) finally-clause-for-normal-nonEarlyReturn-exit
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/opt/InlineInfoAttribute.scala b/src/compiler/scala/tools/nsc/backend/jvm/opt/InlineInfoAttribute.scala
index 5ce7072c60..16ed9da0e4 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/opt/InlineInfoAttribute.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/opt/InlineInfoAttribute.scala
@@ -157,7 +157,7 @@ object InlineInfoAttribute {
}
/**
- * In order to instruct the ASM framework to de-serialize the ScalaInlineInfo attribute, we need
+ * In order to instruct the ASM framework to deserialize the ScalaInlineInfo attribute, we need
* to pass a prototype instance when running the class reader.
*/
object InlineInfoAttributePrototype extends InlineInfoAttribute(InlineInfo(false, null, null, null))
diff --git a/src/compiler/scala/tools/nsc/javac/JavaScanners.scala b/src/compiler/scala/tools/nsc/javac/JavaScanners.scala
index e11ac94041..f77e53c54b 100644
--- a/src/compiler/scala/tools/nsc/javac/JavaScanners.scala
+++ b/src/compiler/scala/tools/nsc/javac/JavaScanners.scala
@@ -215,7 +215,7 @@ trait JavaScanners extends ast.parser.ScannersCommon {
*
* @author Martin Odersky
*/
- abstract class JavaScanner extends AbstractJavaScanner with JavaTokenData with Cloneable with ScannerCommon {
+ abstract class JavaScanner extends AbstractJavaScanner with JavaTokenData with Cloneable with ScannerCommon with DocScanner {
override def intVal = super.intVal// todo: needed?
override def floatVal = super.floatVal
def currentPos: Position = g2p(pos - 1)
@@ -577,27 +577,32 @@ trait JavaScanners extends ast.parser.ScannersCommon {
}
}
- protected def putCommentChar(): Unit = in.next()
+ final protected def putCommentChar(): Unit = { processCommentChar(); in.next() }
- protected def skipBlockComment(isDoc: Boolean): Unit = in.ch match {
- case SU => incompleteInputError("unclosed comment")
- case '*' => putCommentChar() ; if (in.ch == '/') putCommentChar() else skipBlockComment(isDoc)
- case _ => putCommentChar() ; skipBlockComment(isDoc)
+ @tailrec final protected def skipBlockComment(isDoc: Boolean): Unit = {
+ if (isDoc) beginDocComment("/*") // the second '*' is the current character
+
+ in.ch match {
+ case SU => incompleteInputError("unclosed comment")
+ case '*' => putCommentChar() ; if (in.ch == '/') putCommentChar() else skipBlockComment(isDoc)
+ case _ => putCommentChar() ; skipBlockComment(isDoc)
+ }
}
- protected def skipLineComment(): Unit = in.ch match {
+ @tailrec final protected def skipLineComment(): Unit = in.ch match {
case CR | LF | SU =>
case _ => putCommentChar() ; skipLineComment()
}
- protected def skipComment(): Boolean = in.ch match {
- case '/' => putCommentChar() ; skipLineComment() ; true
+ final protected def skipComment(): Boolean = in.ch match {
+ case '/' => putCommentChar() ; skipLineComment() ; finishDocComment() ; true
case '*' =>
putCommentChar()
in.ch match {
case '*' => skipBlockComment(isDoc = true)
case _ => skipBlockComment(isDoc = false)
}
+ finishDocComment()
true
case _ => false
}
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
index 7e81fad606..1a4671e15f 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
@@ -8,7 +8,7 @@ package tools.nsc
package symtab
package classfile
-import java.io.{File, IOException}
+import java.io.{ByteArrayInputStream, DataInputStream, File, IOException}
import java.lang.Integer.toHexString
import scala.collection.{immutable, mutable}
@@ -212,10 +212,14 @@ abstract class ClassfileParser {
case name: Name => name
case _ =>
val start = firstExpecting(index, CONSTANT_UTF8)
- recordAtIndex(newTermName(in.buf, start + 2, in.getChar(start).toInt), index)
+ val len = in.getChar(start).toInt
+ recordAtIndex(TermName(fromMUTF8(in.buf, start, len + 2)), index)
}
)
+ private def fromMUTF8(bytes: Array[Byte], offset: Int, len: Int): String =
+ new DataInputStream(new ByteArrayInputStream(bytes, offset, len)).readUTF
+
/** Return the name found at given index in the constant pool, with '/' replaced by '.'. */
def getExternalName(index: Int): Name = {
if (index <= 0 || len <= index)
diff --git a/src/compiler/scala/tools/nsc/transform/Mixin.scala b/src/compiler/scala/tools/nsc/transform/Mixin.scala
index 56d11d85a6..de0db51b6c 100644
--- a/src/compiler/scala/tools/nsc/transform/Mixin.scala
+++ b/src/compiler/scala/tools/nsc/transform/Mixin.scala
@@ -64,7 +64,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL with AccessorSynthes
// --------- helper functions -----------------------------------------------
/** A member of a trait is implemented statically if its implementation after the
- * mixin transform is RHS of the method body (destined to be in a interface default method)
+ * mixin transform is RHS of the method body (destined to be in an interface default method)
*
* To be statically implemented, a member must be a method that belonged to the trait's implementation class
* before (i.e. it is not abstract). Not statically implemented are
diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
index f6c667353f..d8fa7b58e8 100644
--- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala
+++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
@@ -747,7 +747,7 @@ abstract class UnCurry extends InfoTransform
if (!dd.symbol.hasAnnotation(VarargsClass) || !enteringUncurry(mexists(dd.symbol.paramss)(sym => definitions.isRepeatedParamType(sym.tpe))))
return flatdd
- val forwSym = currentClass.newMethod(dd.name.toTermName, dd.pos, VARARGS | SYNTHETIC | flatdd.symbol.flags)
+ val forwSym = currentClass.newMethod(dd.name.toTermName, dd.pos, VARARGS | SYNTHETIC | flatdd.symbol.flags & ~DEFERRED)
val isRepeated = enteringUncurry(dd.symbol.info.paramss.flatten.map(sym => definitions.isRepeatedParamType(sym.tpe)))
diff --git a/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala b/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala
index ec493b9507..b6978f37df 100644
--- a/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala
+++ b/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala
@@ -736,7 +736,7 @@ trait MatchAnalysis extends MatchApproximation {
if (expanded.isEmpty) {
List(varAssignment)
} else {
- // we need the cartesian product here,
+ // we need the Cartesian product here,
// since we want to report all missing cases
// (i.e., combinations)
val cartesianProd = expanded.reduceLeft((xs, ys) =>
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index 0cd547c1eb..78e8c8c073 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -142,7 +142,7 @@ trait Namers extends MethodSynthesis {
val ownerHasEnumFlag =
// Necessary to check because scalac puts Java's static members into the companion object
// while Scala's enum constants live directly in the class.
- // We don't check for clazz.superClass == JavaEnumClass, because this causes a illegal
+ // We don't check for clazz.superClass == JavaEnumClass, because this causes an illegal
// cyclic reference error. See the commit message for details.
if (context.unit.isJava) owner.companionClass.hasJavaEnumFlag else owner.hasJavaEnumFlag
vd.mods.hasAllFlags(JAVA_ENUM | STABLE | STATIC) && ownerHasEnumFlag
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index 106b076eef..08cd5e5450 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -472,7 +472,7 @@ abstract class RefChecks extends Transform {
checkOverrideTypes()
checkOverrideDeprecated()
if (settings.warnNullaryOverride) {
- if (other.paramss.isEmpty && !member.paramss.isEmpty) {
+ if (other.paramss.isEmpty && !member.paramss.isEmpty && !member.isJavaDefined) {
reporter.warning(member.pos, "non-nullary method overrides nullary method")
}
}
@@ -1103,7 +1103,7 @@ abstract class RefChecks extends Transform {
// better to have lubbed and lost
def warnIfLubless(): Unit = {
val common = global.lub(List(actual.tpe, receiver.tpe))
- if (ObjectTpe <:< common && !(ObjectTpe <:< actual.tpe && ObjectTpe <:< receiver.tpe))
+ if (ObjectTpe <:< common && !(ObjectTpe <:< actual.tpe) && !(ObjectTpe <:< receiver.tpe))
unrelatedTypes()
}
// warn if actual has a case parent that is not same as receiver's;
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 7d48c548a1..cca6f280e3 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -3139,10 +3139,25 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
val initElems = scope.elems
// SI-5877 The decls of a package include decls of the package object. But we don't want to add
// the corresponding synthetics to the package class, only to the package object class.
- def shouldAdd(sym: Symbol) =
- inBlock || !context.isInPackageObject(sym, context.owner)
+ // SI-6734 Locality test below is meaningless if we're not even in the correct tree.
+ // For modules that are synthetic case companions, check that case class is defined here.
+ def shouldAdd(sym: Symbol): Boolean = {
+ def shouldAddAsModule: Boolean =
+ sym.moduleClass.attachments.get[ClassForCaseCompanionAttachment] match {
+ case Some(att) =>
+ val cdef = att.caseClass
+ stats.exists {
+ case t @ ClassDef(_, _, _, _) => t.symbol == cdef.symbol // cdef ne t
+ case _ => false
+ }
+ case _ => true
+ }
+
+ (!sym.isModule || shouldAddAsModule) && (inBlock || !context.isInPackageObject(sym, context.owner))
+ }
for (sym <- scope)
- for (tree <- context.unit.synthetics get sym if shouldAdd(sym)) { // OPT: shouldAdd is usually true. Call it here, rather than in the outer loop
+ // OPT: shouldAdd is usually true. Call it here, rather than in the outer loop
+ for (tree <- context.unit.synthetics.get(sym) if shouldAdd(sym)) {
newStats += typedStat(tree) // might add even more synthetics to the scope
context.unit.synthetics -= sym
}
diff --git a/src/library/scala/Array.scala b/src/library/scala/Array.scala
index 6d829a9e5d..5d1c25732c 100644
--- a/src/library/scala/Array.scala
+++ b/src/library/scala/Array.scala
@@ -11,7 +11,6 @@ package scala
import scala.collection.generic._
import scala.collection.{ mutable, immutable }
import mutable.{ ArrayBuilder, ArraySeq }
-import scala.compat.Platform.arraycopy
import scala.reflect.ClassTag
import scala.runtime.ScalaRunTime.{ array_apply, array_update }
@@ -102,7 +101,7 @@ object Array extends FallbackArrayBuilding {
def copy(src: AnyRef, srcPos: Int, dest: AnyRef, destPos: Int, length: Int) {
val srcClass = src.getClass
if (srcClass.isArray && dest.getClass.isAssignableFrom(srcClass))
- arraycopy(src, srcPos, dest, destPos, length)
+ java.lang.System.arraycopy(src, srcPos, dest, destPos, length)
else
slowcopy(src, srcPos, dest, destPos, length)
}
diff --git a/src/library/scala/Immutable.scala b/src/library/scala/Immutable.scala
index fead590ef6..c7e96a46a0 100644
--- a/src/library/scala/Immutable.scala
+++ b/src/library/scala/Immutable.scala
@@ -10,7 +10,7 @@
package scala
-/** A marker trait for all immutable datastructures such as immutable
+/** A marker trait for all immutable data structures such as immutable
* collections.
*
* @since 2.8
diff --git a/src/library/scala/Int.scala b/src/library/scala/Int.scala
index b605af5e37..491094cfde 100644
--- a/src/library/scala/Int.scala
+++ b/src/library/scala/Int.scala
@@ -439,10 +439,10 @@ final abstract class Int private extends AnyVal {
}
object Int extends AnyValCompanion {
- /** The smallest value representable as a Int. */
+ /** The smallest value representable as an Int. */
final val MinValue = java.lang.Integer.MIN_VALUE
- /** The largest value representable as a Int. */
+ /** The largest value representable as an Int. */
final val MaxValue = java.lang.Integer.MAX_VALUE
/** Transform a value type into a boxed reference type.
diff --git a/src/library/scala/Option.scala b/src/library/scala/Option.scala
index 39c583e63b..c7894a45b8 100644
--- a/src/library/scala/Option.scala
+++ b/src/library/scala/Option.scala
@@ -107,7 +107,7 @@ sealed abstract class Option[+A] extends Product with Serializable {
def isDefined: Boolean = !isEmpty
/** Returns the option's value.
- * @note The option must be nonEmpty.
+ * @note The option must be nonempty.
* @throws java.util.NoSuchElementException if the option is empty.
*/
def get: A
diff --git a/src/library/scala/Product1.scala b/src/library/scala/Product1.scala
index e82300adf6..3b0194e41f 100644
--- a/src/library/scala/Product1.scala
+++ b/src/library/scala/Product1.scala
@@ -14,7 +14,7 @@ object Product1 {
Some(x)
}
-/** Product1 is a cartesian product of 1 component.
+/** Product1 is a Cartesian product of 1 component.
* @since 2.3
*/
trait Product1[@specialized(Int, Long, Double) +T1] extends Any with Product {
diff --git a/src/library/scala/Product10.scala b/src/library/scala/Product10.scala
index 5fc4874048..8826d95007 100644
--- a/src/library/scala/Product10.scala
+++ b/src/library/scala/Product10.scala
@@ -14,7 +14,7 @@ object Product10 {
Some(x)
}
-/** Product10 is a cartesian product of 10 components.
+/** Product10 is a Cartesian product of 10 components.
* @since 2.3
*/
trait Product10[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10] extends Any with Product {
diff --git a/src/library/scala/Product11.scala b/src/library/scala/Product11.scala
index dcebc90e3e..2a846fff4e 100644
--- a/src/library/scala/Product11.scala
+++ b/src/library/scala/Product11.scala
@@ -14,7 +14,7 @@ object Product11 {
Some(x)
}
-/** Product11 is a cartesian product of 11 components.
+/** Product11 is a Cartesian product of 11 components.
* @since 2.3
*/
trait Product11[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11] extends Any with Product {
diff --git a/src/library/scala/Product12.scala b/src/library/scala/Product12.scala
index 2221170452..87419048d6 100644
--- a/src/library/scala/Product12.scala
+++ b/src/library/scala/Product12.scala
@@ -14,7 +14,7 @@ object Product12 {
Some(x)
}
-/** Product12 is a cartesian product of 12 components.
+/** Product12 is a Cartesian product of 12 components.
* @since 2.3
*/
trait Product12[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12] extends Any with Product {
diff --git a/src/library/scala/Product13.scala b/src/library/scala/Product13.scala
index e76f326766..a944279a2e 100644
--- a/src/library/scala/Product13.scala
+++ b/src/library/scala/Product13.scala
@@ -14,7 +14,7 @@ object Product13 {
Some(x)
}
-/** Product13 is a cartesian product of 13 components.
+/** Product13 is a Cartesian product of 13 components.
* @since 2.3
*/
trait Product13[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13] extends Any with Product {
diff --git a/src/library/scala/Product14.scala b/src/library/scala/Product14.scala
index a076e2cc7a..098721f216 100644
--- a/src/library/scala/Product14.scala
+++ b/src/library/scala/Product14.scala
@@ -14,7 +14,7 @@ object Product14 {
Some(x)
}
-/** Product14 is a cartesian product of 14 components.
+/** Product14 is a Cartesian product of 14 components.
* @since 2.3
*/
trait Product14[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14] extends Any with Product {
diff --git a/src/library/scala/Product15.scala b/src/library/scala/Product15.scala
index 4568aff1fe..ef550c80d2 100644
--- a/src/library/scala/Product15.scala
+++ b/src/library/scala/Product15.scala
@@ -14,7 +14,7 @@ object Product15 {
Some(x)
}
-/** Product15 is a cartesian product of 15 components.
+/** Product15 is a Cartesian product of 15 components.
* @since 2.3
*/
trait Product15[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15] extends Any with Product {
diff --git a/src/library/scala/Product16.scala b/src/library/scala/Product16.scala
index 84dccb0ac8..dd32e2f637 100644
--- a/src/library/scala/Product16.scala
+++ b/src/library/scala/Product16.scala
@@ -14,7 +14,7 @@ object Product16 {
Some(x)
}
-/** Product16 is a cartesian product of 16 components.
+/** Product16 is a Cartesian product of 16 components.
* @since 2.3
*/
trait Product16[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15, +T16] extends Any with Product {
diff --git a/src/library/scala/Product17.scala b/src/library/scala/Product17.scala
index 0d50898bf4..e97cc5189e 100644
--- a/src/library/scala/Product17.scala
+++ b/src/library/scala/Product17.scala
@@ -14,7 +14,7 @@ object Product17 {
Some(x)
}
-/** Product17 is a cartesian product of 17 components.
+/** Product17 is a Cartesian product of 17 components.
* @since 2.3
*/
trait Product17[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15, +T16, +T17] extends Any with Product {
diff --git a/src/library/scala/Product18.scala b/src/library/scala/Product18.scala
index 9b32265d71..1266b77a9f 100644
--- a/src/library/scala/Product18.scala
+++ b/src/library/scala/Product18.scala
@@ -14,7 +14,7 @@ object Product18 {
Some(x)
}
-/** Product18 is a cartesian product of 18 components.
+/** Product18 is a Cartesian product of 18 components.
* @since 2.3
*/
trait Product18[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15, +T16, +T17, +T18] extends Any with Product {
diff --git a/src/library/scala/Product19.scala b/src/library/scala/Product19.scala
index fe6b95669b..4bf5dcf23e 100644
--- a/src/library/scala/Product19.scala
+++ b/src/library/scala/Product19.scala
@@ -14,7 +14,7 @@ object Product19 {
Some(x)
}
-/** Product19 is a cartesian product of 19 components.
+/** Product19 is a Cartesian product of 19 components.
* @since 2.3
*/
trait Product19[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15, +T16, +T17, +T18, +T19] extends Any with Product {
diff --git a/src/library/scala/Product2.scala b/src/library/scala/Product2.scala
index 091bcc89de..93144abeb3 100644
--- a/src/library/scala/Product2.scala
+++ b/src/library/scala/Product2.scala
@@ -14,7 +14,7 @@ object Product2 {
Some(x)
}
-/** Product2 is a cartesian product of 2 components.
+/** Product2 is a Cartesian product of 2 components.
* @since 2.3
*/
trait Product2[@specialized(Int, Long, Double) +T1, @specialized(Int, Long, Double) +T2] extends Any with Product {
diff --git a/src/library/scala/Product20.scala b/src/library/scala/Product20.scala
index 81315e3558..a1dfd469ad 100644
--- a/src/library/scala/Product20.scala
+++ b/src/library/scala/Product20.scala
@@ -14,7 +14,7 @@ object Product20 {
Some(x)
}
-/** Product20 is a cartesian product of 20 components.
+/** Product20 is a Cartesian product of 20 components.
* @since 2.3
*/
trait Product20[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15, +T16, +T17, +T18, +T19, +T20] extends Any with Product {
diff --git a/src/library/scala/Product21.scala b/src/library/scala/Product21.scala
index b5967c06e1..4f01277ad3 100644
--- a/src/library/scala/Product21.scala
+++ b/src/library/scala/Product21.scala
@@ -14,7 +14,7 @@ object Product21 {
Some(x)
}
-/** Product21 is a cartesian product of 21 components.
+/** Product21 is a Cartesian product of 21 components.
* @since 2.3
*/
trait Product21[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15, +T16, +T17, +T18, +T19, +T20, +T21] extends Any with Product {
diff --git a/src/library/scala/Product22.scala b/src/library/scala/Product22.scala
index c7b9da5ce8..cef8d30402 100644
--- a/src/library/scala/Product22.scala
+++ b/src/library/scala/Product22.scala
@@ -14,7 +14,7 @@ object Product22 {
Some(x)
}
-/** Product22 is a cartesian product of 22 components.
+/** Product22 is a Cartesian product of 22 components.
* @since 2.3
*/
trait Product22[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15, +T16, +T17, +T18, +T19, +T20, +T21, +T22] extends Any with Product {
diff --git a/src/library/scala/Product3.scala b/src/library/scala/Product3.scala
index 7154bf5bdf..7da324106d 100644
--- a/src/library/scala/Product3.scala
+++ b/src/library/scala/Product3.scala
@@ -14,7 +14,7 @@ object Product3 {
Some(x)
}
-/** Product3 is a cartesian product of 3 components.
+/** Product3 is a Cartesian product of 3 components.
* @since 2.3
*/
trait Product3[+T1, +T2, +T3] extends Any with Product {
diff --git a/src/library/scala/Product4.scala b/src/library/scala/Product4.scala
index 046f8c7a7c..88e5dea9d3 100644
--- a/src/library/scala/Product4.scala
+++ b/src/library/scala/Product4.scala
@@ -14,7 +14,7 @@ object Product4 {
Some(x)
}
-/** Product4 is a cartesian product of 4 components.
+/** Product4 is a Cartesian product of 4 components.
* @since 2.3
*/
trait Product4[+T1, +T2, +T3, +T4] extends Any with Product {
diff --git a/src/library/scala/Product5.scala b/src/library/scala/Product5.scala
index 3e952c8c55..d8c3ffc190 100644
--- a/src/library/scala/Product5.scala
+++ b/src/library/scala/Product5.scala
@@ -14,7 +14,7 @@ object Product5 {
Some(x)
}
-/** Product5 is a cartesian product of 5 components.
+/** Product5 is a Cartesian product of 5 components.
* @since 2.3
*/
trait Product5[+T1, +T2, +T3, +T4, +T5] extends Any with Product {
diff --git a/src/library/scala/Product6.scala b/src/library/scala/Product6.scala
index 010c68711a..ab50d678fc 100644
--- a/src/library/scala/Product6.scala
+++ b/src/library/scala/Product6.scala
@@ -14,7 +14,7 @@ object Product6 {
Some(x)
}
-/** Product6 is a cartesian product of 6 components.
+/** Product6 is a Cartesian product of 6 components.
* @since 2.3
*/
trait Product6[+T1, +T2, +T3, +T4, +T5, +T6] extends Any with Product {
diff --git a/src/library/scala/Product7.scala b/src/library/scala/Product7.scala
index 24e5a5c05a..efdeb142d1 100644
--- a/src/library/scala/Product7.scala
+++ b/src/library/scala/Product7.scala
@@ -14,7 +14,7 @@ object Product7 {
Some(x)
}
-/** Product7 is a cartesian product of 7 components.
+/** Product7 is a Cartesian product of 7 components.
* @since 2.3
*/
trait Product7[+T1, +T2, +T3, +T4, +T5, +T6, +T7] extends Any with Product {
diff --git a/src/library/scala/Product8.scala b/src/library/scala/Product8.scala
index 4a9f65b00e..743c0ac485 100644
--- a/src/library/scala/Product8.scala
+++ b/src/library/scala/Product8.scala
@@ -14,7 +14,7 @@ object Product8 {
Some(x)
}
-/** Product8 is a cartesian product of 8 components.
+/** Product8 is a Cartesian product of 8 components.
* @since 2.3
*/
trait Product8[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8] extends Any with Product {
diff --git a/src/library/scala/Product9.scala b/src/library/scala/Product9.scala
index 9af11f709a..8d04213cd9 100644
--- a/src/library/scala/Product9.scala
+++ b/src/library/scala/Product9.scala
@@ -14,7 +14,7 @@ object Product9 {
Some(x)
}
-/** Product9 is a cartesian product of 9 components.
+/** Product9 is a Cartesian product of 9 components.
* @since 2.3
*/
trait Product9[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9] extends Any with Product {
diff --git a/src/library/scala/collection/Iterator.scala b/src/library/scala/collection/Iterator.scala
index 1426278954..d000d22f72 100644
--- a/src/library/scala/collection/Iterator.scala
+++ b/src/library/scala/collection/Iterator.scala
@@ -686,15 +686,15 @@ trait Iterator[+A] extends TraversableOnce[A] {
* handling of structural calls. It's not what's intended here.
*/
class Leading extends AbstractIterator[A] {
- var lookahead: mutable.Queue[A] = null
- var hd: A = _
+ private[this] var lookahead: mutable.Queue[A] = null
+ private[this] var hd: A = _
/* Status is kept with magic numbers
* 1 means next element is in hd and we're still reading into this iterator
* 0 means we're still reading but haven't found a next element
* -1 means we are done reading into the iterator, so we must rely on lookahead
* -2 means we are done but have saved hd for the other iterator to use as its first element
*/
- var status = 0
+ private[this] var status = 0
private def store(a: A) {
if (lookahead == null) lookahead = new mutable.Queue[A]
lookahead += a
@@ -718,34 +718,31 @@ trait Iterator[+A] extends TraversableOnce[A] {
}
else empty.next()
}
- def finish(): Boolean = {
- if (status == -1) false
- else if (status == -2) {
+ def finish(): Boolean = status match {
+ case -2 => status = -1 ; true
+ case -1 => false
+ case 1 => store(hd) ; status = 0 ; finish()
+ case 0 =>
status = -1
- true
- }
- else {
- if (status == 1) store(hd)
while (self.hasNext) {
val a = self.next()
if (p(a)) store(a)
else {
hd = a
- status = -1
return true
}
}
false
- }
}
+ def trailer: A = hd
}
val leading = new Leading
val trailing = new AbstractIterator[A] {
private[this] var myLeading = leading
- /* Status flags meanings:
- * -1 not yet accesssed
+ /* Status flag meanings:
+ * -1 not yet accessed
* 0 single element waiting in leading
* 1 defer to self
*/
@@ -770,7 +767,7 @@ trait Iterator[+A] extends TraversableOnce[A] {
if (status > 0) self.next()
else {
status = 1
- val ans = myLeading.hd
+ val ans = myLeading.trailer
myLeading = null
ans
}
diff --git a/src/library/scala/collection/Parallelizable.scala b/src/library/scala/collection/Parallelizable.scala
index b737752458..c131556388 100644
--- a/src/library/scala/collection/Parallelizable.scala
+++ b/src/library/scala/collection/Parallelizable.scala
@@ -12,7 +12,7 @@ package collection
import parallel.Combiner
/** This trait describes collections which can be turned into parallel collections
- * by invoking the method `par`. Parallelizable collections may be parametrized with
+ * by invoking the method `par`. Parallelizable collections may be parameterized with
* a target type different than their own.
*
* @tparam A the type of the elements in the collection
diff --git a/src/library/scala/collection/SetLike.scala b/src/library/scala/collection/SetLike.scala
index 9143c40870..440452ce99 100644
--- a/src/library/scala/collection/SetLike.scala
+++ b/src/library/scala/collection/SetLike.scala
@@ -213,9 +213,9 @@ self =>
}
}
- /** An Iterator include all subsets containing exactly len elements.
+ /** An Iterator including all subsets containing exactly len elements.
* If the elements in 'This' type is ordered, then the subsets will also be in the same order.
- * ListSet(1,2,3).subsets => {1},{2},{3},{1,2},{1,3},{2,3},{1,2,3}}
+ * ListSet(1,2,3).subsets => {{1},{2},{3},{1,2},{1,3},{2,3},{1,2,3}}
*
* @author Eastsun
* @date 2010.12.6
diff --git a/src/library/scala/collection/SortedSet.scala b/src/library/scala/collection/SortedSet.scala
index 43189d2e8c..0fa5ce0966 100644
--- a/src/library/scala/collection/SortedSet.scala
+++ b/src/library/scala/collection/SortedSet.scala
@@ -29,6 +29,6 @@ trait SortedSet[A] extends Set[A] with SortedSetLike[A, SortedSet[A]] {
object SortedSet extends SortedSetFactory[SortedSet] {
def empty[A](implicit ord: Ordering[A]): immutable.SortedSet[A] = immutable.SortedSet.empty[A](ord)
def canBuildFrom[A](implicit ord: Ordering[A]): CanBuildFrom[Coll, A, SortedSet[A]] = newCanBuildFrom[A]
- // Force a declaration here so that BitSet's (which does not inherit from SortedSetFactory) can be more specific
+ // Force a declaration here so that BitSet (which does not inherit from SortedSetFactory) can be more specific
override implicit def newCanBuildFrom[A](implicit ord : Ordering[A]) : CanBuildFrom[Coll, A, SortedSet[A]] = super.newCanBuildFrom
}
diff --git a/src/library/scala/collection/generic/GenTraversableFactory.scala b/src/library/scala/collection/generic/GenTraversableFactory.scala
index 2092c0c5f5..7c2aa5615c 100644
--- a/src/library/scala/collection/generic/GenTraversableFactory.scala
+++ b/src/library/scala/collection/generic/GenTraversableFactory.scala
@@ -229,7 +229,7 @@ extends GenericCompanion[CC] {
/** Produces a $coll containing repeated applications of a function to a start value.
*
* @param start the start value of the $coll
- * @param len the number of elements contained inthe $coll
+ * @param len the number of elements contained in the $coll
* @param f the function that's repeatedly applied
* @return a $coll with `len` values in the sequence `start, f(start), f(f(start)), ...`
*/
diff --git a/src/library/scala/collection/immutable/List.scala b/src/library/scala/collection/immutable/List.scala
index 45b761fc00..e5444533a8 100644
--- a/src/library/scala/collection/immutable/List.scala
+++ b/src/library/scala/collection/immutable/List.scala
@@ -400,7 +400,7 @@ sealed abstract class List[+A] extends AbstractSeq[A]
else new Stream.Cons(head, tail.toStream)
// Create a proxy for Java serialization that allows us to avoid mutation
- // during de-serialization. This is the Serialization Proxy Pattern.
+ // during deserialization. This is the Serialization Proxy Pattern.
protected final def writeReplace(): AnyRef = new List.SerializationProxy(this)
}
@@ -468,7 +468,7 @@ object List extends SeqFactory[List] {
out.writeObject(ListSerializeEnd)
}
- // Java serialization calls this before readResolve during de-serialization.
+ // Java serialization calls this before readResolve during deserialization.
// Read the whole list and store it in `orig`.
private def readObject(in: ObjectInputStream) {
in.defaultReadObject()
diff --git a/src/library/scala/collection/immutable/SetProxy.scala b/src/library/scala/collection/immutable/SetProxy.scala
index e1cf3620a2..b421b48597 100644
--- a/src/library/scala/collection/immutable/SetProxy.scala
+++ b/src/library/scala/collection/immutable/SetProxy.scala
@@ -12,8 +12,7 @@ package scala
package collection
package immutable
-/** This is a simple wrapper class for <a href="Set.html"
- * target="contentFrame">`scala.collection.immutable.Set`</a>.
+/** This is a simple wrapper class for [[scala.collection.immutable.Set]].
*
* It is most useful for assembling customized set abstractions
* dynamically using object composition and forwarding.
diff --git a/src/library/scala/collection/immutable/SortedSet.scala b/src/library/scala/collection/immutable/SortedSet.scala
index 107f77f287..75b2b1f4dc 100644
--- a/src/library/scala/collection/immutable/SortedSet.scala
+++ b/src/library/scala/collection/immutable/SortedSet.scala
@@ -37,6 +37,6 @@ object SortedSet extends ImmutableSortedSetFactory[SortedSet] {
/** $sortedSetCanBuildFromInfo */
def canBuildFrom[A](implicit ord: Ordering[A]): CanBuildFrom[Coll, A, SortedSet[A]] = newCanBuildFrom[A]
def empty[A](implicit ord: Ordering[A]): SortedSet[A] = TreeSet.empty[A]
- // Force a declaration here so that BitSet's (which does not inherit from SortedSetFactory) can be more specific
+ // Force a declaration here so that BitSet (which does not inherit from SortedSetFactory) can be more specific
override implicit def newCanBuildFrom[A](implicit ord : Ordering[A]) : CanBuildFrom[Coll, A, SortedSet[A]] = super.newCanBuildFrom
}
diff --git a/src/library/scala/collection/immutable/Vector.scala b/src/library/scala/collection/immutable/Vector.scala
index a162fdaaf8..d9d925705f 100644
--- a/src/library/scala/collection/immutable/Vector.scala
+++ b/src/library/scala/collection/immutable/Vector.scala
@@ -11,7 +11,6 @@ package collection
package immutable
import scala.annotation.unchecked.uncheckedVariance
-import scala.compat.Platform
import scala.collection.generic._
import scala.collection.mutable.{Builder, ReusableBuilder}
import scala.collection.parallel.immutable.ParVector
@@ -478,12 +477,12 @@ override def companion: GenericCompanion[Vector] = Vector
// if (array eq null)
// println("OUCH!!! " + right + "/" + depth + "/"+startIndex + "/" + endIndex + "/" + focus)
val a2 = new Array[AnyRef](array.length)
- Platform.arraycopy(array, 0, a2, 0, right)
+ java.lang.System.arraycopy(array, 0, a2, 0, right)
a2
}
private def copyRight(array: Array[AnyRef], left: Int): Array[AnyRef] = {
val a2 = new Array[AnyRef](array.length)
- Platform.arraycopy(array, left, a2, left, a2.length - left)
+ java.lang.System.arraycopy(array, left, a2, left, a2.length - left)
a2
}
@@ -955,7 +954,7 @@ private[immutable] trait VectorPointer[T] {
private[immutable] final def copyOf(a: Array[AnyRef]) = {
val b = new Array[AnyRef](a.length)
- Platform.arraycopy(a, 0, b, 0, a.length)
+ java.lang.System.arraycopy(a, 0, b, 0, a.length)
b
}
@@ -1119,7 +1118,7 @@ private[immutable] trait VectorPointer[T] {
private[immutable] final def copyRange(array: Array[AnyRef], oldLeft: Int, newLeft: Int) = {
val elems = new Array[AnyRef](32)
- Platform.arraycopy(array, oldLeft, elems, newLeft, 32 - math.max(newLeft,oldLeft))
+ java.lang.System.arraycopy(array, oldLeft, elems, newLeft, 32 - math.max(newLeft,oldLeft))
elems
}
diff --git a/src/library/scala/collection/mutable/ArrayBuffer.scala b/src/library/scala/collection/mutable/ArrayBuffer.scala
index 167e04ccbd..23d386f729 100644
--- a/src/library/scala/collection/mutable/ArrayBuffer.scala
+++ b/src/library/scala/collection/mutable/ArrayBuffer.scala
@@ -67,7 +67,7 @@ class ArrayBuffer[A](override protected val initialSize: Int)
override def sizeHint(len: Int) {
if (len > size && len >= 1) {
val newarray = new Array[AnyRef](len)
- scala.compat.Platform.arraycopy(array, 0, newarray, 0, size0)
+ java.lang.System.arraycopy(array, 0, newarray, 0, size0)
array = newarray
}
}
diff --git a/src/library/scala/collection/mutable/HashTable.scala b/src/library/scala/collection/mutable/HashTable.scala
index bb15788bdf..a6a6e1e432 100644
--- a/src/library/scala/collection/mutable/HashTable.scala
+++ b/src/library/scala/collection/mutable/HashTable.scala
@@ -396,7 +396,7 @@ private[collection] object HashTable {
/** The load factor for the hash table (in 0.001 step).
*/
private[collection] final def defaultLoadFactor: Int = 750 // corresponds to 75%
- private[collection] final def loadFactorDenum = 1000
+ private[collection] final def loadFactorDenum = 1000 // should be loadFactorDenom, but changing that isn't binary compatible
private[collection] final def newThreshold(_loadFactor: Int, size: Int) = ((size.toLong * _loadFactor) / loadFactorDenum).toInt
diff --git a/src/library/scala/collection/mutable/History.scala b/src/library/scala/collection/mutable/History.scala
index 19148c0ac2..13e2f32225 100644
--- a/src/library/scala/collection/mutable/History.scala
+++ b/src/library/scala/collection/mutable/History.scala
@@ -1,6 +1,6 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/tPFL **
+** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
diff --git a/src/library/scala/collection/mutable/PriorityQueue.scala b/src/library/scala/collection/mutable/PriorityQueue.scala
index 107a2bfa0e..ed43ef6db9 100644
--- a/src/library/scala/collection/mutable/PriorityQueue.scala
+++ b/src/library/scala/collection/mutable/PriorityQueue.scala
@@ -331,8 +331,8 @@ sealed class PriorityQueue[A](implicit val ord: Ordering[A])
val pq = new PriorityQueue[A]
val n = resarr.p_size0
pq.resarr.p_ensureSize(n)
+ java.lang.System.arraycopy(resarr.p_array, 1, pq.resarr.p_array, 1, n-1)
pq.resarr.p_size0 = n
- scala.compat.Platform.arraycopy(resarr.p_array, 1, pq.resarr.p_array, 1, n-1)
pq
}
}
diff --git a/src/library/scala/collection/mutable/ResizableArray.scala b/src/library/scala/collection/mutable/ResizableArray.scala
index 85a299216e..50d3513784 100644
--- a/src/library/scala/collection/mutable/ResizableArray.scala
+++ b/src/library/scala/collection/mutable/ResizableArray.scala
@@ -101,7 +101,7 @@ trait ResizableArray[A] extends IndexedSeq[A]
if (newSize > Int.MaxValue) newSize = Int.MaxValue
val newArray: Array[AnyRef] = new Array(newSize.toInt)
- scala.compat.Platform.arraycopy(array, 0, newArray, 0, size0)
+ java.lang.System.arraycopy(array, 0, newArray, 0, size0)
array = newArray
}
}
diff --git a/src/library/scala/collection/mutable/ReusableBuilder.scala b/src/library/scala/collection/mutable/ReusableBuilder.scala
index 83a4fcfc29..dee2cd6393 100644
--- a/src/library/scala/collection/mutable/ReusableBuilder.scala
+++ b/src/library/scala/collection/mutable/ReusableBuilder.scala
@@ -35,7 +35,7 @@ trait ReusableBuilder[-Elem, +To] extends Builder[Elem, To] {
* If executed immediately after a call to `result`, this allows a new
* instance of the same type of collection to be built.
*/
- override def clear(): Unit // Note: overriding for scaladoc only!
+ override def clear(): Unit // Note: overriding for Scaladoc only!
/** Produces a collection from the added elements.
*
@@ -45,5 +45,5 @@ trait ReusableBuilder[-Elem, +To] extends Builder[Elem, To] {
*
* @return a collection containing the elements added to this builder.
*/
- override def result(): To // Note: overriding for scaladoc only!
+ override def result(): To // Note: overriding for Scaladoc only!
}
diff --git a/src/library/scala/collection/parallel/TaskSupport.scala b/src/library/scala/collection/parallel/TaskSupport.scala
index 728605af7b..4d633253ce 100644
--- a/src/library/scala/collection/parallel/TaskSupport.scala
+++ b/src/library/scala/collection/parallel/TaskSupport.scala
@@ -16,7 +16,7 @@ import scala.concurrent.ExecutionContext
/** A trait implementing the scheduling of a parallel collection operation.
*
* Parallel collections are modular in the way operations are scheduled. Each
- * parallel collection is parametrized with a task support object which is
+ * parallel collection is parameterized with a task support object which is
* responsible for scheduling and load-balancing tasks to processors.
*
* A task support object can be changed in a parallel collection after it has
@@ -71,7 +71,7 @@ extends TaskSupport with AdaptiveWorkStealingThreadPoolTasks
* forkjoin based task support or a thread pool executor one, depending on
* what the execution context uses.
*
- * By default, parallel collections are parametrized with this task support
+ * By default, parallel collections are parameterized with this task support
* object, so parallel collections share the same execution context backend
* as the rest of the `scala.concurrent` package.
*
diff --git a/src/library/scala/collection/parallel/immutable/ParRange.scala b/src/library/scala/collection/parallel/immutable/ParRange.scala
index 8fd5382ce9..de2b53a6c0 100644
--- a/src/library/scala/collection/parallel/immutable/ParRange.scala
+++ b/src/library/scala/collection/parallel/immutable/ParRange.scala
@@ -107,6 +107,7 @@ self =>
}
}
+ override def toString = s"Par$range"
}
object ParRange {
diff --git a/src/library/scala/concurrent/duration/Duration.scala b/src/library/scala/concurrent/duration/Duration.scala
index f69030bd3d..d912f614c2 100644
--- a/src/library/scala/concurrent/duration/Duration.scala
+++ b/src/library/scala/concurrent/duration/Duration.scala
@@ -47,7 +47,7 @@ object Duration {
* whitespace is allowed before, between and after the parts. Infinities are
* designated by `"Inf"`, `"PlusInf"`, `"+Inf"` and `"-Inf"` or `"MinusInf"`.
*
- * @throws NumberFormatException if format is not parseable
+ * @throws NumberFormatException if format is not parsable
*/
def apply(s: String): Duration = {
val s1: String = s filterNot (_.isWhitespace)
@@ -120,7 +120,7 @@ object Duration {
def fromNanos(nanos: Double): Duration = {
if (nanos.isInfinite)
if (nanos > 0) Inf else MinusInf
- else if (nanos.isNaN)
+ else if (JDouble.isNaN(nanos))
Undefined
else if (nanos > Long.MaxValue || nanos < Long.MinValue)
throw new IllegalArgumentException("trying to construct too large duration with " + nanos + "ns")
@@ -196,11 +196,11 @@ object Duration {
}
def *(factor: Double): Duration =
- if (factor == 0d || factor.isNaN) Undefined
+ if (factor == 0d || JDouble.isNaN(factor)) Undefined
else if (factor < 0d) -this
else this
def /(divisor: Double): Duration =
- if (divisor.isNaN || divisor.isInfinite) Undefined
+ if (JDouble.isNaN(divisor) || divisor.isInfinite) Undefined
else if ((divisor compare 0d) < 0) -this
else this
def /(divisor: Duration): Double = divisor match {
@@ -285,7 +285,7 @@ object Duration {
* whitespace is allowed before, between and after the parts. Infinities are
* designated by `"Inf"`, `"PlusInf"`, `"+Inf"` and `"-Inf"` or `"MinusInf"`.
*
- * @throws NumberFormatException if format is not parseable
+ * @throws NumberFormatException if format is not parsable
*/
def create(s: String): Duration = apply(s)
@@ -627,13 +627,13 @@ final class FiniteDuration(val length: Long, val unit: TimeUnit) extends Duratio
def *(factor: Double) =
if (!factor.isInfinite) fromNanos(toNanos * factor)
- else if (factor.isNaN) Undefined
+ else if (JDouble.isNaN(factor)) Undefined
else if ((factor > 0) ^ (this < Zero)) Inf
else MinusInf
def /(divisor: Double) =
if (!divisor.isInfinite) fromNanos(toNanos / divisor)
- else if (divisor.isNaN) Undefined
+ else if (JDouble.isNaN(divisor)) Undefined
else Zero
// if this is made a constant, then scalac will elide the conditional and always return +0.0, SI-6331
diff --git a/src/library/scala/concurrent/impl/ExecutionContextImpl.scala b/src/library/scala/concurrent/impl/ExecutionContextImpl.scala
index 7bf5cc5729..19233d7531 100644
--- a/src/library/scala/concurrent/impl/ExecutionContextImpl.scala
+++ b/src/library/scala/concurrent/impl/ExecutionContextImpl.scala
@@ -100,7 +100,7 @@ private[concurrent] object ExecutionContextImpl {
val numThreads = getInt("scala.concurrent.context.numThreads", "x1")
// The hard limit on the number of active threads that the thread factory will produce
// SI-8955 Deadlocks can happen if maxNoOfThreads is too low, although we're currently not sure
- // about what the exact threshhold is. numThreads + 256 is conservatively high.
+ // about what the exact threshold is. numThreads + 256 is conservatively high.
val maxNoOfThreads = getInt("scala.concurrent.context.maxThreads", "x1")
val desiredParallelism = range(
diff --git a/src/library/scala/concurrent/impl/Promise.scala b/src/library/scala/concurrent/impl/Promise.scala
index 626540425f..7fcc8c9f2d 100644
--- a/src/library/scala/concurrent/impl/Promise.scala
+++ b/src/library/scala/concurrent/impl/Promise.scala
@@ -384,7 +384,7 @@ private[concurrent] object Promise {
private[this] final def thisAs[S]: Future[S] = future.asInstanceOf[Future[S]]
override def onSuccess[U](pf: PartialFunction[T, U])(implicit executor: ExecutionContext): Unit = ()
- override def failed: Future[Throwable] = thisAs[Throwable]
+ override def failed: Future[Throwable] = KeptPromise(Success(result.exception)).future
override def foreach[U](f: T => U)(implicit executor: ExecutionContext): Unit = ()
override def map[S](f: T => S)(implicit executor: ExecutionContext): Future[S] = thisAs[S]
override def flatMap[S](f: T => Future[S])(implicit executor: ExecutionContext): Future[S] = thisAs[S]
diff --git a/src/library/scala/io/Source.scala b/src/library/scala/io/Source.scala
index 7513b423a1..b4f542a252 100644
--- a/src/library/scala/io/Source.scala
+++ b/src/library/scala/io/Source.scala
@@ -59,7 +59,7 @@ object Source {
def fromFile(name: String, enc: String): BufferedSource =
fromFile(name)(Codec(enc))
- /** creates `ource` from file with given file `URI`.
+ /** creates `source` from file with given file `URI`.
*/
def fromFile(uri: URI)(implicit codec: Codec): BufferedSource =
fromFile(new JFile(uri))(codec)
diff --git a/src/library/scala/math/BigInt.scala b/src/library/scala/math/BigInt.scala
index 3ae3b9bf6c..707a5c0769 100644
--- a/src/library/scala/math/BigInt.scala
+++ b/src/library/scala/math/BigInt.scala
@@ -160,8 +160,8 @@ final class BigInt(val bigInteger: BigInteger)
}
) && !bitLengthOverflow
}
- /** Some implementations of java.math.BigInteger allow huge values with bit length greater than Int.MaxValue .
- * The BigInteger.bitLength method returns truncated bit length in this case .
+ /** Some implementations of java.math.BigInteger allow huge values with bit length greater than Int.MaxValue.
+ * The BigInteger.bitLength method returns truncated bit length in this case.
* This method tests if result of bitLength is valid.
* This method will become unnecessary if BigInt constructors reject huge BigIntegers.
*/
diff --git a/src/library/scala/reflect/ClassManifestDeprecatedApis.scala b/src/library/scala/reflect/ClassManifestDeprecatedApis.scala
index cd46f0ff76..d2ae10747d 100644
--- a/src/library/scala/reflect/ClassManifestDeprecatedApis.scala
+++ b/src/library/scala/reflect/ClassManifestDeprecatedApis.scala
@@ -143,8 +143,8 @@ trait ClassManifestDeprecatedApis[T] extends OptManifest[T] {
* This is done to prevent avalanches of deprecation warnings in the code that calls methods with manifests.
*
* In a perfect world, we would just remove the @deprecated annotation from `ClassManifest` the object
- * and then delete it in 2.11. After all, that object is explicitly marked as internal, so noone should use it.
- * However a lot of existing libraries disregarded the scaladoc that comes with `ClassManifest`,
+ * and then delete it in 2.11. After all, that object is explicitly marked as internal, so no one should use it.
+ * However a lot of existing libraries disregarded the Scaladoc that comes with `ClassManifest`,
* so we need to somehow nudge them into migrating prior to removing stuff out of the blue.
* Hence we've introduced this design decision as the lesser of two evils.
*/
diff --git a/src/library/scala/sys/process/ProcessBuilder.scala b/src/library/scala/sys/process/ProcessBuilder.scala
index fe4c30ee50..8288d8d480 100644
--- a/src/library/scala/sys/process/ProcessBuilder.scala
+++ b/src/library/scala/sys/process/ProcessBuilder.scala
@@ -342,7 +342,7 @@ object ProcessBuilder extends ProcessBuilderImpl {
/** Writes the output stream of this process to a [[scala.sys.process.ProcessBuilder]]. */
def #>(b: ProcessBuilder): ProcessBuilder = new PipedBuilder(toSource, b, false)
- /** Returnes a [[scala.sys.process.ProcessBuilder]] representing this `Source`. */
+ /** Returns a [[scala.sys.process.ProcessBuilder]] representing this `Source`. */
def cat = toSource
private def toFile(f: File, append: Boolean) = #> (new FileOutput(f, append))
}
diff --git a/src/library/scala/sys/process/package.scala b/src/library/scala/sys/process/package.scala
index bf4287dfc3..440e62b6aa 100644
--- a/src/library/scala/sys/process/package.scala
+++ b/src/library/scala/sys/process/package.scala
@@ -185,8 +185,8 @@ package scala.sys {
* new URL("http://www.scala-lang.org/") #> new File("scala-lang.html") !
* }}}
*
- * More information about the other ways of controlling I/O can be looked at
- * in the scaladoc for the associated objects, traits and classes.
+ * More information about the other ways of controlling I/O can be found
+ * in the Scaladoc for the associated objects, traits and classes.
*
* ==Running the Process==
*
diff --git a/src/library/scala/util/Either.scala b/src/library/scala/util/Either.scala
index 7bded972f2..523c10c483 100644
--- a/src/library/scala/util/Either.scala
+++ b/src/library/scala/util/Either.scala
@@ -74,7 +74,7 @@ package util
* } yield a + b + c // Left(23.0)
*
* // It is advisable to provide the type of the “missing” value (especially the right value for `Left`)
- * // as otherwise that type might be infered as `Nothing` without context:
+ * // as otherwise that type might be inferred as `Nothing` without context:
* for {
* a <- left23
* b <- right1
diff --git a/src/library/scala/util/Properties.scala b/src/library/scala/util/Properties.scala
index 9d62bfe6ef..7b21351cf6 100644
--- a/src/library/scala/util/Properties.scala
+++ b/src/library/scala/util/Properties.scala
@@ -217,12 +217,6 @@ private[scala] trait PropertiesTrait {
}
}
- /** Tests whether the major version of the platform specification is at least the given value.
- *
- * @param version a major version number
- */
- def isJavaAtLeast(version: Int): Boolean = isJavaAtLeast(version.toString)
-
// provide a main method so version info can be obtained by running this
def main(args: Array[String]) {
val writer = new PrintWriter(Console.err, true)
diff --git a/src/manual/scala/man1/scalac.scala b/src/manual/scala/man1/scalac.scala
index 79c175e0f0..b4d479cb85 100644
--- a/src/manual/scala/man1/scalac.scala
+++ b/src/manual/scala/man1/scalac.scala
@@ -180,7 +180,7 @@ object scalac extends Command {
Mono(Bold("@") & Argument("file")),
"A text file containing compiler arguments (options and source files)")
- // TODO - Add macros an dsuch here.
+ // TODO - Add macros and such here.
)
),
@@ -474,7 +474,7 @@ object scalac extends Command {
val exitStatus = Section("EXIT STATUS",
- MBold(command) & " returns a zero exist status if it succeeds to " &
+ MBold(command) & " returns a zero exit status if it succeeds to " &
"compile the specified input files. Non zero is returned in case " &
"of failure.")
diff --git a/src/manual/scala/man1/scalap.scala b/src/manual/scala/man1/scalap.scala
index 472b522e17..b58fe6a81f 100644
--- a/src/manual/scala/man1/scalap.scala
+++ b/src/manual/scala/man1/scalap.scala
@@ -76,7 +76,7 @@ object scalap extends Command {
val exitStatus = Section("EXIT STATUS",
- MBold(command) & " returns a zero exist status if it succeeds to process " &
+ MBold(command) & " returns a zero exit status if it succeeds to process " &
"the specified input files. Non zero is returned in case of failure.")
override val authors = Section("AUTHOR",
diff --git a/src/partest-extras/scala/org/scalacheck/Arbitrary.scala b/src/partest-extras/scala/org/scalacheck/Arbitrary.scala
deleted file mode 100644
index 1cbd668f0c..0000000000
--- a/src/partest-extras/scala/org/scalacheck/Arbitrary.scala
+++ /dev/null
@@ -1,433 +0,0 @@
-/*-------------------------------------------------------------------------*\
-** ScalaCheck **
-** Copyright (c) 2007-2014 Rickard Nilsson. All rights reserved. **
-** http://www.scalacheck.org **
-** **
-** This software is released under the terms of the Revised BSD License. **
-** There is NO WARRANTY. See the file LICENSE for the full text. **
-\*------------------------------------------------------------------------ */
-
-package org.scalacheck
-
-import util.{FreqMap, Buildable, Buildable2}
-
-
-sealed abstract class Arbitrary[T] {
- val arbitrary: Gen[T]
-}
-
-/** Defines implicit [[org.scalacheck.Arbitrary]] instances for common types.
- * <p>
- * ScalaCheck
- * uses implicit [[org.scalacheck.Arbitrary]] instances when creating properties
- * out of functions with the `Prop.property` method, and when
- * the `Arbitrary.arbitrary` method is used. For example, the
- * following code requires that there exists an implicit
- * `Arbitrary[MyClass]` instance:
- * </p>
- *
- * {{{
- * val myProp = Prop.forAll { myClass: MyClass =>
- * ...
- * }
- *
- * val myGen = Arbitrary.arbitrary[MyClass]
- * }}}
- *
- * <p>
- * The required implicit definition could look like this:
- * </p>
- *
- * {{{
- * implicit val arbMyClass: Arbitrary[MyClass] = Arbitrary(...)
- * }}}
- *
- * <p>
- * The factory method `Arbitrary(...)` takes a generator of type
- * `Gen[T]` and returns an instance of `Arbitrary[T]`.
- * </p>
- *
- * <p>
- * The `Arbitrary` module defines implicit [[org.scalacheck.Arbitrary]]
- * instances for common types, for convenient use in your properties and
- * generators.
- * </p>
- */
-object Arbitrary {
-
- import Gen.{const, choose, sized, frequency, oneOf, containerOf, resize}
- import collection.{immutable, mutable}
- import java.util.Date
-
- /** Creates an Arbitrary instance */
- def apply[T](g: => Gen[T]): Arbitrary[T] = new Arbitrary[T] {
- lazy val arbitrary = g
- }
-
- /** Returns an arbitrary generator for the type T. */
- def arbitrary[T](implicit a: Arbitrary[T]): Gen[T] = a.arbitrary
-
- /**** Arbitrary instances for each AnyVal ****/
-
- /** Arbitrary AnyVal */
- implicit lazy val arbAnyVal: Arbitrary[AnyVal] = Arbitrary(oneOf(
- arbitrary[Unit], arbitrary[Boolean], arbitrary[Char], arbitrary[Byte],
- arbitrary[Short], arbitrary[Int], arbitrary[Long], arbitrary[Float],
- arbitrary[Double]
- ))
-
- /** Arbitrary instance of Boolean */
- implicit lazy val arbBool: Arbitrary[Boolean] =
- Arbitrary(oneOf(true, false))
-
- /** Arbitrary instance of Int */
- implicit lazy val arbInt: Arbitrary[Int] = Arbitrary(
- Gen.chooseNum(Int.MinValue, Int.MaxValue)
- )
-
- /** Arbitrary instance of Long */
- implicit lazy val arbLong: Arbitrary[Long] = Arbitrary(
- Gen.chooseNum(Long.MinValue, Long.MaxValue)
- )
-
- /** Arbitrary instance of Float */
- implicit lazy val arbFloat: Arbitrary[Float] = Arbitrary(
- Gen.chooseNum(
- Float.MinValue, Float.MaxValue
- // I find that including these by default is a little TOO testy.
- // Float.Epsilon, Float.NaN, Float.PositiveInfinity, Float.NegativeInfinity
- )
- )
-
- /** Arbitrary instance of Double */
- implicit lazy val arbDouble: Arbitrary[Double] = Arbitrary(
- Gen.chooseNum(
- Double.MinValue / 2, Double.MaxValue / 2
- // As above. Perhaps behind some option?
- // Double.Epsilon, Double.NaN, Double.PositiveInfinity, Double.NegativeInfinity
- )
- )
-
- /** Arbitrary instance of Char */
- implicit lazy val arbChar: Arbitrary[Char] = Arbitrary(
- Gen.frequency(
- (0xD800-Char.MinValue, Gen.choose[Char](Char.MinValue,0xD800-1)),
- (Char.MaxValue-0xDFFF, Gen.choose[Char](0xDFFF+1,Char.MaxValue))
- )
- )
-
- /** Arbitrary instance of Byte */
- implicit lazy val arbByte: Arbitrary[Byte] = Arbitrary(
- Gen.chooseNum(Byte.MinValue, Byte.MaxValue)
- )
-
- /** Arbitrary instance of Short */
- implicit lazy val arbShort: Arbitrary[Short] = Arbitrary(
- Gen.chooseNum(Short.MinValue, Short.MaxValue)
- )
-
- /** Absolutely, totally, 100% arbitrarily chosen Unit. */
- implicit lazy val arbUnit: Arbitrary[Unit] = Arbitrary(const(()))
-
- /**** Arbitrary instances of other common types ****/
-
- /** Arbitrary instance of String */
- implicit lazy val arbString: Arbitrary[String] =
- Arbitrary(arbitrary[List[Char]] map (_.mkString))
-
- /** Arbitrary instance of Date */
- implicit lazy val arbDate: Arbitrary[Date] = Arbitrary(for {
- l <- arbitrary[Long]
- d = new Date
- } yield new Date(d.getTime + l))
-
- /** Arbitrary instance of Throwable */
- implicit lazy val arbThrowable: Arbitrary[Throwable] =
- Arbitrary(oneOf(const(new Exception), const(new Error)))
-
- /** Arbitrary instance of Exception */
- implicit lazy val arbException: Arbitrary[Exception] =
- Arbitrary(const(new Exception))
-
- /** Arbitrary instance of Error */
- implicit lazy val arbError: Arbitrary[Error] =
- Arbitrary(const(new Error))
-
- /** Arbitrary BigInt */
- implicit lazy val arbBigInt: Arbitrary[BigInt] = {
- def chooseBigInt: Gen[BigInt] =
- sized((s: Int) => choose(-s, s)) map (x => BigInt(x))
-
- def chooseReallyBigInt: Gen[BigInt] = for {
- bi <- chooseBigInt
- n <- choose(32,128)
- } yield bi << n
-
- Arbitrary(
- frequency(
- (5, chooseBigInt),
- (10, chooseReallyBigInt),
- (1, BigInt(0)),
- (1, BigInt(1)),
- (1, BigInt(-1)),
- (1, BigInt(Int.MaxValue) + 1),
- (1, BigInt(Int.MinValue) - 1),
- (1, BigInt(Long.MaxValue)),
- (1, BigInt(Long.MinValue)),
- (1, BigInt(Long.MaxValue) + 1),
- (1, BigInt(Long.MinValue) - 1)
- )
- )
- }
-
- /** Arbitrary BigDecimal */
- implicit lazy val arbBigDecimal: Arbitrary[BigDecimal] = {
- import java.math.MathContext._
- val mcGen = oneOf(UNLIMITED, DECIMAL32, DECIMAL64, DECIMAL128)
- val bdGen = for {
- x <- arbBigInt.arbitrary
- mc <- mcGen
- limit <- const(if(mc == UNLIMITED) 0 else math.max(x.abs.toString.length - mc.getPrecision, 0))
- scale <- Gen.chooseNum(Int.MinValue + limit , Int.MaxValue)
- } yield {
- try {
- BigDecimal(x, scale, mc)
- } catch {
- case ae: java.lang.ArithmeticException => BigDecimal(x, scale, UNLIMITED) // Handle the case where scale/precision conflict
- }
- }
- Arbitrary(bdGen)
- }
-
- /** Arbitrary java.lang.Number */
- implicit lazy val arbNumber: Arbitrary[Number] = {
- val gen = Gen.oneOf(
- arbitrary[Byte], arbitrary[Short], arbitrary[Int], arbitrary[Long],
- arbitrary[Float], arbitrary[Double]
- )
- Arbitrary(gen map (_.asInstanceOf[Number]))
- // XXX TODO - restore BigInt and BigDecimal
- // Arbitrary(oneOf(arbBigInt.arbitrary :: (arbs map (_.arbitrary) map toNumber) : _*))
- }
-
- /** Generates an arbitrary property */
- implicit lazy val arbProp: Arbitrary[Prop] = {
- import Prop._
- val undecidedOrPassed = forAll { b: Boolean =>
- b ==> true
- }
- Arbitrary(frequency(
- (4, falsified),
- (4, passed),
- (3, proved),
- (3, undecidedOrPassed),
- (2, undecided),
- (1, exception(null))
- ))
- }
-
- /** Arbitrary instance of test parameters */
- implicit lazy val arbTestParameters: Arbitrary[Test.Parameters] =
- Arbitrary(for {
- _minSuccTests <- choose(10,200)
- _maxDiscardRatio <- choose(0.2f,10f)
- _minSize <- choose(0,500)
- sizeDiff <- choose(0,500)
- _maxSize <- choose(_minSize, _minSize + sizeDiff)
- _workers <- choose(1,4)
- } yield new Test.Parameters.Default {
- override val minSuccessfulTests = _minSuccTests
- override val maxDiscardRatio = _maxDiscardRatio
- override val minSize = _minSize
- override val maxSize = _maxSize
- override val workers = _workers
- })
-
- /** Arbitrary instance of gen params */
- implicit lazy val arbGenParams: Arbitrary[Gen.Parameters] =
- Arbitrary(for {
- sz <- arbitrary[Int] suchThat (_ >= 0)
- } yield (new Gen.Parameters.Default {
- override val size = sz
- }))
-
-
- // Higher-order types //
-
- /** Arbitrary instance of [[org.scalacheck.Gen]] */
- implicit def arbGen[T](implicit a: Arbitrary[T]): Arbitrary[Gen[T]] =
- Arbitrary(frequency(
- (5, arbitrary[T] map (const(_))),
- (1, Gen.fail)
- ))
-
- /** Arbitrary instance of the Option type */
- implicit def arbOption[T](implicit a: Arbitrary[T]): Arbitrary[Option[T]] =
- Arbitrary(sized(n =>
- // When n is larger, make it less likely that we generate None,
- // but still do it some of the time. When n is zero, we always
- // generate None, since it's the smallest value.
- frequency(
- (n, resize(n / 2, arbitrary[T]).map(Some(_))),
- (1, const(None)))))
-
- /** Arbitrary instance of the Either type */
- implicit def arbEither[T, U](implicit at: Arbitrary[T], au: Arbitrary[U]): Arbitrary[Either[T, U]] =
- Arbitrary(oneOf(arbitrary[T].map(Left(_)), arbitrary[U].map(Right(_))))
-
- /** Arbitrary instance of any [[org.scalacheck.util.Buildable]] container
- * (such as lists, arrays, streams, etc). The maximum size of the container
- * depends on the size generation parameter. */
- implicit def arbContainer[C[_],T](implicit
- a: Arbitrary[T], b: Buildable[T,C], t: C[T] => Traversable[T]
- ): Arbitrary[C[T]] = Arbitrary(containerOf[C,T](arbitrary[T]))
-
- /** Arbitrary instance of any [[org.scalacheck.util.Buildable2]] container
- * (such as maps, etc). The maximum size of the container depends on the size
- * generation parameter. */
- implicit def arbContainer2[C[_,_],T,U](implicit
- a: Arbitrary[(T,U)], b: Buildable2[T,U,C], t: C[T,U] => Traversable[(T,U)]
- ): Arbitrary[C[T,U]] = Arbitrary(containerOf[C,T,U](arbitrary[(T,U)]))
-
- // Functions //
-
- /** Arbitrary instance of Function1 */
- implicit def arbFunction1[T1,R](implicit a: Arbitrary[R]
- ): Arbitrary[T1 => R] = Arbitrary(
- for(r <- arbitrary[R]) yield (t1: T1) => r
- )
-
- /** Arbitrary instance of Function2 */
- implicit def arbFunction2[T1,T2,R](implicit a: Arbitrary[R]
- ): Arbitrary[(T1,T2) => R] = Arbitrary(
- for(r <- arbitrary[R]) yield (t1: T1, t2: T2) => r
- )
-
- /** Arbitrary instance of Function3 */
- implicit def arbFunction3[T1,T2,T3,R](implicit a: Arbitrary[R]
- ): Arbitrary[(T1,T2,T3) => R] = Arbitrary(
- for(r <- arbitrary[R]) yield (t1: T1, t2: T2, t3: T3) => r
- )
-
- /** Arbitrary instance of Function4 */
- implicit def arbFunction4[T1,T2,T3,T4,R](implicit a: Arbitrary[R]
- ): Arbitrary[(T1,T2,T3,T4) => R] = Arbitrary(
- for(r <- arbitrary[R]) yield (t1: T1, t2: T2, t3: T3, t4: T4) => r
- )
-
- /** Arbitrary instance of Function5 */
- implicit def arbFunction5[T1,T2,T3,T4,T5,R](implicit a: Arbitrary[R]
- ): Arbitrary[(T1,T2,T3,T4,T5) => R] = Arbitrary(
- for(r <- arbitrary[R]) yield (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => r
- )
-
-
- // Tuples //
-
- /** Arbitrary instance of 2-tuple */
- implicit def arbTuple2[T1,T2](implicit
- a1: Arbitrary[T1], a2: Arbitrary[T2]
- ): Arbitrary[(T1,T2)] =
- Arbitrary(for {
- t1 <- arbitrary[T1]
- t2 <- arbitrary[T2]
- } yield (t1,t2))
-
- /** Arbitrary instance of 3-tuple */
- implicit def arbTuple3[T1,T2,T3](implicit
- a1: Arbitrary[T1], a2: Arbitrary[T2], a3: Arbitrary[T3]
- ): Arbitrary[(T1,T2,T3)] =
- Arbitrary(for {
- t1 <- arbitrary[T1]
- t2 <- arbitrary[T2]
- t3 <- arbitrary[T3]
- } yield (t1,t2,t3))
-
- /** Arbitrary instance of 4-tuple */
- implicit def arbTuple4[T1,T2,T3,T4](implicit
- a1: Arbitrary[T1], a2: Arbitrary[T2], a3: Arbitrary[T3], a4: Arbitrary[T4]
- ): Arbitrary[(T1,T2,T3,T4)] =
- Arbitrary(for {
- t1 <- arbitrary[T1]
- t2 <- arbitrary[T2]
- t3 <- arbitrary[T3]
- t4 <- arbitrary[T4]
- } yield (t1,t2,t3,t4))
-
- /** Arbitrary instance of 5-tuple */
- implicit def arbTuple5[T1,T2,T3,T4,T5](implicit
- a1: Arbitrary[T1], a2: Arbitrary[T2], a3: Arbitrary[T3], a4: Arbitrary[T4],
- a5: Arbitrary[T5]
- ): Arbitrary[(T1,T2,T3,T4,T5)] =
- Arbitrary(for {
- t1 <- arbitrary[T1]
- t2 <- arbitrary[T2]
- t3 <- arbitrary[T3]
- t4 <- arbitrary[T4]
- t5 <- arbitrary[T5]
- } yield (t1,t2,t3,t4,t5))
-
- /** Arbitrary instance of 6-tuple */
- implicit def arbTuple6[T1,T2,T3,T4,T5,T6](implicit
- a1: Arbitrary[T1], a2: Arbitrary[T2], a3: Arbitrary[T3], a4: Arbitrary[T4],
- a5: Arbitrary[T5], a6: Arbitrary[T6]
- ): Arbitrary[(T1,T2,T3,T4,T5,T6)] =
- Arbitrary(for {
- t1 <- arbitrary[T1]
- t2 <- arbitrary[T2]
- t3 <- arbitrary[T3]
- t4 <- arbitrary[T4]
- t5 <- arbitrary[T5]
- t6 <- arbitrary[T6]
- } yield (t1,t2,t3,t4,t5,t6))
-
- /** Arbitrary instance of 7-tuple */
- implicit def arbTuple7[T1,T2,T3,T4,T5,T6,T7](implicit
- a1: Arbitrary[T1], a2: Arbitrary[T2], a3: Arbitrary[T3], a4: Arbitrary[T4],
- a5: Arbitrary[T5], a6: Arbitrary[T6], a7: Arbitrary[T7]
- ): Arbitrary[(T1,T2,T3,T4,T5,T6,T7)] =
- Arbitrary(for {
- t1 <- arbitrary[T1]
- t2 <- arbitrary[T2]
- t3 <- arbitrary[T3]
- t4 <- arbitrary[T4]
- t5 <- arbitrary[T5]
- t6 <- arbitrary[T6]
- t7 <- arbitrary[T7]
- } yield (t1,t2,t3,t4,t5,t6,t7))
-
- /** Arbitrary instance of 8-tuple */
- implicit def arbTuple8[T1,T2,T3,T4,T5,T6,T7,T8](implicit
- a1: Arbitrary[T1], a2: Arbitrary[T2], a3: Arbitrary[T3], a4: Arbitrary[T4],
- a5: Arbitrary[T5], a6: Arbitrary[T6], a7: Arbitrary[T7], a8: Arbitrary[T8]
- ): Arbitrary[(T1,T2,T3,T4,T5,T6,T7,T8)] =
- Arbitrary(for {
- t1 <- arbitrary[T1]
- t2 <- arbitrary[T2]
- t3 <- arbitrary[T3]
- t4 <- arbitrary[T4]
- t5 <- arbitrary[T5]
- t6 <- arbitrary[T6]
- t7 <- arbitrary[T7]
- t8 <- arbitrary[T8]
- } yield (t1,t2,t3,t4,t5,t6,t7,t8))
-
- /** Arbitrary instance of 9-tuple */
- implicit def arbTuple9[T1,T2,T3,T4,T5,T6,T7,T8,T9](implicit
- a1: Arbitrary[T1], a2: Arbitrary[T2], a3: Arbitrary[T3], a4: Arbitrary[T4],
- a5: Arbitrary[T5], a6: Arbitrary[T6], a7: Arbitrary[T7], a8: Arbitrary[T8],
- a9: Arbitrary[T9]
- ): Arbitrary[(T1,T2,T3,T4,T5,T6,T7,T8,T9)] =
- Arbitrary(for {
- t1 <- arbitrary[T1]
- t2 <- arbitrary[T2]
- t3 <- arbitrary[T3]
- t4 <- arbitrary[T4]
- t5 <- arbitrary[T5]
- t6 <- arbitrary[T6]
- t7 <- arbitrary[T7]
- t8 <- arbitrary[T8]
- t9 <- arbitrary[T9]
- } yield (t1,t2,t3,t4,t5,t6,t7,t8,t9))
-
-}
diff --git a/src/partest-extras/scala/org/scalacheck/Commands.scala b/src/partest-extras/scala/org/scalacheck/Commands.scala
deleted file mode 100644
index 5ff3a397e5..0000000000
--- a/src/partest-extras/scala/org/scalacheck/Commands.scala
+++ /dev/null
@@ -1,146 +0,0 @@
-/*-------------------------------------------------------------------------*\
-** ScalaCheck **
-** Copyright (c) 2007-2014 Rickard Nilsson. All rights reserved. **
-** http://www.scalacheck.org **
-** **
-** This software is released under the terms of the Revised BSD License. **
-** There is NO WARRANTY. See the file LICENSE for the full text. **
-\*------------------------------------------------------------------------ */
-
-package org.scalacheck
-
-/** See User Guide for usage examples */
-@deprecated("Will be replaced with a new implementation in 1.12.0", "1.11.4")
-trait Commands extends Prop {
-
- /** The abstract state data type. This type must be immutable.
- * The state type that encodes the abstract state. The abstract state
- * should model all the features we need from the real state, the system
- * under test. We should leave out all details that aren't needed for
- * specifying our pre- and postconditions. The state type must be called
- * State and be immutable. */
- type State <: AnyRef
-
- class Binding(private val key: State) {
- def get: Any = bindings.find(_._1 eq key) match {
- case None => sys.error("No value bound")
- case Some(x) => x._2
- }
- }
-
- /** Abstract commands are defined as subtypes of the traits Command or SetCommand.
- * Each command must have a run method and a method that returns the new abstract
- * state, as it should look after the command has been run.
- * A command can also define a precondition that states how the current
- * abstract state must look if the command should be allowed to run.
- * Finally, we can also define a postcondition which verifies that the
- * system under test is in a correct state after the command exectution. */
- trait Command {
-
- /** Used internally. */
- protected[Commands] def run_(s: State) = run(s)
-
- def run(s: State): Any
- def nextState(s: State): State
-
- /** Returns all preconditions merged into a single function */
- def preCondition: (State => Boolean) =
- s => preConditions.toList.forall(_.apply(s))
-
- /** A precondition is a function that
- * takes the current abstract state as parameter and returns a boolean
- * that says if the precondition is fulfilled or not. You can add several
- * conditions to the precondition list */
- val preConditions = new collection.mutable.ListBuffer[State => Boolean]
-
- /** Returns all postconditions merged into a single function */
- def postCondition: (State,State,Any) => Prop =
- (s0,s1,r) => Prop.all(postConditions.map(_.apply(s0,s1,r)): _*)
-
- /** A postcondition is a function that
- * takes three parameters, s0, s1 and r. s0 is the abstract state before
- * the command was run, s1 is the abstract state after the command was
- * run, and r is the result from the command's run
- * method. The postcondition function should return a Boolean (or
- * a Prop instance) that says if the condition holds or not. You can add several
- * conditions to the postConditions list. */
- val postConditions = new collection.mutable.ListBuffer[(State,State,Any) => Prop]
- }
-
- /** A command that binds its result for later use */
- trait SetCommand extends Command {
- /** Used internally. */
- protected[Commands] final override def run_(s: State) = {
- val r = run(s)
- bindings += ((s,r))
- r
- }
-
- final def nextState(s: State) = nextState(s, new Binding(s))
- def nextState(s: State, b: Binding): State
- }
-
- private case class Cmds(cs: List[Command], ss: List[State]) {
- override def toString = cs.map(_.toString).mkString(", ")
- }
-
- private val bindings = new scala.collection.mutable.ListBuffer[(State,Any)]
-
- private def initState() = {
- bindings.clear()
- initialState()
- }
-
- private def genCmds: Gen[Cmds] = {
- def sizedCmds(s: State, sz: Int): Gen[Cmds] = {
- if(sz <= 0) Gen.const(Cmds(Nil, Nil)) else for {
- c <- genCommand(s) suchThat (_.preCondition(s))
- Cmds(cs,ss) <- sizedCmds(c.nextState(s), sz-1)
- } yield Cmds(c::cs, s::ss)
- }
-
- Gen.sized(sz => sizedCmds(initialState(), sz))
- }
-
- private def validCmds(s: State, cs: List[Command]): Option[Cmds] =
- cs match {
- case Nil => Some(Cmds(Nil, s::Nil))
- case c::_ if !c.preCondition(s) => None
- case c::cmds => for {
- Cmds(_, ss) <- validCmds(c.nextState(s), cmds)
- } yield Cmds(cs, s::ss)
- }
-
- private def runCommands(cmds: Cmds): Prop = Prop.all {
- cmds.cs.indices.map { i =>
- val (c,s) = (cmds.cs(i), cmds.ss(i))
- c.postCondition(s,c.nextState(s),c.run_(s))
- } : _*
- }
-
- private def commandsProp: Prop = {
- def shrinkCmds(cmds: Cmds) =
- Shrink.shrink(cmds.cs)(Shrink.shrinkContainer).flatMap { cs =>
- validCmds(initialState(), cs).toList
- }
-
- Prop.forAllShrink(genCmds label "COMMANDS", shrinkCmds)(runCommands _)
- }
-
- def apply(p: Gen.Parameters) = commandsProp(p)
-
- /** initialState should reset the system under test to a well defined
- * initial state, and return the abstract version of that state. */
- def initialState(): State
-
- /** The command generator. Given an abstract state, the generator
- * should return a command that is allowed to run in that state. Note that
- * it is still neccessary to define preconditions on the commands if there
- * are any. The generator is just giving a hint of which commands that are
- * suitable for a given state, the preconditions will still be checked before
- * a command runs. Sometimes you maybe want to adjust the distribution of
- * your command generator according to the state, or do other calculations
- * based on the state. */
- def genCommand(s: State): Gen[Command]
-
-}
diff --git a/src/partest-extras/scala/org/scalacheck/Commands2.scala b/src/partest-extras/scala/org/scalacheck/Commands2.scala
deleted file mode 100644
index 67393a7a70..0000000000
--- a/src/partest-extras/scala/org/scalacheck/Commands2.scala
+++ /dev/null
@@ -1,150 +0,0 @@
-/*-------------------------------------------------------------------------*\
-** ScalaCheck **
-** Copyright (c) 2007-2014 Rickard Nilsson. All rights reserved. **
-** http://www.scalacheck.org **
-** **
-** This software is released under the terms of the Revised BSD License. **
-** There is NO WARRANTY. See the file LICENSE for the full text. **
-\*------------------------------------------------------------------------ */
-
-package org.scalacheck
-
-private[scalacheck] trait Commands2 {
-
- /** The abstract state type. Must be immutable.
- * The [[Commands2.State]] type should model the state of the system under test (SUT).
- * It should leave out all details that aren't needed for specifying our
- * pre- and postconditions. */
- type State
-
- /** A type representing one instance of the system under test (SUT).
- * The [[Commands2.System]] type should be a proxy to the actual system under test.
- * It is used in the postconditions to verify that the real system
- * behaves according to specification. It should be possible to have
- * up to [[Commands2.maxSystemInstanceCount]] co-existing instances of the System
- * type, and each System instance should be a proxy to a distinct
- * SUT instance. There should be no dependencies between the System
- * instances, as they might be used in parallel by ScalaCheck.
- * System instances are created by [[Commands2.newSystemInstance]] and destroyed by
- * [[Commands2.destroySystemInstance]]. [[Commands2.newSystemInstance]] and
- * [[Commands2.destroySystemInstance]] might be called at any time by ScalaCheck,
- * as long as [[Commands2.maxSystemInstanceCount]] isn't violated. */
- type System
-
- /** The maximum number of concurrent [[Commands2.System]] instances allowed to exist. */
- def maxSystemInstanceCount: Int
-
- /** Should create a new [[Commands2.System]] instance with an internal state that
- * corresponds to the provided abstract state instance. The provided state
- * is guaranteed to fulfill [[Commands2.initialPreCondition]], and
- * [[Commands2.newSystemInstance]] will never be called if there already
- * is [[Commands2.maxSystemInstanceCount]] instances of [[Commands2.System]] */
- def newSystemInstance(state: State): System
-
- /** Should destroy the given SUT, so that a new [[Commands2.System]] instance can be
- * created with [[Commands2.newSystemInstance]]. */
- def destroySystemInstance(system: System): Unit
-
- /** The precondition for the initial state, when no commands yet have
- * run. This is used by ScalaCheck when command sequences are shrinked
- * and the first state might differ from what is returned from
- * [[Commands2.initialState]]. */
- def initialPreCondition(state: State): Boolean
-
- /** A generator that should produce an initial [[Commands2.State]] instance that is
- * usable by [[Commands2.newSystemInstance]] to create a new system under test.
- * The state returned by this generator is always checked with the
- * [[Commands2.initialPreCondition]] method before it is used. */
- def genInitialState: Gen[State]
-
- /** A generator that, given the current abstract state, should produce
- * a suitable Command instance. */
- def genCommand(state: State): Gen[Command]
-
- /** Abstract commands are defined as subtypes of the trait [[Commands2.Command]].
- * Each command must have a run method and a method
- * that returns the new abstract state, as it is supposed to look after
- * the command has been run. A command can also define a precondition
- * that defines how the current abstract state must look if the command
- * should be allowed to run. Finally, you can also define a postcondition
- * that verifies that the system under test is in a correct state after
- * the command execution. */
- trait Command {
- /** Runs this command in the system under test,
- * represented by the provided [[Commands2.System]] instance. This method
- * can return any value as result. The returned value will be
- * used by the postcondition to decide if the system behaves as
- * expected. */
- def run(state: State, system: System): Any
-
- /** Returns a new abstract [[Commands2.State]] instance that represents the
- * state of the system after this command has run. */
- def nextState(state: State): State
-
- /** The precondition that decides if this command is allowed to run
- * when the system under test is in the specified (abstract) state. */
- def preCondition(state: State): Boolean
-
- /** The postcondition that decides if the system under test behaved
- * correctly when the command ran.
- * @param s0 The abstract state as it looked before this command ran.
- * @param s1 The abstract state as it looked after this command ran.
- * @param system The proxy for the system under test. The postcondition
- * can query the system for its current state, but care must be taken
- * not to mutate the system under test in any way.
- * @param result The result returned from the [[Command.run]] method.
- */
- def postCondition(s0: State, s1: State, system: System, result: Any): Prop
- }
-
-/* WIP
- private case class Cmds(cs: List[Command], ss: List[State]) {
- override def toString = cs.map(_.toString).mkString(", ")
- }
-
- private val bindings = new scala.collection.mutable.ListBuffer[(State,Any)]
-
- private def initState() = {
- bindings.clear()
- initialState()
- }
-
- private def genCmds: Gen[Cmds] = {
- def sizedCmds(s: State, sz: Int): Gen[Cmds] = {
- if(sz <= 0) Gen.const(Cmds(Nil, Nil)) else for {
- c <- genCommand(s) suchThat (_.preCondition(s))
- Cmds(cs,ss) <- sizedCmds(c.nextState(s), sz-1)
- } yield Cmds(c::cs, s::ss)
- }
-
- Gen.sized(sz => sizedCmds(initialState(), sz))
- }
-
- private def validCmds(s: State, cs: List[Command]): Option[Cmds] =
- cs match {
- case Nil => Some(Cmds(Nil, s::Nil))
- case c::_ if !c.preCondition(s) => None
- case c::cmds => for {
- Cmds(_, ss) <- validCmds(c.nextState(s), cmds)
- } yield Cmds(cs, s::ss)
- }
-
- private def runCommands(cmds: Cmds): Prop = Prop.all {
- cmds.cs.indices.map { i =>
- val (c,s) = (cmds.cs(i), cmds.ss(i))
- c.postCondition(s,c.nextState(s),c.run_(s))
- } : _*
- }
-
- private def commandsProp: Prop = {
- def shrinkCmds(cmds: Cmds) =
- Shrink.shrink(cmds.cs)(Shrink.shrinkContainer).flatMap { cs =>
- validCmds(initialState(), cs).toList
- }
-
- Prop.forAllShrink(genCmds label "COMMANDS", shrinkCmds)(runCommands _)
- }
-
- def apply(p: Prop.Params) = commandsProp(p)
-*/
-}
diff --git a/src/partest-extras/scala/org/scalacheck/Gen.scala b/src/partest-extras/scala/org/scalacheck/Gen.scala
deleted file mode 100644
index ba82c9ea95..0000000000
--- a/src/partest-extras/scala/org/scalacheck/Gen.scala
+++ /dev/null
@@ -1,813 +0,0 @@
-/*-------------------------------------------------------------------------*\
-** ScalaCheck **
-** Copyright (c) 2007-2014 Rickard Nilsson. All rights reserved. **
-** http://www.scalacheck.org **
-** **
-** This software is released under the terms of the Revised BSD License. **
-** There is NO WARRANTY. See the file LICENSE for the full text. **
-\*------------------------------------------------------------------------ */
-
-package org.scalacheck
-
-import util.{Buildable, Buildable2}
-import scala.collection.immutable.TreeMap
-
-sealed trait Gen[+T] {
-
- //// Private interface ////
-
- import Gen.{R, r, gen}
-
- /** Just an alias */
- private type P = Gen.Parameters
-
- /** Should be a copy of R.sieve. Used internally in Gen when some generators
- * with suchThat-claues are created (when R is not available). This method
- * actually breaks covariance, but since this method will only ever be
- * called with a value of exactly type T, it is OK. */
- protected def sieveCopy(x: Any): Boolean = true
-
- private[scalacheck] def doApply(p: P): R[T]
-
-
- //// Public interface ////
-
- /** A class supporting filtered operations. */
- final class WithFilter(p: T => Boolean) {
- def map[U](f: T => U): Gen[U] = Gen.this.suchThat(p).map(f)
- def flatMap[U](f: T => Gen[U]): Gen[U] = Gen.this.suchThat(p).flatMap(f)
- def withFilter(q: T => Boolean): WithFilter = Gen.this.withFilter(x => p(x) && q(x))
- }
-
- /** Evaluate this generator with the given parameters */
- def apply(p: Gen.Parameters): Option[T] = doApply(p).retrieve
-
- /** Create a new generator by mapping the result of this generator */
- def map[U](f: T => U): Gen[U] = gen { p => doApply(p).map(f) }
-
- /** Create a new generator by flat-mapping the result of this generator */
- def flatMap[U](f: T => Gen[U]): Gen[U] = gen { p =>
- doApply(p).flatMap(t => f(t).doApply(p))
- }
-
- /** Create a new generator that uses this generator to produce a value
- * that fulfills the given condition. If the condition is not fulfilled,
- * the generator fails (returns None). */
- def filter(p: T => Boolean): Gen[T] = suchThat(p)
-
- /** Creates a non-strict filtered version of this generator. */
- def withFilter(p: T => Boolean): WithFilter = new WithFilter(p)
-
- /** Create a new generator that uses this generator to produce a value
- * that fulfills the given condition. If the condition is not fulfilled,
- * the generator fails (returns None). This method is identical to
- * [Gen.filter]. */
- def suchThat(f: T => Boolean): Gen[T] = new Gen[T] {
- def doApply(p: P) = {
- val res = Gen.this.doApply(p)
- res.copy(s = { x:T => res.sieve(x) && f(x) })
- }
- override def sieveCopy(x: Any) =
- try Gen.this.sieveCopy(x) && f(x.asInstanceOf[T])
- catch { case _: java.lang.ClassCastException => false }
- }
-
- /** Create a generator that calls this generator repeatedly until
- * the given condition is fulfilled. The generated value is then
- * returned. Use this combinator with care, since it may result
- * in infinite loops. */
- def retryUntil(p: T => Boolean): Gen[T] = flatMap { t =>
- if (p(t)) Gen.const(t).suchThat(p) else retryUntil(p)
- }
-
- def sample: Option[T] = doApply(Gen.Parameters.default).retrieve
-
- /** Returns a new property that holds if and only if both this
- * and the given generator generates the same result, or both
- * generators generate no result. */
- def ==[U](g: Gen[U]) = Prop { prms =>
- (doApply(prms).retrieve, g.doApply(prms).retrieve) match {
- case (None,None) => Prop.proved(prms)
- case (Some(r1),Some(r2)) if r1 == r2 => Prop.proved(prms)
- case _ => Prop.falsified(prms)
- }
- }
-
- def !=[U](g: Gen[U]) = Prop.forAll(this)(r => Prop.forAll(g)(_ != r))
-
- def !==[U](g: Gen[U]) = Prop { prms =>
- (doApply(prms).retrieve, g.doApply(prms).retrieve) match {
- case (None,None) => Prop.falsified(prms)
- case (Some(r1),Some(r2)) if r1 == r2 => Prop.falsified(prms)
- case _ => Prop.proved(prms)
- }
- }
-
- /** Put a label on the generator to make test reports clearer */
- def label(l: String) = new Gen[T] {
- def doApply(p: P) = {
- val r = Gen.this.doApply(p)
- r.copy(l = r.labels + l)
- }
- override def sieveCopy(x: Any) = Gen.this.sieveCopy(x)
- }
-
- /** Put a label on the generator to make test reports clearer */
- def :|(l: String) = label(l)
-
- /** Put a label on the generator to make test reports clearer */
- def |:(l: String) = label(l)
-
- /** Put a label on the generator to make test reports clearer */
- def :|(l: Symbol) = label(l.toString.drop(1))
-
- /** Put a label on the generator to make test reports clearer */
- def |:(l: Symbol) = label(l.toString.drop(1))
-
-}
-
-object Gen {
-
- //// Private interface ////
-
- import Arbitrary.arbitrary
-
- /** Just an alias */
- private type P = Parameters
-
- private[scalacheck] trait R[+T] {
- def labels: Set[String] = Set()
- def sieve[U >: T]: U => Boolean = _ => true
- protected def result: Option[T]
-
- def retrieve = result.filter(sieve)
-
- def copy[U >: T](
- l: Set[String] = this.labels,
- s: U => Boolean = this.sieve,
- r: Option[U] = this.result
- ): R[U] = new R[U] {
- override val labels = l
- override def sieve[V >: U] = { x:Any =>
- try s(x.asInstanceOf[U])
- catch { case _: java.lang.ClassCastException => false }
- }
- val result = r
- }
-
- def map[U](f: T => U): R[U] = r(retrieve.map(f)).copy(l = labels)
-
- def flatMap[U](f: T => R[U]): R[U] = retrieve match {
- case None => r(None).copy(l = labels)
- case Some(t) =>
- val r = f(t)
- r.copy(l = labels ++ r.labels)
- }
- }
-
- private[scalacheck] def r[T](r: Option[T]): R[T] = new R[T] {
- val result = r
- }
-
- /** Generator factory method */
- private[scalacheck] def gen[T](f: P => R[T]): Gen[T] = new Gen[T] {
- def doApply(p: P) = f(p)
- }
-
- //// Public interface ////
-
- /** Generator parameters, used by [[org.scalacheck.Gen.apply]] */
- trait Parameters {
-
- /** The size of the generated value. Generator implementations are allowed
- * to freely interpret (or ignore) this value. During test execution, the
- * value of this parameter is controlled by [[Test.Parameters.minSize]] and
- * [[Test.Parameters.maxSize]]. */
- val size: Int
-
- /** Create a copy of this [[Gen.Parameters]] instance with
- * [[Gen.Parameters.size]] set to the specified value. */
- def withSize(size: Int): Parameters = cp(size = size)
-
- /** The random number generator used. */
- val rng: scala.util.Random
-
- /** Create a copy of this [[Gen.Parameters]] instance with
- * [[Gen.Parameters.rng]] set to the specified value. */
- def withRng(rng: scala.util.Random): Parameters = cp(rng = rng)
-
- /** Change the size parameter.
- * @deprecated Use [[Gen.Parameters.withSize]] instead. */
- @deprecated("Use withSize instead.", "1.11.2")
- def resize(newSize: Int): Parameters = withSize(newSize)
-
- // private since we can't guarantee binary compatibility for this one
- private case class cp(
- size: Int = size,
- rng: scala.util.Random = rng
- ) extends Parameters
- }
-
- /** Provides methods for creating [[org.scalacheck.Gen.Parameters]] values */
- object Parameters {
- /** Default generator parameters trait. This can be overriden if you
- * need to tweak the parameters. */
- trait Default extends Parameters {
- val size: Int = 100
- val rng: scala.util.Random = scala.util.Random
- }
-
- /** Default generator parameters instance. */
- val default: Parameters = new Default {}
- }
-
- /** A wrapper type for range types */
- trait Choose[T] {
- /** Creates a generator that returns a value in the given inclusive range */
- def choose(min: T, max: T): Gen[T]
- }
-
- /** Provides implicit [[org.scalacheck.Gen.Choose]] instances */
- object Choose {
-
- private def chLng(l: Long, h: Long)(p: P): R[Long] = {
- if (h < l) r(None) else {
- val d = h - l + 1
- if (d <= 0) {
- var n = p.rng.nextLong
- while (n < l || n > h) {
- n = p.rng.nextLong
- }
- r(Some(n))
- } else {
- r(Some(l + math.abs(p.rng.nextLong % d)))
- }
- }
- }
-
- private def chDbl(l: Double, h: Double)(p: P): R[Double] = {
- val d = h-l
- if (d < 0 || d > Double.MaxValue) r(None)
- else if (d == 0) r(Some(l))
- else r(Some(p.rng.nextDouble * (h-l) + l))
- }
-
- implicit val chooseLong: Choose[Long] = new Choose[Long] {
- def choose(low: Long, high: Long) =
- gen(chLng(low,high)).suchThat(x => x >= low && x <= high)
- }
- implicit val chooseInt: Choose[Int] = new Choose[Int] {
- def choose(low: Int, high: Int) =
- gen(chLng(low,high)).map(_.toInt).suchThat(x => x >= low && x <= high)
- }
- implicit val chooseByte: Choose[Byte] = new Choose[Byte] {
- def choose(low: Byte, high: Byte) =
- gen(chLng(low,high)).map(_.toByte).suchThat(x => x >= low && x <= high)
- }
- implicit val chooseShort: Choose[Short] = new Choose[Short] {
- def choose(low: Short, high: Short) =
- gen(chLng(low,high)).map(_.toShort).suchThat(x => x >= low && x <= high)
- }
- implicit val chooseChar: Choose[Char] = new Choose[Char] {
- def choose(low: Char, high: Char) =
- gen(chLng(low,high)).map(_.toChar).suchThat(x => x >= low && x <= high)
- }
- implicit val chooseDouble: Choose[Double] = new Choose[Double] {
- def choose(low: Double, high: Double) =
- gen(chDbl(low,high)).suchThat(x => x >= low && x <= high)
- }
- implicit val chooseFloat: Choose[Float] = new Choose[Float] {
- def choose(low: Float, high: Float) =
- gen(chDbl(low,high)).map(_.toFloat).suchThat(x => x >= low && x <= high)
- }
-
- /** Transform a Choose[T] to a Choose[U] where T and U are two isomorphic types
- * whose relationship is described by the provided transformation functions.
- * (exponential functor map) */
- def xmap[T, U](from: T => U, to: U => T)(implicit c: Choose[T]): Choose[U] = new Choose[U] {
- def choose(low: U, high: U) =
- c.choose(to(low), to(high)).map(from)
- }
- }
-
-
- //// Various Generator Combinators ////
-
- /** A generator that always generates the given value */
- @deprecated("Use Gen.const instead", "1.11.0")
- def value[T](x: T): Gen[T] = const(x)
-
- /** A generator that always generates the given value */
- implicit def const[T](x: T): Gen[T] = gen(_ => r(Some(x))).suchThat(_ == x)
-
- /** A generator that never generates a value */
- def fail[T]: Gen[T] = gen(_ => r(None)).suchThat(_ => false)
-
- /** A generator that generates a random value in the given (inclusive)
- * range. If the range is invalid, the generator will not generate
- * any value. */
- def choose[T](min: T, max: T)(implicit c: Choose[T]): Gen[T] =
- c.choose(min, max)
-
- /** Sequences generators. If any of the given generators fails, the
- * resulting generator will also fail. */
- def sequence[C[_],T](gs: Traversable[Gen[T]])(implicit b: Buildable[T,C]): Gen[C[T]] = {
- val g = gen { p =>
- gs.foldLeft(r(Some(collection.immutable.Vector.empty[T]))) {
- case (rs,g) => g.doApply(p).flatMap(r => rs.map(_ :+ r))
- }
- }
- g.map(b.fromIterable)
- }
-
- /** Sequences generators. If any of the given generators fails, the
- * resulting generator will also fail. */
- def sequence[C[_,_],T,U](gs: Traversable[Gen[(T,U)]])(implicit b: Buildable2[T,U,C]): Gen[C[T,U]] = {
- val g = gen { p =>
- gs.foldLeft(r(Some(collection.immutable.Vector.empty[(T,U)]))) {
- case (rs,g) => g.doApply(p).flatMap(r => rs.map(_ :+ r))
- }
- }
- g.map(b.fromIterable)
- }
-
- /** Wraps a generator lazily. The given parameter is only evaluated once,
- * and not until the wrapper generator is evaluated. */
- def lzy[T](g: => Gen[T]): Gen[T] = {
- lazy val h = g
- gen { p => h.doApply(p) }
- }
-
- /** Wraps a generator for later evaluation. The given parameter is
- * evaluated each time the wrapper generator is evaluated. */
- def wrap[T](g: => Gen[T]) = gen { p => g.doApply(p) }
-
- /** Creates a generator that can access its generation parameters */
- def parameterized[T](f: Parameters => Gen[T]) = gen { p => f(p).doApply(p) }
-
- /** Creates a generator that can access its generation size */
- def sized[T](f: Int => Gen[T]) = gen { p => f(p.size).doApply(p) }
-
- /** A generator that returns the current generation size */
- lazy val size: Gen[Int] = sized { sz => sz }
-
- /** Creates a resized version of a generator */
- def resize[T](s: Int, g: Gen[T]) = gen(p => g.doApply(p.withSize(s)))
-
- /** Picks a random value from a list */
- def oneOf[T](xs: Seq[T]): Gen[T] =
- choose(0, xs.size-1).map(xs(_)).suchThat(xs.contains)
-
- /** Picks a random value from a list */
- def oneOf[T](t0: T, t1: T, tn: T*): Gen[T] = oneOf(t0 +: t1 +: tn)
-
- /** Picks a random generator from a list */
- def oneOf[T](g0: Gen[T], g1: Gen[T], gn: Gen[T]*): Gen[T] = {
- val gs = g0 +: g1 +: gn
- choose(0,gs.size-1).flatMap(gs(_)).suchThat(x => gs.exists(_.sieveCopy(x)))
- }
-
- /** Makes a generator result optional. Either `Some(T)` or `None` will be provided. */
- def option[T](g: Gen[T]): Gen[Option[T]] =
- oneOf[Option[T]](g.map(Some.apply), None)
-
- /** Chooses one of the given generators with a weighted random distribution */
- def frequency[T](gs: (Int,Gen[T])*): Gen[T] = {
- gs.filter(_._1 > 0) match {
- case Nil => fail
- case filtered =>
- var tot = 0l
- val tree: TreeMap[Long, Gen[T]] = {
- val builder = TreeMap.newBuilder[Long, Gen[T]]
- filtered.foreach {
- case (f, v) =>
- tot += f
- builder.+=((tot, v))
- }
- builder.result()
- }
- choose(1L, tot).flatMap(r => tree.from(r).head._2).suchThat { x =>
- gs.exists(_._2.sieveCopy(x))
- }
- }
- }
-
- /** Implicit convenience method for using the `frequency` method
- * like this:
- * {{{
- * frequency((1, "foo"), (3, "bar"))
- * }}}
- */
- implicit def freqTuple[T](t: (Int,T)): (Int,Gen[T]) = (t._1, const(t._2))
-
-
- //// List Generators ////
-
- /** Generates a container of any Traversable type for which there exists an
- * implicit [[org.scalacheck.util.Buildable]] instance. The elements in the
- * container will be generated by the given generator. The size of the
- * generated container is limited by `n`. Depending on what kind of container
- * that is generated, the resulting container may contain fewer elements than
- * `n`, but not more. If the given generator fails generating a value, the
- * complete container generator will also fail. */
- def containerOfN[C[_],T](n: Int, g: Gen[T])(implicit
- evb: Buildable[T,C], evt: C[T] => Traversable[T]
- ): Gen[C[T]] =
- sequence[C,T](Traversable.fill(n)(g)) suchThat { c =>
- // TODO: Can we guarantee c.size == n (See issue #89)?
- c.forall(g.sieveCopy)
- }
-
- /** Generates a container of any Traversable type for which there exists an
- * implicit [[org.scalacheck.util.Buildable]] instance. The elements in the
- * container will be generated by the given generator. The size of the
- * container is bounded by the size parameter used when generating values. */
- def containerOf[C[_],T](g: Gen[T])(implicit
- evb: Buildable[T,C], evt: C[T] => Traversable[T]
- ): Gen[C[T]] =
- sized(s => choose(0,s).flatMap(containerOfN[C,T](_,g))) suchThat { c =>
- c.forall(g.sieveCopy)
- }
-
- /** Generates a non-empty container of any Traversable type for which there
- * exists an implicit [[org.scalacheck.util.Buildable]] instance. The
- * elements in the container will be generated by the given generator. The
- * size of the container is bounded by the size parameter used when
- * generating values. */
- def nonEmptyContainerOf[C[_],T](g: Gen[T])(implicit
- evb: Buildable[T,C], evt: C[T] => Traversable[T]
- ): Gen[C[T]] =
- sized(s => choose(1,s).flatMap(containerOfN[C,T](_,g))) suchThat { c =>
- c.size > 0 && c.forall(g.sieveCopy)
- }
-
- /** Generates a non-empty container of any Traversable type for which there
- * exists an implicit [[org.scalacheck.util.Buildable]] instance. The
- * elements in the container will be generated by the given generator. The
- * size of the container is bounded by the size parameter used when
- * generating values. */
- @deprecated("Use Gen.nonEmptyContainerOf instead", "1.11.0")
- def containerOf1[C[_],T](g: Gen[T])(implicit
- evb: Buildable[T,C], evt: C[T] => Traversable[T]
- ): Gen[C[T]] = nonEmptyContainerOf[C,T](g)
-
- /** Generates a container of any Traversable type for which there exists an
- * implicit [[org.scalacheck.util.Buildable2]] instance. The elements in
- * container will be generated by the given generator. The size of the
- * generated container is limited by `n`. Depending on what kind of container
- * that is generated, the resulting container may contain fewer elements than
- * `n`, but not more. If the given generator fails generating a value, the
- * complete container generator will also fail. */
- def containerOfN[C[_,_],T,U](n: Int, g: Gen[(T,U)])(implicit
- evb: Buildable2[T,U,C], evt: C[T,U] => Traversable[(T,U)]
- ): Gen[C[T,U]] =
- sequence[C,T,U](Traversable.fill(n)(g)).suchThat { c =>
- // TODO: Can we guarantee c.size == n (See issue #89)?
- c.forall(g.sieveCopy)
- }
-
- /** Generates a container of any Traversable type for which there exists
- * an implicit <code>Buildable2</code> instance. The elements in the
- * container will be generated by the given generator. The size of the
- * container is bounded by the size parameter used when generating values. */
- def containerOf[C[_,_],T,U](g: Gen[(T,U)])(implicit
- evb: Buildable2[T,U,C], evt: C[T,U] => Traversable[(T,U)]
- ): Gen[C[T,U]] =
- sized(s => choose(0,s).flatMap(containerOfN[C,T,U](_,g))) suchThat { c =>
- c.forall(g.sieveCopy)
- }
-
- /** Generates a non-empty container of any type for which there exists an
- * implicit <code>Buildable2</code> instance. The elements in the container
- * will be generated by the given generator. The size of the container is
- * bounded by the size parameter used when generating values. */
- def nonEmptyContainerOf[C[_,_],T,U](g: Gen[(T,U)])(implicit
- evb: Buildable2[T,U,C], evt: C[T,U] => Traversable[(T,U)]
- ): Gen[C[T,U]] =
- sized(s => choose(1,s).flatMap(containerOfN[C,T,U](_,g))) suchThat { c =>
- c.size > 0 && c.forall(g.sieveCopy)
- }
-
- /** Generates a list of random length. The maximum length depends on the
- * size parameter. This method is equal to calling
- * `containerOf[List,T](g)`. */
- def listOf[T](g: => Gen[T]) = containerOf[List,T](g)
-
- /** Generates a non-empty list of random length. The maximum length depends
- * on the size parameter. This method is equal to calling
- * `nonEmptyContainerOf[List,T](g)`. */
- def nonEmptyListOf[T](g: => Gen[T]) = nonEmptyContainerOf[List,T](g)
-
- /** Generates a non-empty list of random length. The maximum length depends
- * on the size parameter. This method is equal to calling
- * `nonEmptyContainerOf[List,T](g)`. */
- @deprecated("Use Gen.nonEmptyListOf instead", "1.11.0")
- def listOf1[T](g: => Gen[T]) = nonEmptyListOf[T](g)
-
- /** Generates a list of the given length. This method is equal to calling
- * `containerOfN[List,T](n,g)`. */
- def listOfN[T](n: Int, g: Gen[T]) = containerOfN[List,T](n,g)
-
- /** Generates a map of random length. The maximum length depends on the
- * size parameter. This method is equal to calling
- * <code>containerOf[Map,T,U](g)</code>. */
- def mapOf[T,U](g: => Gen[(T,U)]) = containerOf[Map,T,U](g)
-
- /** Generates a non-empty map of random length. The maximum length depends
- * on the size parameter. This method is equal to calling
- * <code>nonEmptyContainerOf[Map,T,U](g)</code>. */
- def nonEmptyMap[T,U](g: => Gen[(T,U)]) = nonEmptyContainerOf[Map,T,U](g)
-
- /** Generates a map of with at least the given number of elements. This method
- * is equal to calling <code>containerOfN[Map,T,U](n,g)</code>. */
- def mapOfN[T,U](n: Int, g: Gen[(T,U)]) = containerOfN[Map,T,U](n,g)
-
- /** A generator that picks a random number of elements from a list */
- def someOf[T](l: Iterable[T]) = choose(0,l.size).flatMap(pick(_,l))
-
- /** A generator that picks a random number of elements from a list */
- def someOf[T](g1: Gen[T], g2: Gen[T], gs: Gen[T]*) =
- choose(0, gs.length+2).flatMap(pick(_, g1, g2, gs: _*))
-
- /** A generator that picks a given number of elements from a list, randomly */
- def pick[T](n: Int, l: Iterable[T]): Gen[Seq[T]] =
- if(n > l.size || n < 0) fail
- else (gen { p =>
- val b = new collection.mutable.ListBuffer[T]
- b ++= l
- while(b.length > n) b.remove(choose(0, b.length-1).doApply(p).retrieve.get)
- r(Some(b))
- }).suchThat(_.forall(x => l.exists(x == _)))
-
- /** A generator that picks a given number of elements from a list, randomly */
- def pick[T](n: Int, g1: Gen[T], g2: Gen[T], gn: Gen[T]*): Gen[Seq[T]] = {
- val gs = g1 +: g2 +: gn
- pick(n, 0 until gs.size).flatMap(idxs =>
- sequence[List,T](idxs.toList.map(gs(_)))
- ).suchThat(_.forall(x => gs.exists(_.sieveCopy(x))))
- }
-
-
- //// Character Generators ////
-
- /** Generates a numerical character */
- def numChar: Gen[Char] = choose(48.toChar, 57.toChar)
-
- /** Generates an upper-case alpha character */
- def alphaUpperChar: Gen[Char] = choose(65.toChar, 90.toChar)
-
- /** Generates a lower-case alpha character */
- def alphaLowerChar: Gen[Char] = choose(97.toChar, 122.toChar)
-
- /** Generates an alpha character */
- def alphaChar = frequency((1,alphaUpperChar), (9,alphaLowerChar))
-
- /** Generates an alphanumerical character */
- def alphaNumChar = frequency((1,numChar), (9,alphaChar))
-
-
- //// String Generators ////
-
- /** Generates a string that starts with a lower-case alpha character,
- * and only contains alphanumerical characters */
- def identifier: Gen[String] = (for {
- c <- alphaLowerChar
- cs <- listOf(alphaNumChar)
- } yield (c::cs).mkString).suchThat(_.forall(c => c.isLetter || c.isDigit))
-
- /** Generates a string of alpha characters */
- def alphaStr: Gen[String] =
- listOf(alphaChar).map(_.mkString).suchThat(_.forall(_.isLetter))
-
- /** Generates a string of digits */
- def numStr: Gen[String] =
- listOf(numChar).map(_.mkString).suchThat(_.forall(_.isDigit))
-
-
- //// Number Generators ////
-
- /** Generates positive numbers of uniform distribution, with an
- * upper bound of the generation size parameter. */
- def posNum[T](implicit num: Numeric[T], c: Choose[T]): Gen[T] = {
- import num._
- sized(max => c.choose(one, fromInt(max)))
- }
-
- /** Generates negative numbers of uniform distribution, with an
- * lower bound of the negated generation size parameter. */
- def negNum[T](implicit num: Numeric[T], c: Choose[T]): Gen[T] = {
- import num._
- sized(max => c.choose(-fromInt(max), -one))
- }
-
- /** Generates numbers within the given inclusive range, with
- * extra weight on zero, +/- unity, both extremities, and any special
- * numbers provided. The special numbers must lie within the given range,
- * otherwise they won't be included. */
- def chooseNum[T](minT: T, maxT: T, specials: T*)(
- implicit num: Numeric[T], c: Choose[T]
- ): Gen[T] = {
- import num._
- val basics = List(minT, maxT, zero, one, -one)
- val basicsAndSpecials = for {
- t <- specials ++ basics if t >= minT && t <= maxT
- } yield (1, const(t))
- val allGens = basicsAndSpecials ++ List(
- (basicsAndSpecials.length, c.choose(minT, maxT))
- )
- frequency(allGens: _*)
- }
-
- /** Generates a version 4 (random) UUID. */
- lazy val uuid: Gen[java.util.UUID] = for {
- l1 <- Gen.choose(Long.MinValue, Long.MaxValue)
- l2 <- Gen.choose(Long.MinValue, Long.MaxValue)
- y <- Gen.oneOf('8', '9', 'a', 'b')
- } yield java.util.UUID.fromString(
- new java.util.UUID(l1,l2).toString.updated(14, '4').updated(19, y)
- )
-
- /** Combines the given generators into one generator that produces a
- * tuple of their generated values. */
- def zip[T1,T2](g1: Gen[T1], g2: Gen[T2]): Gen[(T1,T2)] = {
- val g = for {
- t1 <- g1; t2 <- g2
- } yield (t1,t2)
- g.suchThat { case (t1,t2) => g1.sieveCopy(t1) && g2.sieveCopy(t2) }
- }
-
- /** Combines the given generators into one generator that produces a
- * tuple of their generated values. */
- def zip[T1,T2,T3](g1: Gen[T1], g2: Gen[T2], g3: Gen[T3]): Gen[(T1,T2,T3)] = {
- val g0 = zip(g1,g2)
- val g = for {
- (t1,t2) <- g0; t3 <- g3
- } yield (t1,t2,t3)
- g.suchThat { case (t1,t2,t3) => g0.sieveCopy(t1,t2) && g3.sieveCopy(t3) }
- }
-
- /** Combines the given generators into one generator that produces a
- * tuple of their generated values. */
- def zip[T1,T2,T3,T4](g1: Gen[T1], g2: Gen[T2], g3: Gen[T3], g4: Gen[T4]
- ): Gen[(T1,T2,T3,T4)] = {
- val g0 = zip(g1,g2,g3)
- val g = for {
- (t1,t2,t3) <- g0; t4 <- g4
- } yield (t1,t2,t3,t4)
- g.suchThat { case (t1,t2,t3,t4) => g0.sieveCopy(t1,t2,t3) && g4.sieveCopy(t4) }
- }
-
- /** Combines the given generators into one generator that produces a
- * tuple of their generated values. */
- def zip[T1,T2,T3,T4,T5](g1: Gen[T1], g2: Gen[T2], g3: Gen[T3], g4: Gen[T4],
- g5: Gen[T5]
- ): Gen[(T1,T2,T3,T4,T5)] = {
- val g0 = zip(g1,g2,g3,g4)
- val g = for {
- (t1,t2,t3,t4) <- g0; t5 <- g5
- } yield (t1,t2,t3,t4,t5)
- g.suchThat { case (t1,t2,t3,t4,t5) =>
- g0.sieveCopy(t1,t2,t3,t4) && g5.sieveCopy(t5)
- }
- }
-
- /** Combines the given generators into one generator that produces a
- * tuple of their generated values. */
- def zip[T1,T2,T3,T4,T5,T6](g1: Gen[T1], g2: Gen[T2], g3: Gen[T3], g4: Gen[T4],
- g5: Gen[T5], g6: Gen[T6]
- ): Gen[(T1,T2,T3,T4,T5,T6)] = {
- val g0 = zip(g1,g2,g3,g4,g5)
- val g = for {
- (t1,t2,t3,t4,t5) <- g0; t6 <- g6
- } yield (t1,t2,t3,t4,t5,t6)
- g.suchThat { case (t1,t2,t3,t4,t5,t6) =>
- g0.sieveCopy(t1,t2,t3,t4,t5) && g6.sieveCopy(t6)
- }
- }
-
- /** Combines the given generators into one generator that produces a
- * tuple of their generated values. */
- def zip[T1,T2,T3,T4,T5,T6,T7](g1: Gen[T1], g2: Gen[T2], g3: Gen[T3],
- g4: Gen[T4], g5: Gen[T5], g6: Gen[T6], g7: Gen[T7]
- ): Gen[(T1,T2,T3,T4,T5,T6,T7)] = {
- val g0 = zip(g1,g2,g3,g4,g5,g6)
- val g = for {
- (t1,t2,t3,t4,t5,t6) <- g0; t7 <- g7
- } yield (t1,t2,t3,t4,t5,t6,t7)
- g.suchThat { case (t1,t2,t3,t4,t5,t6,t7) =>
- g0.sieveCopy(t1,t2,t3,t4,t5,t6) && g7.sieveCopy(t7)
- }
- }
-
- /** Combines the given generators into one generator that produces a
- * tuple of their generated values. */
- def zip[T1,T2,T3,T4,T5,T6,T7,T8](g1: Gen[T1], g2: Gen[T2], g3: Gen[T3],
- g4: Gen[T4], g5: Gen[T5], g6: Gen[T6], g7: Gen[T7], g8: Gen[T8]
- ): Gen[(T1,T2,T3,T4,T5,T6,T7,T8)] = {
- val g0 = zip(g1,g2,g3,g4,g5,g6,g7)
- val g = for {
- (t1,t2,t3,t4,t5,t6,t7) <- g0; t8 <- g8
- } yield (t1,t2,t3,t4,t5,t6,t7,t8)
- g.suchThat { case (t1,t2,t3,t4,t5,t6,t7,t8) =>
- g0.sieveCopy(t1,t2,t3,t4,t5,t6,t7) && g8.sieveCopy(t8)
- }
- }
-
- /** Combines the given generators into one generator that produces a
- * tuple of their generated values. */
- def zip[T1,T2,T3,T4,T5,T6,T7,T8,T9](g1: Gen[T1], g2: Gen[T2], g3: Gen[T3],
- g4: Gen[T4], g5: Gen[T5], g6: Gen[T6], g7: Gen[T7], g8: Gen[T8], g9: Gen[T9]
- ): Gen[(T1,T2,T3,T4,T5,T6,T7,T8,T9)] = {
- val g0 = zip(g1,g2,g3,g4,g5,g6,g7,g8)
- val g = for {
- (t1,t2,t3,t4,t5,t6,t7,t8) <- g0; t9 <- g9
- } yield (t1,t2,t3,t4,t5,t6,t7,t8,t9)
- g.suchThat { case (t1,t2,t3,t4,t5,t6,t7,t8,t9) =>
- g0.sieveCopy(t1,t2,t3,t4,t5,t6,t7,t8) && g9.sieveCopy(t9)
- }
- }
-
- /** Takes a function and returns a generator that generates arbitrary
- * results of that function by feeding it with arbitrarily generated input
- * parameters. */
- def resultOf[T,R](f: T => R)(implicit a: Arbitrary[T]): Gen[R] =
- arbitrary[T] map f
-
- /** Takes a function and returns a generator that generates arbitrary
- * results of that function by feeding it with arbitrarily generated input
- * parameters. */
- def resultOf[T1,T2,R](f: (T1,T2) => R)(implicit
- a1: Arbitrary[T1], a2: Arbitrary[T2]
- ): Gen[R] = arbitrary[T1] flatMap { t => resultOf(f(t, _:T2)) }
-
- /** Takes a function and returns a generator that generates arbitrary
- * results of that function by feeding it with arbitrarily generated input
- * parameters. */
- def resultOf[T1,T2,T3,R](f: (T1,T2,T3) => R)(implicit
- a1: Arbitrary[T1], a2: Arbitrary[T2], a3: Arbitrary[T3]
- ): Gen[R] = arbitrary[T1] flatMap { t => resultOf(f(t, _:T2, _:T3)) }
-
- /** Takes a function and returns a generator that generates arbitrary
- * results of that function by feeding it with arbitrarily generated input
- * parameters. */
- def resultOf[T1,T2,T3,T4,R](f: (T1,T2,T3,T4) => R)(implicit
- a1: Arbitrary[T1], a2: Arbitrary[T2], a3: Arbitrary[T3], a4: Arbitrary[T4]
- ): Gen[R] = arbitrary[T1] flatMap {
- t => resultOf(f(t, _:T2, _:T3, _:T4))
- }
-
- /** Takes a function and returns a generator that generates arbitrary
- * results of that function by feeding it with arbitrarily generated input
- * parameters. */
- def resultOf[T1,T2,T3,T4,T5,R](f: (T1,T2,T3,T4,T5) => R)(implicit
- a1: Arbitrary[T1], a2: Arbitrary[T2], a3: Arbitrary[T3], a4: Arbitrary[T4],
- a5: Arbitrary[T5]
- ): Gen[R] = arbitrary[T1] flatMap {
- t => resultOf(f(t, _:T2, _:T3, _:T4, _:T5))
- }
-
- /** Takes a function and returns a generator that generates arbitrary
- * results of that function by feeding it with arbitrarily generated input
- * parameters. */
- def resultOf[T1,T2,T3,T4,T5,T6,R](
- f: (T1,T2,T3,T4,T5,T6) => R)(implicit
- a1: Arbitrary[T1], a2: Arbitrary[T2], a3: Arbitrary[T3],
- a4: Arbitrary[T4], a5: Arbitrary[T5], a6: Arbitrary[T6]
- ): Gen[R] = arbitrary[T1] flatMap {
- t => resultOf(f(t, _:T2, _:T3, _:T4, _:T5, _:T6))
- }
-
- /** Takes a function and returns a generator that generates arbitrary
- * results of that function by feeding it with arbitrarily generated input
- * parameters. */
- def resultOf[T1,T2,T3,T4,T5,T6,T7,R](
- f: (T1,T2,T3,T4,T5,T6,T7) => R)(implicit
- a1: Arbitrary[T1], a2: Arbitrary[T2], a3: Arbitrary[T3],
- a4: Arbitrary[T4], a5: Arbitrary[T5], a6: Arbitrary[T6], a7: Arbitrary[T7]
- ): Gen[R] = arbitrary[T1] flatMap {
- t => resultOf(f(t, _:T2, _:T3, _:T4, _:T5, _:T6, _:T7))
- }
-
- /** Takes a function and returns a generator that generates arbitrary
- * results of that function by feeding it with arbitrarily generated input
- * parameters. */
- def resultOf[T1,T2,T3,T4,T5,T6,T7,T8,R](
- f: (T1,T2,T3,T4,T5,T6,T7,T8) => R)(implicit
- a1: Arbitrary[T1], a2: Arbitrary[T2], a3: Arbitrary[T3], a4: Arbitrary[T4],
- a5: Arbitrary[T5], a6: Arbitrary[T6], a7: Arbitrary[T7], a8: Arbitrary[T8]
- ): Gen[R] = arbitrary[T1] flatMap {
- t => resultOf(f(t, _:T2, _:T3, _:T4, _:T5, _:T6, _:T7, _:T8))
- }
-
- /** Takes a function and returns a generator that generates arbitrary
- * results of that function by feeding it with arbitrarily generated input
- * parameters. */
- def resultOf[T1,T2,T3,T4,T5,T6,T7,T8,T9,R](
- f: (T1,T2,T3,T4,T5,T6,T7,T8,T9) => R)(implicit
- a1: Arbitrary[T1], a2: Arbitrary[T2], a3: Arbitrary[T3], a4: Arbitrary[T4],
- a5: Arbitrary[T5], a6: Arbitrary[T6], a7: Arbitrary[T7], a8: Arbitrary[T8],
- a9: Arbitrary[T9]
- ): Gen[R] = arbitrary[T1] flatMap {
- t => resultOf(f(t, _:T2, _:T3, _:T4, _:T5, _:T6, _:T7, _:T8, _:T9))
- }
-}
diff --git a/src/partest-extras/scala/org/scalacheck/Prop.scala b/src/partest-extras/scala/org/scalacheck/Prop.scala
deleted file mode 100644
index 6b607002fd..0000000000
--- a/src/partest-extras/scala/org/scalacheck/Prop.scala
+++ /dev/null
@@ -1,953 +0,0 @@
-/*-------------------------------------------------------------------------*\
-** ScalaCheck **
-** Copyright (c) 2007-2014 Rickard Nilsson. All rights reserved. **
-** http://www.scalacheck.org **
-** **
-** This software is released under the terms of the Revised BSD License. **
-** There is NO WARRANTY. See the file LICENSE for the full text. **
-\*------------------------------------------------------------------------ */
-
-package org.scalacheck
-
-import util.{Pretty, FreqMap, Buildable, ConsoleReporter}
-import scala.annotation.tailrec
-
-trait Prop {
-
- import Prop.{Result, Proof, True, False, Exception, Undecided,
- provedToTrue, secure, mergeRes}
- import Gen.Parameters
-
- def apply(prms: Parameters): Result
-
- def map(f: Result => Result): Prop = Prop(prms => f(this(prms)))
-
- def flatMap(f: Result => Prop): Prop = Prop(prms => f(this(prms))(prms))
-
- // TODO In 1.12.0, make p call-by-name, and remove the calls to secure()
- // in the methods that use combine()
- def combine(p: Prop)(f: (Result, Result) => Result) =
- for(r1 <- this; r2 <- p) yield f(r1,r2)
-
- /** Convenience method that checks this property with the given parameters
- * and reports the result on the console. */
- def check(prms: Test.Parameters): Unit = Test.check(
- if(prms.testCallback.isInstanceOf[ConsoleReporter]) prms
- else prms.withTestCallback(prms.testCallback.chain(ConsoleReporter(1))),
- this
- )
-
- /** Convenience method that checks this property and reports the
- * result on the console. The default test parameters
- * ([[Test.Parameters.default]]) are used for the check. */
- def check: Unit = check(Test.Parameters.default)
-
- /** Convenience method that checks this property and reports the result
- * on the console. The provided argument should be a function that takes
- * the default test parameters ([[Test.Parameters.default]])
- * as input and outputs a modified [[Test.Parameters]] instance that
- * Example use:
- *
- * {{{
- * p.check(_.withMinSuccessfulTests(500))
-
- * p.check { _.
- * withMinSuccessfulTests(80000).
- * withWorkers(4)
- * }
- * }}}
- */
- def check(paramFun: Test.Parameters => Test.Parameters): Unit = check(
- paramFun(Test.Parameters.default)
- )
-
- /** Convenience method that checks this property with specified minimal
- * number of successful test and the given testing parameters, and
- * reports the result on the console. If you need to get the results
- * from the test use the `check` methods in [[org.scalacheck.Test]]
- * instead. */
- @deprecated("Use check(prms.withMinSuccessfulTests(n)) instead", "1.11.2")
- def check(minSuccessfulTests: Int, prms: Test.Parameters): Unit = check(
- prms.withMinSuccessfulTests(minSuccessfulTests)
- )
-
- /** Convenience method that checks this property with specified minimal
- * number of successful test and reports the result on the console.
- * If you need to get the results from the test use
- * the `check` methods in [[org.scalacheck.Test]] instead. */
- @deprecated("Use check(_.withMinSuccessfulTests(n)) instead", "1.11.2")
- def check(minSuccessfulTests: Int): Unit = check(
- _.withMinSuccessfulTests(minSuccessfulTests)
- )
-
- /** The logic for main, separated out to make it easier to
- * avoid System.exit calls. Returns exit code.
- */
- def mainRunner(args: Array[String]): Int = {
- Test.parseParams(args) match {
- case Some(params) =>
- if (Test.check(params, this).passed) 0
- else 1
- case None =>
- println("Incorrect options")
- -1
- }
- }
-
- /** Whether main should call System.exit with an exit code.
- * Defaults to true; override to change. */
- def mainCallsExit = true
-
- /** Convenience method that makes it possible to use this property
- * as an application that checks itself on execution */
- def main(args: Array[String]): Unit = {
- val code = mainRunner(args)
- if (mainCallsExit && code != 0)
- System exit code
- }
-
- /** Returns a new property that holds if and only if both this
- * and the given property hold. If one of the properties doesn't
- * generate a result, the new property will generate false. */
- def &&(p: => Prop) = combine(secure(p))(_ && _)
-
- /** Returns a new property that holds if either this
- * or the given property (or both) hold. */
- def ||(p: => Prop) = combine(secure(p))(_ || _)
-
- /** Returns a new property that holds if and only if both this
- * and the given property hold. If one of the properties doesn't
- * generate a result, the new property will generate the same result
- * as the other property. */
- def ++(p: => Prop): Prop = combine(secure(p))(_ ++ _)
-
- /** Combines two properties through implication */
- def ==>(p: => Prop): Prop = flatMap { r1 =>
- if(r1.proved) p map { r2 => mergeRes(r1,r2,r2.status) }
- else if(!r1.success) Prop(r1.copy(status = Undecided))
- else p map { r2 => provedToTrue(mergeRes(r1,r2,r2.status)) }
- }
-
- /** Returns a new property that holds if and only if both this
- * and the given property generates a result with the exact
- * same status. Note that this means that if one of the properties is
- * proved, and the other one passed, then the resulting property
- * will fail. */
- def ==(p: => Prop) = this.flatMap { r1 =>
- p.map { r2 =>
- mergeRes(r1, r2, if(r1.status == r2.status) True else False)
- }
- }
-
- override def toString = "Prop"
-
- /** Put a label on the property to make test reports clearer */
- def label(l: String) = map(_.label(l))
-
- /** Put a label on the property to make test reports clearer */
- def :|(l: String) = label(l)
-
- /** Put a label on the property to make test reports clearer */
- def |:(l: String) = label(l)
-
- /** Put a label on the property to make test reports clearer */
- def :|(l: Symbol) = label(l.toString.drop(1))
-
- /** Put a label on the property to make test reports clearer */
- def |:(l: Symbol) = label(l.toString.drop(1))
-
-}
-
-object Prop {
-
- import Gen.{value, fail, frequency, oneOf, Parameters}
- import Arbitrary.{arbitrary}
- import Shrink.{shrink}
-
- // Types
-
- /** A property argument */
- case class Arg[+T](
- label: String,
- arg: T,
- shrinks: Int,
- origArg: T,
- prettyArg: Pretty,
- prettyOrigArg: Pretty
- )
-
- object Result {
- @deprecated("Will be removed in 1.12.0", "1.11.2")
- def apply(st: Status): Result = Result(status = st)
- @deprecated("Will be removed in 1.12.0", "1.11.2")
- def merge(x: Result, y: Result, status: Status) = mergeRes(x,y,status)
- }
-
- private[scalacheck] def mergeRes(x: Result, y: Result, st: Status) = Result(
- status = st,
- args = x.args ++ y.args,
- collected = x.collected ++ y.collected,
- labels = x.labels ++ y.labels
- )
-
- /** The result of evaluating a property */
- case class Result(
- status: Status,
- args: List[Arg[Any]] = Nil,
- collected: Set[Any] = Set.empty,
- labels: Set[String] = Set.empty
- ) {
- def success = status match {
- case True => true
- case Proof => true
- case _ => false
- }
-
- def failure = status match {
- case False => true
- case Exception(_) => true
- case _ => false
- }
-
- def proved = status == Proof
-
- def addArg(a: Arg[Any]) = copy(args = a::args)
-
- def collect(x: Any) = copy(collected = collected+x)
-
- def label(l: String) = copy(labels = labels+l)
-
- def &&(r: Result) = (this.status, r.status) match {
- case (Exception(_),_) => this
- case (_,Exception(_)) => r
-
- case (False,_) => this
- case (_,False) => r
-
- case (Undecided,_) => this
- case (_,Undecided) => r
-
- case (_,Proof) => mergeRes(this, r, this.status)
- case (Proof,_) => mergeRes(this, r, r.status)
-
- case (True,True) => mergeRes(this, r, True)
- }
-
- def ||(r: Result) = (this.status, r.status) match {
- case (Exception(_),_) => this
- case (_,Exception(_)) => r
-
- case (False,False) => mergeRes(this, r, False)
- case (False,_) => r
- case (_,False) => this
-
- case (Proof,_) => this
- case (_,Proof) => r
-
- case (True,_) => this
- case (_,True) => r
-
- case (Undecided,Undecided) => mergeRes(this, r, Undecided)
- }
-
- def ++(r: Result) = (this.status, r.status) match {
- case (Exception(_),_) => this
- case (_,Exception(_)) => r
-
- case (_, Undecided) => this
- case (Undecided, _) => r
-
- case (_, Proof) => this
- case (Proof, _) => r
-
- case (_, True) => this
- case (True, _) => r
-
- case (False, _) => this
- case (_, False) => r
- }
-
- def ==>(r: Result) = (this.status, r.status) match {
- case (Exception(_),_) => this
- case (_,Exception(_)) => r
-
- case (False,_) => mergeRes(this, r, Undecided)
-
- case (Undecided,_) => this
-
- case (Proof,_) => mergeRes(this, r, r.status)
- case (True,_) => mergeRes(this, r, r.status)
- }
- }
-
- sealed trait Status
-
- /** The property was proved */
- case object Proof extends Status
-
- /** The property was true */
- case object True extends Status
-
- /** The property was false */
- case object False extends Status
-
- /** The property could not be falsified or proved */
- case object Undecided extends Status
-
- /** Evaluating the property raised an exception */
- sealed case class Exception(e: Throwable) extends Status {
- override def equals(o: Any) = o match {
- case Exception(_) => true
- case _ => false
- }
- }
-
- /** Create a new property from the given function. */
- def apply(f: Parameters => Result): Prop = new Prop {
- def apply(prms: Parameters) = try f(prms) catch {
- case e: Throwable => Result(status = Exception(e))
- }
- }
-
- /** Create a property that returns the given result */
- def apply(r: Result): Prop = Prop.apply(prms => r)
-
- /** Create a property from a boolean value */
- def apply(b: Boolean): Prop = if(b) proved else falsified
-
-
- // Implicits
-
- /** A collection of property operators on `Any` values.
- * Import [[Prop.AnyOperators]] to make the operators available. */
- class ExtendedAny[T <% Pretty](x: => T) {
- /** See [[Prop.imply]] */
- def imply(f: PartialFunction[T,Prop]) = Prop.imply(x,f)
- /** See [[Prop.iff]] */
- def iff(f: PartialFunction[T,Prop]) = Prop.iff(x,f)
- /** See [[Prop.?=]] */
- def ?=(y: T) = Prop.?=(x, y)
- /** See [[Prop.=?]] */
- def =?(y: T) = Prop.=?(x, y)
- }
-
- /** A collection of property operators on `Boolean` values.
- * Import [[Prop.BooleanOperators]] to make the operators available. */
- class ExtendedBoolean(b: => Boolean) {
- /** See the documentation for [[org.scalacheck.Prop]] */
- def ==>(p: => Prop) = Prop(b) ==> p
- /** See the documentation for [[org.scalacheck.Prop]] */
- def :|(l: String) = Prop(b) :| l
- /** See the documentation for [[org.scalacheck.Prop]] */
- def |:(l: String) = l |: Prop(b)
- /** See the documentation for [[org.scalacheck.Prop]] */
- def :|(l: Symbol) = Prop(b) :| l
- /** See the documentation for [[org.scalacheck.Prop]] */
- def |:(l: Symbol) = l |: Prop(b)
- }
-
- /** Implicit method that makes a number of property operators on values of
- * type `Any` available in the current scope.
- * See [[Prop.ExtendedAny]] for documentation on the operators. */
- implicit def AnyOperators[T <% Pretty](x: => T) = new ExtendedAny[T](x)
-
- /** Implicit method that makes a number of property operators on boolean
- * values available in the current scope. See [[Prop.ExtendedBoolean]] for
- * documentation on the operators. */
- implicit def BooleanOperators(b: => Boolean) = new ExtendedBoolean(b)
-
- /** Implicit conversion of Boolean values to Prop values. */
- implicit def propBoolean(b: Boolean): Prop = Prop(b)
-
-
- // Private support functions
-
- private def provedToTrue(r: Result) = r.status match {
- case Proof => r.copy(status = True)
- case _ => r
- }
-
-
- // Property combinators
-
- /** A property that never is proved or falsified */
- lazy val undecided = Prop(Result(status = Undecided))
-
- /** A property that always is false */
- lazy val falsified = Prop(Result(status = False))
-
- /** A property that always is proved */
- lazy val proved = Prop(Result(status = Proof))
-
- /** A property that always is passed */
- lazy val passed = Prop(Result(status = True))
-
- /** A property that denotes an exception */
- def exception(e: Throwable): Prop = Prop(Result(status = Exception(e)))
-
- /** A property that denotes an exception */
- lazy val exception: Prop = exception(null)
-
- /** Create a property that compares to values. If the values aren't equal,
- * the property will fail and report that first value doesn't match the
- * expected (second) value. */
- def ?=[T](x: T, y: T)(implicit pp: T => Pretty): Prop =
- if(x == y) proved else falsified :| {
- val exp = Pretty.pretty[T](y, Pretty.Params(0))
- val act = Pretty.pretty[T](x, Pretty.Params(0))
- "Expected "+exp+" but got "+act
- }
-
- /** Create a property that compares to values. If the values aren't equal,
- * the property will fail and report that second value doesn't match the
- * expected (first) value. */
- def =?[T](x: T, y: T)(implicit pp: T => Pretty): Prop = ?=(y, x)
-
- /** A property that depends on the generator size */
- def sizedProp(f: Int => Prop): Prop = Prop { prms =>
- // provedToTrue since if the property is proved for
- // one size, it shouldn't be regarded as proved for
- // all sizes.
- provedToTrue(f(prms.size)(prms))
- }
-
- /** Implication with several conditions */
- def imply[T](x: T, f: PartialFunction[T,Prop]): Prop = secure {
- if(f.isDefinedAt(x)) f(x) else undecided
- }
-
- /** Property holds only if the given partial function is defined at
- * `x`, and returns a property that holds */
- def iff[T](x: T, f: PartialFunction[T,Prop]): Prop = secure {
- if(f.isDefinedAt(x)) f(x) else falsified
- }
-
- /** Combines properties into one, which is true if and only if all the
- * properties are true */
- def all(ps: Prop*) = if(ps.isEmpty) proved else Prop(prms =>
- ps.map(p => p(prms)).reduceLeft(_ && _)
- )
-
- /** Combines properties into one, which is true if at least one of the
- * properties is true */
- def atLeastOne(ps: Prop*) = if(ps.isEmpty) falsified else Prop(prms =>
- ps.map(p => p(prms)).reduceLeft(_ || _)
- )
-
- /** A property that holds if at least one of the given generators
- * fails generating a value */
- def someFailing[T](gs: Seq[Gen[T]]) = atLeastOne(gs.map(_ == fail):_*)
-
- /** A property that holds iff none of the given generators
- * fails generating a value */
- def noneFailing[T](gs: Seq[Gen[T]]) = all(gs.map(_ !== fail):_*)
-
- /** Returns true if the given statement throws an exception
- * of the specified type */
- def throws[T <: Throwable](c: Class[T])(x: => Any): Boolean =
- try { x; false } catch { case e if c.isInstance(e) => true }
-
- /** Collect data for presentation in test report */
- def collect[T, P <% Prop](f: T => P): T => Prop = t => Prop { prms =>
- val prop = f(t)
- prop(prms).collect(t)
- }
-
- /** Collect data for presentation in test report */
- def collect[T](t: T)(prop: Prop) = Prop { prms =>
- prop(prms).collect(t)
- }
-
- /** Collect data for presentation in test report */
- def classify(c: => Boolean, ifTrue: Any)(prop: Prop): Prop =
- if(c) collect(ifTrue)(prop) else collect(())(prop)
-
- /** Collect data for presentation in test report */
- def classify(c: => Boolean, ifTrue: Any, ifFalse: Any)(prop: Prop): Prop =
- if(c) collect(ifTrue)(prop) else collect(ifFalse)(prop)
-
- /** Wraps and protects a property */
- def secure[P <% Prop](p: => P): Prop =
- try (p: Prop) catch { case e: Throwable => exception(e) }
-
- /** Existential quantifier for an explicit generator. */
- def exists[A,P](f: A => P)(implicit
- pv: P => Prop,
- pp: A => Pretty,
- aa: Arbitrary[A]
- ): Prop = exists(aa.arbitrary)(f)
-
- /** Existential quantifier for an explicit generator. */
- def exists[A,P](g: Gen[A])(f: A => P)(implicit
- pv: P => Prop,
- pp: A => Pretty
- ): Prop = Prop { prms =>
- val gr = g.doApply(prms)
- gr.retrieve match {
- case None => undecided(prms)
- case Some(x) =>
- val p = secure(f(x))
- val labels = gr.labels.mkString(",")
- val r = p(prms).addArg(Arg(labels,x,0,x,pp(x),pp(x)))
- r.status match {
- case True => r.copy(status = Proof)
- case False => r.copy(status = Undecided)
- case _ => r
- }
- }
- }
-
- /** Universal quantifier for an explicit generator. Does not shrink failed
- * test cases. */
- def forAllNoShrink[T1,P](
- g1: Gen[T1])(
- f: T1 => P)(implicit
- pv: P => Prop,
- pp1: T1 => Pretty
- ): Prop = Prop { prms =>
- val gr = g1.doApply(prms)
- gr.retrieve match {
- case None => undecided(prms)
- case Some(x) =>
- val p = secure(f(x))
- val labels = gr.labels.mkString(",")
- provedToTrue(p(prms)).addArg(Arg(labels,x,0,x,pp1(x),pp1(x)))
- }
- }
-
- /** Universal quantifier for two explicit generators.
- * Does not shrink failed test cases. */
- def forAllNoShrink[T1,T2,P](
- g1: Gen[T1], g2: Gen[T2])(
- f: (T1,T2) => P)(implicit
- p: P => Prop,
- pp1: T1 => Pretty,
- pp2: T2 => Pretty
- ): Prop = forAllNoShrink(g1)(t => forAllNoShrink(g2)(f(t, _:T2)))
-
- /** Universal quantifier for three explicit generators.
- * Does not shrink failed test cases. */
- def forAllNoShrink[T1,T2,T3,P](
- g1: Gen[T1], g2: Gen[T2], g3: Gen[T3])(
- f: (T1,T2,T3) => P)(implicit
- p: P => Prop,
- pp1: T1 => Pretty,
- pp2: T2 => Pretty,
- pp3: T3 => Pretty
- ): Prop = forAllNoShrink(g1)(t => forAllNoShrink(g2,g3)(f(t, _:T2, _:T3)))
-
- /** Universal quantifier for four explicit generators.
- * Does not shrink failed test cases. */
- def forAllNoShrink[T1,T2,T3,T4,P](
- g1: Gen[T1], g2: Gen[T2], g3: Gen[T3], g4: Gen[T4])(
- f: (T1,T2,T3,T4) => P)(implicit
- p: P => Prop,
- pp1: T1 => Pretty,
- pp2: T2 => Pretty,
- pp3: T3 => Pretty,
- pp4: T4 => Pretty
- ): Prop = forAllNoShrink(g1)(t => forAllNoShrink(g2,g3,g4)(f(t, _:T2, _:T3, _:T4)))
-
- /** Universal quantifier for five explicit generators.
- * Does not shrink failed test cases. */
- def forAllNoShrink[T1,T2,T3,T4,T5,P](
- g1: Gen[T1], g2: Gen[T2], g3: Gen[T3], g4: Gen[T4], g5: Gen[T5])(
- f: (T1,T2,T3,T4,T5) => P)(implicit
- p: P => Prop,
- pp1: T1 => Pretty,
- pp2: T2 => Pretty,
- pp3: T3 => Pretty,
- pp4: T4 => Pretty,
- pp5: T5 => Pretty
- ): Prop = forAllNoShrink(g1)(t => forAllNoShrink(g2,g3,g4,g5)(f(t, _:T2, _:T3, _:T4, _:T5)))
-
- /** Universal quantifier for six explicit generators.
- * Does not shrink failed test cases. */
- def forAllNoShrink[T1,T2,T3,T4,T5,T6,P](
- g1: Gen[T1], g2: Gen[T2], g3: Gen[T3], g4: Gen[T4], g5: Gen[T5], g6: Gen[T6])(
- f: (T1,T2,T3,T4,T5,T6) => P)(implicit
- p: P => Prop,
- pp1: T1 => Pretty,
- pp2: T2 => Pretty,
- pp3: T3 => Pretty,
- pp4: T4 => Pretty,
- pp5: T5 => Pretty,
- pp6: T6 => Pretty
- ): Prop = forAllNoShrink(g1)(t => forAllNoShrink(g2,g3,g4,g5,g6)(f(t, _:T2, _:T3, _:T4, _:T5, _:T6)))
-
- /** Universal quantifier for seven explicit generators.
- * Does not shrink failed test cases. */
- def forAllNoShrink[T1,T2,T3,T4,T5,T6,T7,P](
- g1: Gen[T1], g2: Gen[T2], g3: Gen[T3], g4: Gen[T4], g5: Gen[T5], g6: Gen[T6], g7: Gen[T7])(
- f: (T1,T2,T3,T4,T5,T6,T7) => P)(implicit
- p: P => Prop,
- pp1: T1 => Pretty,
- pp2: T2 => Pretty,
- pp3: T3 => Pretty,
- pp4: T4 => Pretty,
- pp5: T5 => Pretty,
- pp6: T6 => Pretty,
- pp7: T7 => Pretty
- ): Prop = forAllNoShrink(g1)(t => forAllNoShrink(g2,g3,g4,g5,g6,g7)(f(t, _:T2, _:T3, _:T4, _:T5, _:T6, _:T7)))
-
- /** Universal quantifier for eight explicit generators.
- * Does not shrink failed test cases. */
- def forAllNoShrink[T1,T2,T3,T4,T5,T6,T7,T8,P](
- g1: Gen[T1], g2: Gen[T2], g3: Gen[T3], g4: Gen[T4], g5: Gen[T5], g6: Gen[T6], g7: Gen[T7], g8: Gen[T8])(
- f: (T1,T2,T3,T4,T5,T6,T7,T8) => P)(implicit
- p: P => Prop,
- pp1: T1 => Pretty,
- pp2: T2 => Pretty,
- pp3: T3 => Pretty,
- pp4: T4 => Pretty,
- pp5: T5 => Pretty,
- pp6: T6 => Pretty,
- pp7: T7 => Pretty,
- pp8: T8 => Pretty
- ): Prop = forAllNoShrink(g1)(t => forAllNoShrink(g2,g3,g4,g5,g6,g7,g8)(f(t, _:T2, _:T3, _:T4, _:T5, _:T6, _:T7, _:T8)))
-
- /** Converts a function into a universally quantified property */
- def forAllNoShrink[A1,P](
- f: A1 => P)(implicit
- pv: P => Prop,
- a1: Arbitrary[A1], pp1: A1 => Pretty
- ): Prop = forAllNoShrink(arbitrary[A1])(f)
-
- /** Converts a function into a universally quantified property */
- def forAllNoShrink[A1,A2,P](
- f: (A1,A2) => P)(implicit
- pv: P => Prop,
- a1: Arbitrary[A1], pp1: A1 => Pretty,
- a2: Arbitrary[A2], pp2: A2 => Pretty
- ): Prop = forAllNoShrink(arbitrary[A1], arbitrary[A2])(f)
-
- /** Converts a function into a universally quantified property */
- def forAllNoShrink[A1,A2,A3,P](
- f: (A1,A2,A3) => P)(implicit
- pv: P => Prop,
- a1: Arbitrary[A1], pp1: A1 => Pretty,
- a2: Arbitrary[A2], pp2: A2 => Pretty,
- a3: Arbitrary[A3], pp3: A3 => Pretty
- ): Prop = forAllNoShrink(arbitrary[A1], arbitrary[A2], arbitrary[A3])(f)
-
- /** Converts a function into a universally quantified property */
- def forAllNoShrink[A1,A2,A3,A4,P](
- f: (A1,A2,A3,A4) => P)(implicit
- pv: P => Prop,
- a1: Arbitrary[A1], pp1: A1 => Pretty,
- a2: Arbitrary[A2], pp2: A2 => Pretty,
- a3: Arbitrary[A3], pp3: A3 => Pretty,
- a4: Arbitrary[A4], pp4: A4 => Pretty
- ): Prop = forAllNoShrink(arbitrary[A1], arbitrary[A2], arbitrary[A3], arbitrary[A4])(f)
-
- /** Converts a function into a universally quantified property */
- def forAllNoShrink[A1,A2,A3,A4,A5,P](
- f: (A1,A2,A3,A4,A5) => P)(implicit
- pv: P => Prop,
- a1: Arbitrary[A1], pp1: A1 => Pretty,
- a2: Arbitrary[A2], pp2: A2 => Pretty,
- a3: Arbitrary[A3], pp3: A3 => Pretty,
- a4: Arbitrary[A4], pp4: A4 => Pretty,
- a5: Arbitrary[A5], pp5: A5 => Pretty
- ): Prop = forAllNoShrink(arbitrary[A1], arbitrary[A2], arbitrary[A3], arbitrary[A4], arbitrary[A5])(f)
-
- /** Converts a function into a universally quantified property */
- def forAllNoShrink[A1,A2,A3,A4,A5,A6,P](
- f: (A1,A2,A3,A4,A5,A6) => P)(implicit
- pv: P => Prop,
- a1: Arbitrary[A1], pp1: A1 => Pretty,
- a2: Arbitrary[A2], pp2: A2 => Pretty,
- a3: Arbitrary[A3], pp3: A3 => Pretty,
- a4: Arbitrary[A4], pp4: A4 => Pretty,
- a5: Arbitrary[A5], pp5: A5 => Pretty,
- a6: Arbitrary[A6], pp6: A6 => Pretty
- ): Prop = forAllNoShrink(arbitrary[A1], arbitrary[A2], arbitrary[A3], arbitrary[A4], arbitrary[A5], arbitrary[A6])(f)
-
- /** Converts a function into a universally quantified property */
- def forAllNoShrink[A1,A2,A3,A4,A5,A6,A7,P](
- f: (A1,A2,A3,A4,A5,A6,A7) => P)(implicit
- pv: P => Prop,
- a1: Arbitrary[A1], pp1: A1 => Pretty,
- a2: Arbitrary[A2], pp2: A2 => Pretty,
- a3: Arbitrary[A3], pp3: A3 => Pretty,
- a4: Arbitrary[A4], pp4: A4 => Pretty,
- a5: Arbitrary[A5], pp5: A5 => Pretty,
- a6: Arbitrary[A6], pp6: A6 => Pretty,
- a7: Arbitrary[A7], pp7: A7 => Pretty
- ): Prop = {
- forAllNoShrink(arbitrary[A1], arbitrary[A2], arbitrary[A3], arbitrary[A4], arbitrary[A5], arbitrary[A6],
- arbitrary[A7])(f)
- }
-
- /** Converts a function into a universally quantified property */
- def forAllNoShrink[A1,A2,A3,A4,A5,A6,A7,A8,P](
- f: (A1,A2,A3,A4,A5,A6,A7,A8) => P)(implicit
- pv: P => Prop,
- a1: Arbitrary[A1], pp1: A1 => Pretty,
- a2: Arbitrary[A2], pp2: A2 => Pretty,
- a3: Arbitrary[A3], pp3: A3 => Pretty,
- a4: Arbitrary[A4], pp4: A4 => Pretty,
- a5: Arbitrary[A5], pp5: A5 => Pretty,
- a6: Arbitrary[A6], pp6: A6 => Pretty,
- a7: Arbitrary[A7], pp7: A7 => Pretty,
- a8: Arbitrary[A8], pp8: A8 => Pretty
- ): Prop = {
- forAllNoShrink(arbitrary[A1], arbitrary[A2], arbitrary[A3], arbitrary[A4], arbitrary[A5], arbitrary[A6],
- arbitrary[A7], arbitrary[A8])(f)
- }
-
- /** Universal quantifier for an explicit generator. Shrinks failed arguments
- * with the given shrink function */
- def forAllShrink[T, P](g: Gen[T],
- shrink: T => Stream[T])(f: T => P
- )(implicit pv: P => Prop, pp: T => Pretty
- ): Prop = Prop { prms =>
-
- val gr = g.doApply(prms)
- val labels = gr.labels.mkString(",")
-
- def result(x: T) = {
- val p = secure(pv(f(x)))
- provedToTrue(p(prms))
- }
-
- /** Returns the first failed result in Left or success in Right */
- def getFirstFailure(xs: Stream[T]): Either[(T,Result),(T,Result)] = {
- assert(!xs.isEmpty, "Stream cannot be empty")
- val results = xs.map(x => (x, result(x)))
- results.dropWhile(!_._2.failure).headOption match {
- case None => Right(results.head)
- case Some(xr) => Left(xr)
- }
- }
-
- def shrinker(x: T, r: Result, shrinks: Int, orig: T): Result = {
- val xs = shrink(x).filter(gr.sieve)
- val res = r.addArg(Arg(labels,x,shrinks,orig,pp(x),pp(orig)))
- if(xs.isEmpty) res else getFirstFailure(xs) match {
- case Right((x2,r2)) => res
- case Left((x2,r2)) => shrinker(x2, replOrig(r,r2), shrinks+1, orig)
- }
- }
-
- def replOrig(r0: Result, r1: Result) = (r0.args,r1.args) match {
- case (a0::_,a1::as) =>
- r1.copy(
- args = a1.copy(
- origArg = a0.origArg,
- prettyOrigArg = a0.prettyOrigArg
- ) :: as
- )
- case _ => r1
- }
-
- gr.retrieve match {
- case None => undecided(prms)
- case Some(x) =>
- val r = result(x)
- if (!r.failure) r.addArg(Arg(labels,x,0,x,pp(x),pp(x)))
- else shrinker(x,r,0,x)
- }
-
- }
-
- /** Universal quantifier for an explicit generator. Shrinks failed arguments
- * with the default shrink function for the type */
- def forAll[T1,P](
- g1: Gen[T1])(
- f: T1 => P)(implicit
- p: P => Prop,
- s1: Shrink[T1],
- pp1: T1 => Pretty
- ): Prop = forAllShrink[T1,P](g1, shrink[T1])(f)
-
- /** Universal quantifier for two explicit generators. Shrinks failed arguments
- * with the default shrink function for the type */
- def forAll[T1,T2,P](
- g1: Gen[T1], g2: Gen[T2])(
- f: (T1,T2) => P)(implicit
- p: P => Prop,
- s1: Shrink[T1], pp1: T1 => Pretty,
- s2: Shrink[T2], pp2: T2 => Pretty
- ): Prop = forAll(g1)(t => forAll(g2)(f(t, _:T2)))
-
- /** Universal quantifier for three explicit generators. Shrinks failed arguments
- * with the default shrink function for the type */
- def forAll[T1,T2,T3,P](
- g1: Gen[T1], g2: Gen[T2], g3: Gen[T3])(
- f: (T1,T2,T3) => P)(implicit
- p: P => Prop,
- s1: Shrink[T1], pp1: T1 => Pretty,
- s2: Shrink[T2], pp2: T2 => Pretty,
- s3: Shrink[T3], pp3: T3 => Pretty
- ): Prop = forAll(g1)(t => forAll(g2,g3)(f(t, _:T2, _:T3)))
-
- /** Universal quantifier for four explicit generators. Shrinks failed arguments
- * with the default shrink function for the type */
- def forAll[T1,T2,T3,T4,P](
- g1: Gen[T1], g2: Gen[T2], g3: Gen[T3], g4: Gen[T4])(
- f: (T1,T2,T3,T4) => P)(implicit
- p: P => Prop,
- s1: Shrink[T1], pp1: T1 => Pretty,
- s2: Shrink[T2], pp2: T2 => Pretty,
- s3: Shrink[T3], pp3: T3 => Pretty,
- s4: Shrink[T4], pp4: T4 => Pretty
- ): Prop = forAll(g1)(t => forAll(g2,g3,g4)(f(t, _:T2, _:T3, _:T4)))
-
- /** Universal quantifier for five explicit generators. Shrinks failed arguments
- * with the default shrink function for the type */
- def forAll[T1,T2,T3,T4,T5,P](
- g1: Gen[T1], g2: Gen[T2], g3: Gen[T3], g4: Gen[T4], g5: Gen[T5])(
- f: (T1,T2,T3,T4,T5) => P)(implicit
- p: P => Prop,
- s1: Shrink[T1], pp1: T1 => Pretty,
- s2: Shrink[T2], pp2: T2 => Pretty,
- s3: Shrink[T3], pp3: T3 => Pretty,
- s4: Shrink[T4], pp4: T4 => Pretty,
- s5: Shrink[T5], pp5: T5 => Pretty
- ): Prop = forAll(g1)(t => forAll(g2,g3,g4,g5)(f(t, _:T2, _:T3, _:T4, _:T5)))
-
- /** Universal quantifier for six explicit generators. Shrinks failed arguments
- * with the default shrink function for the type */
- def forAll[T1,T2,T3,T4,T5,T6,P](
- g1: Gen[T1], g2: Gen[T2], g3: Gen[T3], g4: Gen[T4], g5: Gen[T5], g6: Gen[T6])(
- f: (T1,T2,T3,T4,T5,T6) => P)(implicit
- p: P => Prop,
- s1: Shrink[T1], pp1: T1 => Pretty,
- s2: Shrink[T2], pp2: T2 => Pretty,
- s3: Shrink[T3], pp3: T3 => Pretty,
- s4: Shrink[T4], pp4: T4 => Pretty,
- s5: Shrink[T5], pp5: T5 => Pretty,
- s6: Shrink[T6], pp6: T6 => Pretty
- ): Prop = forAll(g1)(t => forAll(g2,g3,g4,g5,g6)(f(t, _:T2, _:T3, _:T4, _:T5, _:T6)))
-
- /** Universal quantifier for seven explicit generators. Shrinks failed arguments
- * with the default shrink function for the type */
- def forAll[T1,T2,T3,T4,T5,T6,T7,P](
- g1: Gen[T1], g2: Gen[T2], g3: Gen[T3], g4: Gen[T4], g5: Gen[T5], g6: Gen[T6], g7: Gen[T7])(
- f: (T1,T2,T3,T4,T5,T6,T7) => P)(implicit
- p: P => Prop,
- s1: Shrink[T1], pp1: T1 => Pretty,
- s2: Shrink[T2], pp2: T2 => Pretty,
- s3: Shrink[T3], pp3: T3 => Pretty,
- s4: Shrink[T4], pp4: T4 => Pretty,
- s5: Shrink[T5], pp5: T5 => Pretty,
- s6: Shrink[T6], pp6: T6 => Pretty,
- s7: Shrink[T7], pp7: T7 => Pretty
- ): Prop = forAll(g1)(t => forAll(g2,g3,g4,g5,g6,g7)(f(t, _:T2, _:T3, _:T4, _:T5, _:T6, _:T7)))
-
- /** Universal quantifier for eight explicit generators. Shrinks failed arguments
- * with the default shrink function for the type */
- def forAll[T1,T2,T3,T4,T5,T6,T7,T8,P](
- g1: Gen[T1], g2: Gen[T2], g3: Gen[T3], g4: Gen[T4], g5: Gen[T5], g6: Gen[T6], g7: Gen[T7], g8: Gen[T8])(
- f: (T1,T2,T3,T4,T5,T6,T7,T8) => P)(implicit
- p: P => Prop,
- s1: Shrink[T1], pp1: T1 => Pretty,
- s2: Shrink[T2], pp2: T2 => Pretty,
- s3: Shrink[T3], pp3: T3 => Pretty,
- s4: Shrink[T4], pp4: T4 => Pretty,
- s5: Shrink[T5], pp5: T5 => Pretty,
- s6: Shrink[T6], pp6: T6 => Pretty,
- s7: Shrink[T7], pp7: T7 => Pretty,
- s8: Shrink[T8], pp8: T8 => Pretty
- ): Prop = forAll(g1)(t => forAll(g2,g3,g4,g5,g6,g7,g8)(f(t, _:T2, _:T3, _:T4, _:T5, _:T6, _:T7, _:T8)))
-
- /** Converts a function into a universally quantified property */
- def forAll[A1,P] (
- f: A1 => P)(implicit
- p: P => Prop,
- a1: Arbitrary[A1], s1: Shrink[A1], pp1: A1 => Pretty
- ): Prop = forAllShrink(arbitrary[A1],shrink[A1])(f andThen p)
-
- /** Converts a function into a universally quantified property */
- def forAll[A1,A2,P] (
- f: (A1,A2) => P)(implicit
- p: P => Prop,
- a1: Arbitrary[A1], s1: Shrink[A1], pp1: A1 => Pretty,
- a2: Arbitrary[A2], s2: Shrink[A2], pp2: A2 => Pretty
- ): Prop = forAll((a: A1) => forAll(f(a, _:A2)))
-
- /** Converts a function into a universally quantified property */
- def forAll[A1,A2,A3,P] (
- f: (A1,A2,A3) => P)(implicit
- p: P => Prop,
- a1: Arbitrary[A1], s1: Shrink[A1], pp1: A1 => Pretty,
- a2: Arbitrary[A2], s2: Shrink[A2], pp2: A2 => Pretty,
- a3: Arbitrary[A3], s3: Shrink[A3], pp3: A3 => Pretty
- ): Prop = forAll((a: A1) => forAll(f(a, _:A2, _:A3)))
-
- /** Converts a function into a universally quantified property */
- def forAll[A1,A2,A3,A4,P] (
- f: (A1,A2,A3,A4) => P)(implicit
- p: P => Prop,
- a1: Arbitrary[A1], s1: Shrink[A1], pp1: A1 => Pretty,
- a2: Arbitrary[A2], s2: Shrink[A2], pp2: A2 => Pretty,
- a3: Arbitrary[A3], s3: Shrink[A3], pp3: A3 => Pretty,
- a4: Arbitrary[A4], s4: Shrink[A4], pp4: A4 => Pretty
- ): Prop = forAll((a: A1) => forAll(f(a, _:A2, _:A3, _:A4)))
-
- /** Converts a function into a universally quantified property */
- def forAll[A1,A2,A3,A4,A5,P] (
- f: (A1,A2,A3,A4,A5) => P)(implicit
- p: P => Prop,
- a1: Arbitrary[A1], s1: Shrink[A1], pp1: A1 => Pretty,
- a2: Arbitrary[A2], s2: Shrink[A2], pp2: A2 => Pretty,
- a3: Arbitrary[A3], s3: Shrink[A3], pp3: A3 => Pretty,
- a4: Arbitrary[A4], s4: Shrink[A4], pp4: A4 => Pretty,
- a5: Arbitrary[A5], s5: Shrink[A5], pp5: A5 => Pretty
- ): Prop = forAll((a: A1) => forAll(f(a, _:A2, _:A3, _:A4, _:A5)))
-
- /** Converts a function into a universally quantified property */
- def forAll[A1,A2,A3,A4,A5,A6,P] (
- f: (A1,A2,A3,A4,A5,A6) => P)(implicit
- p: P => Prop,
- a1: Arbitrary[A1], s1: Shrink[A1], pp1: A1 => Pretty,
- a2: Arbitrary[A2], s2: Shrink[A2], pp2: A2 => Pretty,
- a3: Arbitrary[A3], s3: Shrink[A3], pp3: A3 => Pretty,
- a4: Arbitrary[A4], s4: Shrink[A4], pp4: A4 => Pretty,
- a5: Arbitrary[A5], s5: Shrink[A5], pp5: A5 => Pretty,
- a6: Arbitrary[A6], s6: Shrink[A6], pp6: A6 => Pretty
- ): Prop = forAll((a: A1) => forAll(f(a, _:A2, _:A3, _:A4, _:A5, _:A6)))
-
- /** Converts a function into a universally quantified property */
- def forAll[A1,A2,A3,A4,A5,A6,A7,P] (
- f: (A1,A2,A3,A4,A5,A6,A7) => P)(implicit
- p: P => Prop,
- a1: Arbitrary[A1], s1: Shrink[A1], pp1: A1 => Pretty,
- a2: Arbitrary[A2], s2: Shrink[A2], pp2: A2 => Pretty,
- a3: Arbitrary[A3], s3: Shrink[A3], pp3: A3 => Pretty,
- a4: Arbitrary[A4], s4: Shrink[A4], pp4: A4 => Pretty,
- a5: Arbitrary[A5], s5: Shrink[A5], pp5: A5 => Pretty,
- a6: Arbitrary[A6], s6: Shrink[A6], pp6: A6 => Pretty,
- a7: Arbitrary[A7], s7: Shrink[A7], pp7: A7 => Pretty
- ): Prop = forAll((a: A1) => forAll(f(a, _:A2, _:A3, _:A4, _:A5, _:A6, _:A7)))
-
- /** Converts a function into a universally quantified property */
- def forAll[A1,A2,A3,A4,A5,A6,A7,A8,P] (
- f: (A1,A2,A3,A4,A5,A6,A7,A8) => P)(implicit
- p: P => Prop,
- a1: Arbitrary[A1], s1: Shrink[A1], pp1: A1 => Pretty,
- a2: Arbitrary[A2], s2: Shrink[A2], pp2: A2 => Pretty,
- a3: Arbitrary[A3], s3: Shrink[A3], pp3: A3 => Pretty,
- a4: Arbitrary[A4], s4: Shrink[A4], pp4: A4 => Pretty,
- a5: Arbitrary[A5], s5: Shrink[A5], pp5: A5 => Pretty,
- a6: Arbitrary[A6], s6: Shrink[A6], pp6: A6 => Pretty,
- a7: Arbitrary[A7], s7: Shrink[A7], pp7: A7 => Pretty,
- a8: Arbitrary[A8], s8: Shrink[A8], pp8: A8 => Pretty
- ): Prop = forAll((a: A1) => forAll(f(a, _:A2, _:A3, _:A4, _:A5, _:A6, _:A7, _:A8)))
-
- /** Ensures that the property expression passed in completes within the given
- * space of time. */
- def within(maximumMs: Long)(wrappedProp: => Prop): Prop = new Prop {
- @tailrec private def attempt(prms: Parameters, endTime: Long): Result = {
- val result = wrappedProp.apply(prms)
- if (System.currentTimeMillis > endTime) {
- (if(result.failure) result else Result(status = False)).label("Timeout")
- } else {
- if (result.success) result
- else attempt(prms, endTime)
- }
- }
- def apply(prms: Parameters) = attempt(prms, System.currentTimeMillis + maximumMs)
- }
-}
diff --git a/src/partest-extras/scala/org/scalacheck/Properties.scala b/src/partest-extras/scala/org/scalacheck/Properties.scala
deleted file mode 100644
index abaac61c7f..0000000000
--- a/src/partest-extras/scala/org/scalacheck/Properties.scala
+++ /dev/null
@@ -1,82 +0,0 @@
-/*-------------------------------------------------------------------------*\
-** ScalaCheck **
-** Copyright (c) 2007-2014 Rickard Nilsson. All rights reserved. **
-** http://www.scalacheck.org **
-** **
-** This software is released under the terms of the Revised BSD License. **
-** There is NO WARRANTY. See the file LICENSE for the full text. **
-\*------------------------------------------------------------------------ */
-
-package org.scalacheck
-
-import util.ConsoleReporter
-
-/** Represents a collection of properties, with convenient methods
- * for checking all properties at once. This class is itself a property, which
- * holds if and only if all of the contained properties hold.
- * <p>Properties are added in the following way:</p>
- *
- * {{{
- * object MyProps extends Properties("MyProps") {
- * property("myProp1") = forAll { (n:Int, m:Int) =>
- * n+m == m+n
- * }
- * }
- * }}}
- */
-class Properties(val name: String) extends Prop {
-
- private val props = new scala.collection.mutable.ListBuffer[(String,Prop)]
-
- /** Returns one property which holds if and only if all of the
- * properties in this property collection hold */
- private def oneProperty: Prop = Prop.all((properties map (_._2)):_*)
-
- /** Returns all properties of this collection in a list of name/property
- * pairs. */
- def properties: Seq[(String,Prop)] = props
-
- def apply(p: Gen.Parameters) = oneProperty(p)
-
- /** Convenience method that checks the properties with the given parameters
- * and reports the result on the console. If you need to get the results
- * from the test use the `check` methods in [[org.scalacheck.Test]]
- * instead. */
- override def check(prms: Test.Parameters): Unit = Test.checkProperties(
- prms.withTestCallback(ConsoleReporter(1) chain prms.testCallback), this
- )
-
- /** Convenience method that checks the properties and reports the
- * result on the console. If you need to get the results from the test use
- * the `check` methods in [[org.scalacheck.Test]] instead. */
- override def check: Unit = check(Test.Parameters.default)
-
- /** The logic for main, separated out to make it easier to
- * avoid System.exit calls. Returns exit code.
- */
- override def mainRunner(args: Array[String]): Int = {
- Test.parseParams(args) match {
- case Some(params) =>
- val res = Test.checkProperties(params, this)
- val failed = res.filter(!_._2.passed).size
- failed
- case None =>
- println("Incorrect options")
- -1
- }
- }
-
- /** Adds all properties from another property collection to this one. */
- def include(ps: Properties) = for((n,p) <- ps.properties) property(n) = p
-
- /** Used for specifying properties. Usage:
- * {{{
- * property("myProp") = ...
- * }}}
- */
- class PropertySpecifier() {
- def update(propName: String, p: Prop) = props += ((name+"."+propName, p))
- }
-
- lazy val property = new PropertySpecifier()
-}
diff --git a/src/partest-extras/scala/org/scalacheck/ScalaCheckFramework.scala b/src/partest-extras/scala/org/scalacheck/ScalaCheckFramework.scala
deleted file mode 100644
index 754b67764d..0000000000
--- a/src/partest-extras/scala/org/scalacheck/ScalaCheckFramework.scala
+++ /dev/null
@@ -1,93 +0,0 @@
-/*-------------------------------------------------------------------------*\
-** ScalaCheck **
-** Copyright (c) 2007-2014 Rickard Nilsson. All rights reserved. **
-** http://www.scalacheck.org **
-** **
-** This software is released under the terms of the Revised BSD License. **
-** There is NO WARRANTY. See the file LICENSE for the full text. **
-\*------------------------------------------------------------------------ */
-
-package org.scalacheck
-
-import util.Pretty
-
-import org.scalatools.testing._
-
-class ScalaCheckFramework extends Framework {
-
- private def mkFP(mod: Boolean, cname: String) =
- new SubclassFingerprint {
- val superClassName = cname
- val isModule = mod
- }
-
- val name = "ScalaCheck"
-
- val tests = Array[Fingerprint](
- mkFP(true, "org.scalacheck.Properties"),
- mkFP(false, "org.scalacheck.Prop"),
- mkFP(false, "org.scalacheck.Properties"),
- mkFP(true, "org.scalacheck.Prop")
- )
-
- def testRunner(loader: ClassLoader, loggers: Array[Logger]) = new Runner2 {
-
- private def asEvent(nr: (String, Test.Result)) = nr match {
- case (n: String, r: Test.Result) => new Event {
- val testName = n
- val description = n
- val result = r.status match {
- case Test.Passed => Result.Success
- case _:Test.Proved => Result.Success
- case _:Test.Failed => Result.Failure
- case Test.Exhausted => Result.Skipped
- case _:Test.PropException | _:Test.GenException => Result.Error
- }
- val error = r.status match {
- case Test.PropException(_, e, _) => e
- case _:Test.Failed => new Exception(Pretty.pretty(r,Pretty.Params(0)))
- case _ => null
- }
- }
- }
-
- def run(testClassName: String, fingerprint: Fingerprint, handler: EventHandler, args: Array[String]) {
-
- val testCallback = new Test.TestCallback {
- override def onPropEval(n: String, w: Int, s: Int, d: Int) = {}
-
- override def onTestResult(n: String, r: Test.Result) = {
- for (l <- loggers) {
- import Pretty._
- val verbosityOpts = Set("-verbosity", "-v")
- val verbosity = args.grouped(2).filter(twos => verbosityOpts(twos.head)).toSeq.headOption.map(_.last).map(_.toInt).getOrElse(0)
- l.info(
- (if (r.passed) "+ " else "! ") + n + ": " + pretty(r, Params(verbosity))
- )
- }
- handler.handle(asEvent((n,r)))
- }
- }
-
- val prms = Test.parseParams(args) match {
- case Some(params) =>
- params.withTestCallback(testCallback).withCustomClassLoader(Some(loader))
- // TODO: Maybe handle this a bit better than throwing exception?
- case None => throw new Exception()
- }
-
- fingerprint match {
- case fp: SubclassFingerprint =>
- val obj =
- if(fp.isModule) Class.forName(testClassName + "$", true, loader).getField("MODULE$").get(null)
- else Class.forName(testClassName, true, loader).newInstance
- if(obj.isInstanceOf[Properties])
- Test.checkProperties(prms, obj.asInstanceOf[Properties])
- else
- handler.handle(asEvent((testClassName, Test.check(prms, obj.asInstanceOf[Prop]))))
- }
- }
-
- }
-
-}
diff --git a/src/partest-extras/scala/org/scalacheck/Shrink.scala b/src/partest-extras/scala/org/scalacheck/Shrink.scala
deleted file mode 100644
index 8ec28f4c4b..0000000000
--- a/src/partest-extras/scala/org/scalacheck/Shrink.scala
+++ /dev/null
@@ -1,215 +0,0 @@
-/*-------------------------------------------------------------------------*\
-** ScalaCheck **
-** Copyright (c) 2007-2014 Rickard Nilsson. All rights reserved. **
-** http://www.scalacheck.org **
-** **
-** This software is released under the terms of the Revised BSD License. **
-** There is NO WARRANTY. See the file LICENSE for the full text. **
-\*------------------------------------------------------------------------ */
-
-package org.scalacheck
-
-import util.{Buildable,Buildable2}
-import scala.collection.{ JavaConversions => jcl }
-
-sealed abstract class Shrink[T] {
- def shrink(x: T): Stream[T]
-}
-
-object Shrink {
-
- import Stream.{cons, empty}
- import scala.collection._
- import java.util.ArrayList
-
- /** Interleaves two streams */
- private def interleave[T](xs: Stream[T], ys: Stream[T]): Stream[T] =
- if(xs.isEmpty) ys
- else if(ys.isEmpty) xs
- else cons(xs.head, cons(ys.head, interleave(xs.tail, ys.tail)))
-
- /** Shrink instance factory */
- def apply[T](s: T => Stream[T]): Shrink[T] = new Shrink[T] {
- override def shrink(x: T) = s(x)
- }
-
- /** Shrink a value */
- def shrink[T](x: T)(implicit s: Shrink[T]): Stream[T] = s.shrink(x)
-
- /** Default shrink instance */
- implicit def shrinkAny[T]: Shrink[T] = Shrink(x => empty)
-
- /** Shrink instance of container */
- implicit def shrinkContainer[C[_],T](implicit v: C[T] => Traversable[T], s: Shrink[T],
- b: Buildable[T,C]
- ): Shrink[C[T]] = Shrink { xs: C[T] =>
- val ys = v(xs)
- val zs = ys.toStream
- removeChunks(ys.size,zs).append(shrinkOne(zs)).map(b.fromIterable)
- }
-
- /** Shrink instance of container2 */
- implicit def shrinkContainer2[C[_,_],T,U](implicit v: C[T,U] => Traversable[(T,U)], s: Shrink[(T,U)],
- b: Buildable2[T,U,C]
- ): Shrink[C[T,U]] = Shrink { xs: C[T,U] =>
- val ys = v(xs)
- val zs = ys.toStream
- removeChunks(ys.size,zs).append(shrinkOne(zs)).map(b.fromIterable)
- }
-
- private def removeChunks[T](n: Int, xs: Stream[T]): Stream[Stream[T]] =
- if (xs.isEmpty) empty
- else if (xs.tail.isEmpty) cons(empty, empty)
- else {
- val n1 = n / 2
- val n2 = n - n1
- lazy val xs1 = xs.take(n1)
- lazy val xs2 = xs.drop(n1)
- lazy val xs3 =
- for (ys1 <- removeChunks(n1, xs1) if !ys1.isEmpty) yield ys1 append xs2
- lazy val xs4 =
- for (ys2 <- removeChunks(n2, xs2) if !ys2.isEmpty) yield xs1 append ys2
-
- cons(xs1, cons(xs2, interleave(xs3, xs4)))
- }
-
- private def shrinkOne[T : Shrink](zs: Stream[T]): Stream[Stream[T]] =
- if (zs.isEmpty) empty
- else {
- val x = zs.head
- val xs = zs.tail
- shrink(x).map(cons(_,xs)).append(shrinkOne(xs).map(cons(x,_)))
- }
-
- /** Shrink instance of integer */
- implicit lazy val shrinkInt: Shrink[Int] = Shrink { n =>
-
- def halfs(n: Int): Stream[Int] =
- if(n == 0) empty else cons(n, halfs(n/2))
-
- if(n == 0) empty else {
- val ns = halfs(n/2).map(n - _)
- cons(0, interleave(ns, ns.map(-1 * _)))
- }
- }
-
- /** Shrink instance of String */
- implicit lazy val shrinkString: Shrink[String] = Shrink { s =>
- shrinkContainer[List,Char].shrink(s.toList).map(_.mkString)
- }
-
- /** Shrink instance of Option */
- implicit def shrinkOption[T : Shrink]: Shrink[Option[T]] = Shrink {
- case None => empty
- case Some(x) => cons(None, for(y <- shrink(x)) yield Some(y))
- }
-
- /** Shrink instance of 2-tuple */
- implicit def shrinkTuple2[
- T1:Shrink, T2:Shrink
- ]: Shrink[(T1,T2)] =
- Shrink { case (t1,t2) =>
- shrink(t1).map((_,t2)) append
- shrink(t2).map((t1,_))
- }
-
- /** Shrink instance of 3-tuple */
- implicit def shrinkTuple3[
- T1:Shrink, T2:Shrink, T3:Shrink
- ]: Shrink[(T1,T2,T3)] =
- Shrink { case (t1,t2,t3) =>
- shrink(t1).map((_, t2, t3)) append
- shrink(t2).map((t1, _, t3)) append
- shrink(t3).map((t1, t2, _))
- }
-
- /** Shrink instance of 4-tuple */
- implicit def shrinkTuple4[
- T1:Shrink, T2:Shrink, T3:Shrink, T4:Shrink
- ]: Shrink[(T1,T2,T3,T4)] =
- Shrink { case (t1,t2,t3,t4) =>
- shrink(t1).map((_, t2, t3, t4)) append
- shrink(t2).map((t1, _, t3, t4)) append
- shrink(t3).map((t1, t2, _, t4)) append
- shrink(t4).map((t1, t2, t3, _))
- }
-
- /** Shrink instance of 5-tuple */
- implicit def shrinkTuple5[
- T1:Shrink, T2:Shrink, T3:Shrink, T4:Shrink, T5:Shrink
- ]: Shrink[(T1,T2,T3,T4,T5)] =
- Shrink { case (t1,t2,t3,t4,t5) =>
- shrink(t1).map((_, t2, t3, t4, t5)) append
- shrink(t2).map((t1, _, t3, t4, t5)) append
- shrink(t3).map((t1, t2, _, t4, t5)) append
- shrink(t4).map((t1, t2, t3, _, t5)) append
- shrink(t5).map((t1, t2, t3, t4, _))
- }
-
- /** Shrink instance of 6-tuple */
- implicit def shrinkTuple6[
- T1:Shrink, T2:Shrink, T3:Shrink, T4:Shrink, T5:Shrink, T6:Shrink
- ]: Shrink[(T1,T2,T3,T4,T5,T6)] =
- Shrink { case (t1,t2,t3,t4,t5,t6) =>
- shrink(t1).map((_, t2, t3, t4, t5, t6)) append
- shrink(t2).map((t1, _, t3, t4, t5, t6)) append
- shrink(t3).map((t1, t2, _, t4, t5, t6)) append
- shrink(t4).map((t1, t2, t3, _, t5, t6)) append
- shrink(t5).map((t1, t2, t3, t4, _, t6)) append
- shrink(t6).map((t1, t2, t3, t4, t5, _))
- }
-
- /** Shrink instance of 7-tuple */
- implicit def shrinkTuple7[
- T1:Shrink, T2:Shrink, T3:Shrink, T4:Shrink, T5:Shrink, T6:Shrink, T7:Shrink
- ]: Shrink[(T1,T2,T3,T4,T5,T6,T7)] =
- Shrink { case (t1,t2,t3,t4,t5,t6,t7) =>
- shrink(t1).map((_, t2, t3, t4, t5, t6, t7)) append
- shrink(t2).map((t1, _, t3, t4, t5, t6, t7)) append
- shrink(t3).map((t1, t2, _, t4, t5, t6, t7)) append
- shrink(t4).map((t1, t2, t3, _, t5, t6, t7)) append
- shrink(t5).map((t1, t2, t3, t4, _, t6, t7)) append
- shrink(t6).map((t1, t2, t3, t4, t5, _, t7)) append
- shrink(t7).map((t1, t2, t3, t4, t5, t6, _))
- }
-
- /** Shrink instance of 8-tuple */
- implicit def shrinkTuple8[
- T1:Shrink, T2:Shrink, T3:Shrink, T4:Shrink, T5:Shrink, T6:Shrink,
- T7:Shrink, T8:Shrink
- ]: Shrink[(T1,T2,T3,T4,T5,T6,T7,T8)] =
- Shrink { case (t1,t2,t3,t4,t5,t6,t7,t8) =>
- shrink(t1).map((_, t2, t3, t4, t5, t6, t7, t8)) append
- shrink(t2).map((t1, _, t3, t4, t5, t6, t7, t8)) append
- shrink(t3).map((t1, t2, _, t4, t5, t6, t7, t8)) append
- shrink(t4).map((t1, t2, t3, _, t5, t6, t7, t8)) append
- shrink(t5).map((t1, t2, t3, t4, _, t6, t7, t8)) append
- shrink(t6).map((t1, t2, t3, t4, t5, _, t7, t8)) append
- shrink(t7).map((t1, t2, t3, t4, t5, t6, _, t8)) append
- shrink(t8).map((t1, t2, t3, t4, t5, t6, t7, _))
- }
-
- /** Shrink instance of 9-tuple */
- implicit def shrinkTuple9[
- T1:Shrink, T2:Shrink, T3:Shrink, T4:Shrink, T5:Shrink, T6:Shrink,
- T7:Shrink, T8:Shrink, T9:Shrink
- ]: Shrink[(T1,T2,T3,T4,T5,T6,T7,T8,T9)] =
- Shrink { case (t1,t2,t3,t4,t5,t6,t7,t8,t9) =>
- shrink(t1).map((_, t2, t3, t4, t5, t6, t7, t8, t9)) append
- shrink(t2).map((t1, _, t3, t4, t5, t6, t7, t8, t9)) append
- shrink(t3).map((t1, t2, _, t4, t5, t6, t7, t8, t9)) append
- shrink(t4).map((t1, t2, t3, _, t5, t6, t7, t8, t9)) append
- shrink(t5).map((t1, t2, t3, t4, _, t6, t7, t8, t9)) append
- shrink(t6).map((t1, t2, t3, t4, t5, _, t7, t8, t9)) append
- shrink(t7).map((t1, t2, t3, t4, t5, t6, _, t8, t9)) append
- shrink(t8).map((t1, t2, t3, t4, t5, t6, t7, _, t9)) append
- shrink(t9).map((t1, t2, t3, t4, t5, t6, t7, t8, _))
- }
-
- /** Transform a Shrink[T] to a Shrink[U] where T and U are two isomorphic types
- * whose relationship is described by the provided transformation functions.
- * (exponential functor map) */
- def xmap[T, U](from: T => U, to: U => T)(implicit st: Shrink[T]): Shrink[U] = Shrink[U] { u: U ⇒
- st.shrink(to(u)).map(from)
- }
-}
diff --git a/src/partest-extras/scala/org/scalacheck/Test.scala b/src/partest-extras/scala/org/scalacheck/Test.scala
deleted file mode 100644
index 9a9c62b93f..0000000000
--- a/src/partest-extras/scala/org/scalacheck/Test.scala
+++ /dev/null
@@ -1,372 +0,0 @@
-/*-------------------------------------------------------------------------*\
-** ScalaCheck **
-** Copyright (c) 2007-2014 Rickard Nilsson. All rights reserved. **
-** http://www.scalacheck.org **
-** **
-** This software is released under the terms of the Revised BSD License. **
-** There is NO WARRANTY. See the file LICENSE for the full text. **
-\*------------------------------------------------------------------------ */
-
-package org.scalacheck
-
-import Prop.Arg
-
-object Test {
-
- import util.{FreqMap, ConsoleReporter}
-
- /** Test parameters used by the check methods. Default
- * parameters are defined by [[Test.Parameters.Default]]. */
- trait Parameters {
- /** The minimum number of tests that must succeed for ScalaCheck to
- * consider a property passed. */
- val minSuccessfulTests: Int
-
- /** Create a copy of this [[Test.Parameters]] instance with
- * [[Test.Parameters.minSuccessfulTests]] set to the specified value. */
- def withMinSuccessfulTests(minSuccessfulTests: Int): Parameters = cp(
- minSuccessfulTests = minSuccessfulTests
- )
-
- /** The starting size given as parameter to the generators. */
- val minSize: Int
-
- /** Create a copy of this [[Test.Parameters]] instance with
- * [[Test.Parameters.minSize]] set to the specified value. */
- def withMinSize(minSize: Int): Parameters = cp(
- minSize = minSize
- )
-
- /** The maximum size given as parameter to the generators. */
- val maxSize: Int
-
- /** Create a copy of this [[Test.Parameters]] instance with
- * [[Test.Parameters.maxSize]] set to the specified value. */
- def withMaxSize(maxSize: Int): Parameters = cp(
- maxSize = maxSize
- )
-
- /** The random number generator used. */
- val rng: scala.util.Random
-
- /** Create a copy of this [[Test.Parameters]] instance with
- * [[Test.Parameters.rng]] set to the specified value. */
- def withRng(rng: scala.util.Random): Parameters = cp(
- rng = rng
- )
-
- /** The number of tests to run in parallel. */
- val workers: Int
-
- /** Create a copy of this [[Test.Parameters]] instance with
- * [[Test.Parameters.workers]] set to the specified value. */
- def withWorkers(workers: Int): Parameters = cp(
- workers = workers
- )
-
- /** A callback that ScalaCheck calls each time a test is executed. */
- val testCallback: TestCallback
-
- /** Create a copy of this [[Test.Parameters]] instance with
- * [[Test.Parameters.testCallback]] set to the specified value. */
- def withTestCallback(testCallback: TestCallback): Parameters = cp(
- testCallback = testCallback
- )
-
- /** The maximum ratio between discarded and passed tests allowed before
- * ScalaCheck gives up and discards the property. At least
- * `minSuccesfulTests` will always be run, though. */
- val maxDiscardRatio: Float
-
- /** Create a copy of this [[Test.Parameters]] instance with
- * [[Test.Parameters.maxDiscardRatio]] set to the specified value. */
- def withMaxDiscardRatio(maxDiscardRatio: Float): Parameters = cp(
- maxDiscardRatio = maxDiscardRatio
- )
-
- /** A custom class loader that should be used during test execution. */
- val customClassLoader: Option[ClassLoader]
-
- /** Create a copy of this [[Test.Parameters]] instance with
- * [[Test.Parameters.customClassLoader]] set to the specified value. */
- def withCustomClassLoader(customClassLoader: Option[ClassLoader]
- ): Parameters = cp(
- customClassLoader = customClassLoader
- )
-
- // private since we can't guarantee binary compatibility for this one
- private case class cp(
- minSuccessfulTests: Int = minSuccessfulTests,
- minSize: Int = minSize,
- maxSize: Int = maxSize,
- rng: scala.util.Random = rng,
- workers: Int = workers,
- testCallback: TestCallback = testCallback,
- maxDiscardRatio: Float = maxDiscardRatio,
- customClassLoader: Option[ClassLoader] = customClassLoader
- ) extends Parameters
- }
-
- /** Test parameters used by the check methods. Default
- * parameters are defined by [[Test.Parameters.Default]]. */
- object Parameters {
- /** Default test parameters trait. This can be overriden if you need to
- * tweak the parameters:
- *
- * {{{
- * val myParams = new Parameters.Default {
- * override val minSuccesfulTests = 600
- * override val maxDiscardRatio = 8
- * }
- * }}}
- *
- * You can also use the withXXX-methods in
- * [[org.scalacheck.Test.Parameters]] to achieve
- * the same thing:
- *
- * {{{
- * val myParams = Parameters.default
- * .withMinSuccessfulTests(600)
- * .withMaxDiscardRatio(8)
- * }}} */
- trait Default extends Parameters {
- val minSuccessfulTests: Int = 100
- val minSize: Int = 0
- val maxSize: Int = Gen.Parameters.default.size
- val rng: scala.util.Random = Gen.Parameters.default.rng
- val workers: Int = 1
- val testCallback: TestCallback = new TestCallback {}
- val maxDiscardRatio: Float = 5
- val customClassLoader: Option[ClassLoader] = None
- }
-
- /** Default test parameters instance. */
- val default: Parameters = new Default {}
-
- /** Verbose console reporter test parameters instance. */
- val defaultVerbose: Parameters = new Default {
- override val testCallback = ConsoleReporter(2)
- }
- }
-
- /** Test statistics */
- case class Result(
- status: Status,
- succeeded: Int,
- discarded: Int,
- freqMap: FreqMap[Set[Any]],
- time: Long = 0
- ) {
- def passed = status match {
- case Passed => true
- case Proved(_) => true
- case _ => false
- }
- }
-
- /** Test status */
- sealed trait Status
-
- /** ScalaCheck found enough cases for which the property holds, so the
- * property is considered correct. (It is not proved correct, though). */
- case object Passed extends Status
-
- /** ScalaCheck managed to prove the property correct */
- sealed case class Proved(args: List[Arg[Any]]) extends Status
-
- /** The property was proved wrong with the given concrete arguments. */
- sealed case class Failed(args: List[Arg[Any]], labels: Set[String]) extends Status
-
- /** The property test was exhausted, it wasn't possible to generate enough
- * concrete arguments satisfying the preconditions to get enough passing
- * property evaluations. */
- case object Exhausted extends Status
-
- /** An exception was raised when trying to evaluate the property with the
- * given concrete arguments. If an exception was raised before or during
- * argument generation, the argument list will be empty. */
- sealed case class PropException(args: List[Arg[Any]], e: Throwable,
- labels: Set[String]) extends Status
-
- /** An exception was raised when trying to generate concrete arguments
- * for evaluating the property.
- * @deprecated Not used. The type PropException is used for all exceptions.
- */
- @deprecated("Not used. The type PropException is used for all exceptions.", "1.11.2")
- sealed case class GenException(e: Throwable) extends Status
-
- trait TestCallback { self =>
- /** Called each time a property is evaluated */
- def onPropEval(name: String, threadIdx: Int, succeeded: Int,
- discarded: Int): Unit = ()
-
- /** Called whenever a property has finished testing */
- def onTestResult(name: String, result: Result): Unit = ()
-
- def chain(testCallback: TestCallback) = new TestCallback {
- override def onPropEval(name: String, threadIdx: Int,
- succeeded: Int, discarded: Int
- ): Unit = {
- self.onPropEval(name,threadIdx,succeeded,discarded)
- testCallback.onPropEval(name,threadIdx,succeeded,discarded)
- }
-
- override def onTestResult(name: String, result: Result): Unit = {
- self.onTestResult(name,result)
- testCallback.onTestResult(name,result)
- }
- }
- }
-
- private def assertParams(prms: Parameters) = {
- import prms._
- if(
- minSuccessfulTests <= 0 ||
- maxDiscardRatio <= 0 ||
- minSize < 0 ||
- maxSize < minSize ||
- workers <= 0
- ) throw new IllegalArgumentException("Invalid test parameters")
- }
-
- private def secure[T](x: => T): Either[T,Throwable] =
- try { Left(x) } catch { case e: Throwable => Right(e) }
-
- def parseParams(args: Array[String]): Option[Parameters] = {
- var params = Parameters.default
- args.grouped(2).filter(_.size > 1).map(a => (a(0), a(1))).foreach {
- case ("-workers" | "-w", n) => params = params.withWorkers(n.toInt)
- case ("-minSize" | "-n", n) => params = params.withMinSize(n.toInt)
- case ("-maxSize" | "-x", n) => params = params.withMaxSize(n.toInt)
- case ("-verbosity" | "-v", n) => params = params.withTestCallback(ConsoleReporter(n.toInt))
- case ("-maxDiscardRatio" | "-r", n) => params = params.withMaxDiscardRatio(n.toFloat)
- case ("-minSuccessfulTests" | "-s", n) => params = params.withMinSuccessfulTests(n.toInt)
- case _ =>
- }
- Some(params)
- }
-
- /** Tests a property with parameters that are calculated by applying
- * the provided function to [[Test.Parameters.default]].
- * Example use:
- *
- * {{{
- * Test.check(p) { _.
- * withMinSuccessfulTests(80000).
- * withWorkers(4)
- * }
- * }}}
- */
- def check(p: Prop)(f: Parameters => Parameters): Result =
- check(f(Parameters.default), p)
-
- /** Tests a property with the given testing parameters, and returns
- * the test results. */
- def check(params: Parameters, p: Prop): Result = {
- import params._
- import concurrent._
-
- assertParams(params)
- if(workers > 1) {
- assert(!p.isInstanceOf[Commands], "Commands cannot be checked multi-threaded")
- }
-
- val iterations = math.ceil(minSuccessfulTests / (workers: Double))
- val sizeStep = (maxSize-minSize) / (iterations*workers)
- var stop = false
- val genPrms = new Gen.Parameters.Default { override val rng = params.rng }
- val tp = java.util.concurrent.Executors.newFixedThreadPool(workers)
- implicit val ec = ExecutionContext.fromExecutor(tp)
-
- def workerFun(workerIdx: Int): Result = {
- var n = 0 // passed tests
- var d = 0 // discarded tests
- var res: Result = null
- var fm = FreqMap.empty[Set[Any]]
- while(!stop && res == null && n < iterations) {
- val size = (minSize: Double) + (sizeStep * (workerIdx + (workers*(n+d))))
- val propRes = p(genPrms.withSize(size.round.toInt))
- fm = if(propRes.collected.isEmpty) fm else fm + propRes.collected
- propRes.status match {
- case Prop.Undecided =>
- d += 1
- testCallback.onPropEval("", workerIdx, n, d)
- // The below condition is kind of hacky. We have to have
- // some margin, otherwise workers might stop testing too
- // early because they have been exhausted, but the overall
- // test has not.
- if (n+d > minSuccessfulTests && 1+workers*maxDiscardRatio*n < d)
- res = Result(Exhausted, n, d, fm)
- case Prop.True =>
- n += 1
- testCallback.onPropEval("", workerIdx, n, d)
- case Prop.Proof =>
- n += 1
- res = Result(Proved(propRes.args), n, d, fm)
- stop = true
- case Prop.False =>
- res = Result(Failed(propRes.args,propRes.labels), n, d, fm)
- stop = true
- case Prop.Exception(e) =>
- res = Result(PropException(propRes.args,e,propRes.labels), n, d, fm)
- stop = true
- }
- }
- if (res == null) {
- if (maxDiscardRatio*n > d) Result(Passed, n, d, fm)
- else Result(Exhausted, n, d, fm)
- } else res
- }
-
- def mergeResults(r1: Result, r2: Result): Result = {
- val Result(st1, s1, d1, fm1, _) = r1
- val Result(st2, s2, d2, fm2, _) = r2
- if (st1 != Passed && st1 != Exhausted)
- Result(st1, s1+s2, d1+d2, fm1++fm2, 0)
- else if (st2 != Passed && st2 != Exhausted)
- Result(st2, s1+s2, d1+d2, fm1++fm2, 0)
- else {
- if (s1+s2 >= minSuccessfulTests && maxDiscardRatio*(s1+s2) >= (d1+d2))
- Result(Passed, s1+s2, d1+d2, fm1++fm2, 0)
- else
- Result(Exhausted, s1+s2, d1+d2, fm1++fm2, 0)
- }
- }
-
- try {
- val start = System.currentTimeMillis
- val r =
- if(workers < 2) workerFun(0)
- else {
- val fs = List.range(0,workers) map (idx => Future {
- params.customClassLoader.map(
- Thread.currentThread.setContextClassLoader(_)
- )
- blocking { workerFun(idx) }
- })
- val zeroRes = Result(Passed,0,0,FreqMap.empty[Set[Any]],0)
- val res = Future.fold(fs)(zeroRes)(mergeResults)
- Await.result(res, concurrent.duration.Duration.Inf)
- }
- val timedRes = r.copy(time = System.currentTimeMillis-start)
- params.testCallback.onTestResult("", timedRes)
- timedRes
- } finally {
- stop = true
- tp.shutdown()
- }
- }
-
- /** Check a set of properties. */
- def checkProperties(prms: Parameters, ps: Properties): Seq[(String,Result)] =
- ps.properties.map { case (name,p) =>
- val testCallback = new TestCallback {
- override def onPropEval(n: String, t: Int, s: Int, d: Int) =
- prms.testCallback.onPropEval(name,t,s,d)
- override def onTestResult(n: String, r: Result) =
- prms.testCallback.onTestResult(name,r)
- }
- val res = check(prms.withTestCallback(testCallback), p)
- (name,res)
- }
-}
diff --git a/src/partest-extras/scala/org/scalacheck/util/Buildable.scala b/src/partest-extras/scala/org/scalacheck/util/Buildable.scala
deleted file mode 100644
index 6a275b05c2..0000000000
--- a/src/partest-extras/scala/org/scalacheck/util/Buildable.scala
+++ /dev/null
@@ -1,77 +0,0 @@
-/*-------------------------------------------------------------------------*\
-** ScalaCheck **
-** Copyright (c) 2007-2014 Rickard Nilsson. All rights reserved. **
-** http://www.scalacheck.org **
-** **
-** This software is released under the terms of the Revised BSD License. **
-** There is NO WARRANTY. See the file LICENSE for the full text. **
-\*------------------------------------------------------------------------ */
-
-package org.scalacheck.util
-
-import collection._
-
-trait Buildable[T,C[_]] {
- def builder: mutable.Builder[T,C[T]]
- def fromIterable(it: Traversable[T]): C[T] = {
- val b = builder
- b ++= it
- b.result()
- }
-}
-
-trait Buildable2[T,U,C[_,_]] {
- def builder: mutable.Builder[(T,U),C[T,U]]
- def fromIterable(it: Traversable[(T,U)]): C[T,U] = {
- val b = builder
- b ++= it
- b.result()
- }
-}
-
-object Buildable {
- import generic.CanBuildFrom
-
- implicit def buildableCanBuildFrom[T, C[_]](implicit c: CanBuildFrom[C[_], T, C[T]]) =
- new Buildable[T, C] {
- def builder = c.apply
- }
-
- import java.util.ArrayList
- implicit def buildableArrayList[T] = new Buildable[T,ArrayList] {
- def builder = new mutable.Builder[T,ArrayList[T]] {
- val al = new ArrayList[T]
- def +=(x: T) = {
- al.add(x)
- this
- }
- def clear() = al.clear()
- def result() = al
- }
- }
-
-}
-
-object Buildable2 {
-
- implicit def buildableMutableMap[T,U] = new Buildable2[T,U,mutable.Map] {
- def builder = mutable.Map.newBuilder
- }
-
- implicit def buildableImmutableMap[T,U] = new Buildable2[T,U,immutable.Map] {
- def builder = immutable.Map.newBuilder
- }
-
- implicit def buildableMap[T,U] = new Buildable2[T,U,Map] {
- def builder = Map.newBuilder
- }
-
- implicit def buildableImmutableSortedMap[T: Ordering, U] = new Buildable2[T,U,immutable.SortedMap] {
- def builder = immutable.SortedMap.newBuilder
- }
-
- implicit def buildableSortedMap[T: Ordering, U] = new Buildable2[T,U,SortedMap] {
- def builder = SortedMap.newBuilder
- }
-
-}
diff --git a/src/partest-extras/scala/org/scalacheck/util/CmdLineParser.scala b/src/partest-extras/scala/org/scalacheck/util/CmdLineParser.scala
deleted file mode 100644
index 45b6ac6948..0000000000
--- a/src/partest-extras/scala/org/scalacheck/util/CmdLineParser.scala
+++ /dev/null
@@ -1,41 +0,0 @@
-/*-------------------------------------------------------------------------*\
-** ScalaCheck **
-** Copyright (c) 2007-2014 Rickard Nilsson. All rights reserved. **
-** http://www.scalacheck.org **
-** **
-** This software is released under the terms of the Revised BSD License. **
-** There is NO WARRANTY. See the file LICENSE for the full text. **
-\*------------------------------------------------------------------------ */
-
-package org.scalacheck.util
-
-import scala.collection.Set
-import org.scalacheck.Test
-
-private[scalacheck] trait CmdLineParser {
-
- type Elem = String
-
- trait Opt[+T] {
- val default: T
- val names: Set[String]
- val help: String
- }
- trait Flag extends Opt[Unit]
- trait IntOpt extends Opt[Int]
- trait FloatOpt extends Opt[Float]
- trait StrOpt extends Opt[String]
-
- class OptMap {
- private val opts = new collection.mutable.HashMap[Opt[_], Any]
- def apply(flag: Flag): Boolean = opts.contains(flag)
- def apply[T](opt: Opt[T]): T = opts.get(opt) match {
- case None => opt.default
- case Some(v) => v.asInstanceOf[T]
- }
- def update[T](opt: Opt[T], optVal: T) = opts.update(opt, optVal)
- }
-
- val opts: Set[Opt[_]]
-
-}
diff --git a/src/partest-extras/scala/org/scalacheck/util/ConsoleReporter.scala b/src/partest-extras/scala/org/scalacheck/util/ConsoleReporter.scala
deleted file mode 100644
index 89858dfb64..0000000000
--- a/src/partest-extras/scala/org/scalacheck/util/ConsoleReporter.scala
+++ /dev/null
@@ -1,44 +0,0 @@
-/*-------------------------------------------------------------------------*\
-** ScalaCheck **
-** Copyright (c) 2007-2014 Rickard Nilsson. All rights reserved. **
-** http://www.scalacheck.org **
-** **
-** This software is released under the terms of the Revised BSD License. **
-** There is NO WARRANTY. See the file LICENSE for the full text. **
-\*------------------------------------------------------------------------ */
-
-package org.scalacheck.util
-
-import Pretty.{Params, pretty, format}
-import org.scalacheck.{Prop, Properties, Test}
-
-/** A [[org.scalacheck.Test.TestCallback]] implementation that prints
- * test results directly to the console. This is the callback used
- * by ScalaCheck's command line test runner, and when you run [[org.scalacheck.Prop!.check:Unit*]]
- */
-class ConsoleReporter(val verbosity: Int) extends Test.TestCallback {
-
- private val prettyPrms = Params(verbosity)
-
- override def onTestResult(name: String, res: Test.Result) = {
- if(verbosity > 0) {
- if(name == "") {
- val s = (if(res.passed) "+ " else "! ") + pretty(res, prettyPrms)
- printf("\r%s\n", format(s, "", "", 75))
- } else {
- val s = (if(res.passed) "+ " else "! ") + name + ": " +
- pretty(res, prettyPrms)
- printf("\r%s\n", format(s, "", "", 75))
- }
- }
- }
-
-}
-
-object ConsoleReporter {
-
- /** Factory method, creates a ConsoleReporter with the
- * the given verbosity */
- def apply(verbosity: Int = 0) = new ConsoleReporter(verbosity)
-
-}
diff --git a/src/partest-extras/scala/org/scalacheck/util/FreqMap.scala b/src/partest-extras/scala/org/scalacheck/util/FreqMap.scala
deleted file mode 100644
index 2a9f36f1e5..0000000000
--- a/src/partest-extras/scala/org/scalacheck/util/FreqMap.scala
+++ /dev/null
@@ -1,65 +0,0 @@
-/*-------------------------------------------------------------------------*\
-** ScalaCheck **
-** Copyright (c) 2007-2014 Rickard Nilsson. All rights reserved. **
-** http://www.scalacheck.org **
-** **
-** This software is released under the terms of the Revised BSD License. **
-** There is NO WARRANTY. See the file LICENSE for the full text. **
-\*------------------------------------------------------------------------ */
-
-package org.scalacheck.util
-
-trait FreqMap[T] {
- protected val underlying: scala.collection.immutable.Map[T,Int]
- val total: Int
-
- def +(t: T) = new FreqMap[T] {
- private val n = FreqMap.this.underlying.get(t) match {
- case None => 1
- case Some(n) => n+1
- }
- val underlying = FreqMap.this.underlying + (t -> n)
- val total = FreqMap.this.total + 1
- }
-
- def -(t: T) = new FreqMap[T] {
- val underlying = FreqMap.this.underlying.get(t) match {
- case None => FreqMap.this.underlying
- case Some(n) => FreqMap.this.underlying + (t -> (n-1))
- }
- val total = FreqMap.this.total + 1
- }
-
- def ++(fm: FreqMap[T]) = new FreqMap[T] {
- private val keys = FreqMap.this.underlying.keySet ++ fm.underlying.keySet
- private val mappings = keys.toStream.map { x =>
- (x, fm.getCount(x).getOrElse(0) + FreqMap.this.getCount(x).getOrElse(0))
- }
- val underlying = scala.collection.immutable.Map(mappings: _*)
- val total = FreqMap.this.total + fm.total
- }
-
- def --(fm: FreqMap[T]) = new FreqMap[T] {
- val underlying = FreqMap.this.underlying transform {
- case (x,n) => n - fm.getCount(x).getOrElse(0)
- }
- lazy val total = (0 /: underlying.valuesIterator) (_ + _)
- }
-
- def getCount(t: T) = underlying.get(t)
-
- def getCounts: List[(T,Int)] = underlying.toList.sortBy(-_._2)
-
- def getRatio(t: T) = for(c <- getCount(t)) yield (c: Float)/total
-
- def getRatios = for((t,c) <- getCounts) yield (t, (c: Float)/total)
-
- override def toString = underlying.toString
-}
-
-object FreqMap {
- def empty[T] = new FreqMap[T] {
- val underlying = scala.collection.immutable.Map.empty[T,Int]
- val total = 0
- }
-}
diff --git a/src/partest-extras/scala/org/scalacheck/util/Pretty.scala b/src/partest-extras/scala/org/scalacheck/util/Pretty.scala
deleted file mode 100644
index 13a1b44b51..0000000000
--- a/src/partest-extras/scala/org/scalacheck/util/Pretty.scala
+++ /dev/null
@@ -1,129 +0,0 @@
-/*-------------------------------------------------------------------------*\
-** ScalaCheck **
-** Copyright (c) 2007-2014 Rickard Nilsson. All rights reserved. **
-** http://www.scalacheck.org **
-** **
-** This software is released under the terms of the Revised BSD License. **
-** There is NO WARRANTY. See the file LICENSE for the full text. **
-\*------------------------------------------------------------------------ */
-
-package org.scalacheck.util
-
-import org.scalacheck.Prop.Arg
-import org.scalacheck.Test
-
-import math.round
-
-
-sealed trait Pretty {
- def apply(prms: Pretty.Params): String
-
- def map(f: String => String) = Pretty(prms => f(Pretty.this(prms)))
-
- def flatMap(f: String => Pretty) = Pretty(prms => f(Pretty.this(prms))(prms))
-}
-
-object Pretty {
-
- case class Params(verbosity: Int)
-
- val defaultParams = Params(0)
-
- def apply(f: Params => String) = new Pretty { def apply(p: Params) = f(p) }
-
- def pretty[T <% Pretty](t: T, prms: Params): String = t(prms)
-
- def pretty[T <% Pretty](t: T): String = t(defaultParams)
-
- implicit def strBreak(s1: String) = new {
- def /(s2: String) = if(s2 == "") s1 else s1+"\n"+s2
- }
-
- def pad(s: String, c: Char, length: Int) =
- if(s.length >= length) s
- else s + List.fill(length-s.length)(c).mkString
-
- def break(s: String, lead: String, length: Int): String =
- if(s.length <= length) s
- else s.substring(0, length) / break(lead+s.substring(length), lead, length)
-
- def format(s: String, lead: String, trail: String, width: Int) =
- s.lines.map(l => break(lead+l+trail, " ", width)).mkString("\n")
-
- implicit def prettyAny(t: Any) = Pretty { p => t.toString }
-
- implicit def prettyString(t: String) = Pretty { p => "\""++t++"\"" }
-
- implicit def prettyList(l: List[Any]) = Pretty { p =>
- l.map("\""+_+"\"").mkString("List(", ", ", ")")
- }
-
- implicit def prettyThrowable(e: Throwable) = Pretty { prms =>
- val strs = e.getStackTrace.map { st =>
- import st._
- getClassName+"."+getMethodName + "("+getFileName+":"+getLineNumber+")"
- }
-
- val strs2 =
- if(prms.verbosity <= 0) Array[String]()
- else if(prms.verbosity <= 1) strs.take(5)
- else strs
-
- e.getClass.getName + ": " + e.getMessage / strs2.mkString("\n")
- }
-
- def prettyArgs(args: Seq[Arg[Any]]): Pretty = Pretty { prms =>
- if(args.isEmpty) "" else {
- for((a,i) <- args.zipWithIndex) yield {
- val l = "> "+(if(a.label == "") "ARG_"+i else a.label)
- val s =
- if(a.shrinks == 0) ""
- else "\n"+l+"_ORIGINAL: "+a.prettyOrigArg(prms)
- l+": "+a.prettyArg(prms)+""+s
- }
- }.mkString("\n")
- }
-
- implicit def prettyFreqMap(fm: FreqMap[Set[Any]]) = Pretty { prms =>
- if(fm.total == 0) ""
- else {
- "> Collected test data: " / {
- for {
- (xs,r) <- fm.getRatios
- ys = xs - (())
- if !ys.isEmpty
- } yield round(r*100)+"% " + ys.mkString(", ")
- }.mkString("\n")
- }
- }
-
- implicit def prettyTestRes(res: Test.Result) = Pretty { prms =>
- def labels(ls: collection.immutable.Set[String]) =
- if(ls.isEmpty) ""
- else "> Labels of failing property: " / ls.mkString("\n")
- val s = res.status match {
- case Test.Proved(args) => "OK, proved property."/prettyArgs(args)(prms)
- case Test.Passed => "OK, passed "+res.succeeded+" tests."
- case Test.Failed(args, l) =>
- "Falsified after "+res.succeeded+" passed tests."/labels(l)/prettyArgs(args)(prms)
- case Test.Exhausted =>
- "Gave up after only "+res.succeeded+" passed tests. " +
- res.discarded+" tests were discarded."
- case Test.PropException(args,e,l) =>
- "Exception raised on property evaluation."/labels(l)/prettyArgs(args)(prms)/
- "> Exception: "+pretty(e,prms)
- case Test.GenException(e) =>
- "Exception raised on argument generation."/
- "> Exception: "+pretty(e,prms)
- }
- val t = if(prms.verbosity <= 1) "" else "Elapsed time: "+prettyTime(res.time)
- s/t/pretty(res.freqMap,prms)
- }
-
- def prettyTime(millis: Long): String = {
- val min = millis/(60*1000)
- val sec = (millis-(60*1000*min)) / 1000d
- if(min <= 0) "%.3f sec ".format(sec)
- else "%d min %.3f sec ".format(min, sec)
- }
-}
diff --git a/src/partest-extras/scala/tools/partest/JavapTest.scala b/src/partest-extras/scala/tools/partest/JavapTest.scala
index 27017b1585..cfca49b3a7 100644
--- a/src/partest-extras/scala/tools/partest/JavapTest.scala
+++ b/src/partest-extras/scala/tools/partest/JavapTest.scala
@@ -8,7 +8,7 @@ import java.lang.System.{out => sysout}
*/
abstract class JavapTest extends ReplTest {
- /** Your Assertion Here, whatever you want to bejahen.
+ /** Your Assertion Here, whatever you want to affirm.
* Assertions must be satisfied by all flavors of javap
* and should not be fragile with respect to compiler output.
*/
diff --git a/src/partest-extras/scala/tools/partest/ReplTest.scala b/src/partest-extras/scala/tools/partest/ReplTest.scala
index 608ac73b61..9c95a718ca 100644
--- a/src/partest-extras/scala/tools/partest/ReplTest.scala
+++ b/src/partest-extras/scala/tools/partest/ReplTest.scala
@@ -74,7 +74,7 @@ abstract class SessionTest extends ReplTest {
/** Code is the command list culled from the session (or the expected session output).
* Would be nicer if code were lazy lines so you could generate arbitrarily long text.
- * Retain user input: prompt lines and continuations, without the prefix; or pasted text plus ctl-D.
+ * Retain user input: prompt lines and continuations, without the prefix; or pasted text plus ctrl-D.
*/
import SessionTest._
lazy val pasted = input(prompt)
diff --git a/src/reflect/scala/reflect/api/Internals.scala b/src/reflect/scala/reflect/api/Internals.scala
index 2c8f84be0b..c2339700de 100644
--- a/src/reflect/scala/reflect/api/Internals.scala
+++ b/src/reflect/scala/reflect/api/Internals.scala
@@ -1012,7 +1012,7 @@ trait Internals { self: Universe =>
*/
def origin: String
- /** The valus this symbol refers to
+ /** The value this symbol refers to
*
* @group FreeTerm
*/
diff --git a/src/reflect/scala/reflect/api/StandardDefinitions.scala b/src/reflect/scala/reflect/api/StandardDefinitions.scala
index bf9cf5e334..50954f5eda 100644
--- a/src/reflect/scala/reflect/api/StandardDefinitions.scala
+++ b/src/reflect/scala/reflect/api/StandardDefinitions.scala
@@ -214,7 +214,7 @@ trait StandardDefinitions {
/** The module symbol of module `scala.Some`. */
def SomeModule: ModuleSymbol
- /** Function-like api that lets you acess symbol
+ /** Function-like api that lets you access symbol
* of the definition with given arity and also look
* through all known symbols via `seq`.
*/
diff --git a/src/reflect/scala/reflect/api/Types.scala b/src/reflect/scala/reflect/api/Types.scala
index ff61ae1901..9e05a7f979 100644
--- a/src/reflect/scala/reflect/api/Types.scala
+++ b/src/reflect/scala/reflect/api/Types.scala
@@ -734,7 +734,7 @@ trait Types {
*/
val MethodType: MethodTypeExtractor
- /** An extractor class to create and pattern match with syntax `MethodType(params, respte)`
+ /** An extractor class to create and pattern match with syntax `MethodType(params, restpe)`
* Here, `params` is a potentially empty list of parameter symbols of the method,
* and `restpe` is the result type of the method. If the method is curried, `restpe` would
* be another `MethodType`.
diff --git a/src/reflect/scala/reflect/internal/AnnotationInfos.scala b/src/reflect/scala/reflect/internal/AnnotationInfos.scala
index cfde164754..a6e584424b 100644
--- a/src/reflect/scala/reflect/internal/AnnotationInfos.scala
+++ b/src/reflect/scala/reflect/internal/AnnotationInfos.scala
@@ -412,7 +412,7 @@ trait AnnotationInfos extends api.Annotations { self: SymbolTable =>
/** Extracts the type of the thrown exception from an AnnotationInfo.
*
* Supports both “old-style” `@throws(classOf[Exception])`
- * as well as “new-stye” `@throws[Exception]("cause")` annotations.
+ * as well as “new-style” `@throws[Exception]("cause")` annotations.
*/
object ThrownException {
def unapply(ann: AnnotationInfo): Option[Type] = {
diff --git a/src/reflect/scala/reflect/internal/BaseTypeSeqs.scala b/src/reflect/scala/reflect/internal/BaseTypeSeqs.scala
index 78f9721713..0ef52213e5 100644
--- a/src/reflect/scala/reflect/internal/BaseTypeSeqs.scala
+++ b/src/reflect/scala/reflect/internal/BaseTypeSeqs.scala
@@ -100,7 +100,7 @@ trait BaseTypeSeqs {
def copy(head: Type, offset: Int): BaseTypeSeq = {
val arr = new Array[Type](elems.length + offset)
- scala.compat.Platform.arraycopy(elems, 0, arr, offset, elems.length)
+ java.lang.System.arraycopy(elems, 0, arr, offset, elems.length)
arr(0) = head
newBaseTypeSeq(parents, arr)
}
diff --git a/src/reflect/scala/reflect/internal/Constants.scala b/src/reflect/scala/reflect/internal/Constants.scala
index 7b47798ff7..cd2debfaf4 100644
--- a/src/reflect/scala/reflect/internal/Constants.scala
+++ b/src/reflect/scala/reflect/internal/Constants.scala
@@ -87,8 +87,8 @@ trait Constants extends api.Constants {
}
def isNaN = value match {
- case f: Float => f.isNaN
- case d: Double => d.isNaN
+ case f: Float => java.lang.Float.isNaN(f)
+ case d: Double => java.lang.Double.isNaN(d)
case _ => false
}
diff --git a/src/reflect/scala/reflect/internal/Names.scala b/src/reflect/scala/reflect/internal/Names.scala
index 97f51149ba..9d39ef8b42 100644
--- a/src/reflect/scala/reflect/internal/Names.scala
+++ b/src/reflect/scala/reflect/internal/Names.scala
@@ -68,7 +68,7 @@ trait Names extends api.Names {
while (i < len) {
if (nc + i == chrs.length) {
val newchrs = new Array[Char](chrs.length * 2)
- scala.compat.Platform.arraycopy(chrs, 0, newchrs, 0, chrs.length)
+ java.lang.System.arraycopy(chrs, 0, newchrs, 0, chrs.length)
chrs = newchrs
}
chrs(nc + i) = cs(offset + i)
@@ -220,7 +220,7 @@ trait Names extends api.Names {
/** Copy bytes of this name to buffer cs, starting at position `offset`. */
final def copyChars(cs: Array[Char], offset: Int) =
- scala.compat.Platform.arraycopy(chrs, index, cs, offset, len)
+ java.lang.System.arraycopy(chrs, index, cs, offset, len)
/** @return the ascii representation of this name */
final def toChars: Array[Char] = { // used by ide
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala
index 8d77e334db..56b6dc078d 100644
--- a/src/reflect/scala/reflect/internal/Symbols.scala
+++ b/src/reflect/scala/reflect/internal/Symbols.scala
@@ -1932,7 +1932,7 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
result
}
-// ------ cloneing -------------------------------------------------------------------
+// ------ cloning -------------------------------------------------------------------
/** A clone of this symbol. */
final def cloneSymbol: TypeOfClonedSymbol =
diff --git a/src/reflect/scala/reflect/internal/TreeGen.scala b/src/reflect/scala/reflect/internal/TreeGen.scala
index c5038fd1bb..4fecaf70df 100644
--- a/src/reflect/scala/reflect/internal/TreeGen.scala
+++ b/src/reflect/scala/reflect/internal/TreeGen.scala
@@ -122,7 +122,7 @@ abstract class TreeGen {
// val selType = testedBinder.info
//
// // See the test for SI-7214 for motivation for dealias. Later `treeCondStrategy#outerTest`
- // // generates an outer test based on `patType.prefix` with automatically dealises.
+ // // generates an outer test based on `patType.prefix` with automatically dealiases.
// // Prefixes can have all kinds of shapes SI-9110
// val patPre = expectedTp.dealiasWiden.prefix
// val selPre = selType.dealiasWiden.prefix
diff --git a/src/reflect/scala/reflect/internal/tpe/FindMembers.scala b/src/reflect/scala/reflect/internal/tpe/FindMembers.scala
index 83a5d23e7c..6ba48cb44d 100644
--- a/src/reflect/scala/reflect/internal/tpe/FindMembers.scala
+++ b/src/reflect/scala/reflect/internal/tpe/FindMembers.scala
@@ -125,9 +125,9 @@ trait FindMembers {
/* Add this member to the final result, unless an already-found member matches it. */
protected def addMemberIfNew(sym: Symbol): Unit
- // Is `sym` a potentially member of `baseClass`?
+ // Is `sym` potentially a member of `baseClass`?
//
- // Q. When does a potential member fail to be a an actual member?
+ // Q. When does a potential member fail to be an actual member?
// A. if it is subsumed by an member in a subclass.
private def isPotentialMember(sym: Symbol, flags: Long, owner: Symbol,
seenFirstNonRefinementClass: Boolean, refinementParents: List[Symbol]): Boolean = {
diff --git a/src/reflect/scala/reflect/internal/util/SourceFile.scala b/src/reflect/scala/reflect/internal/util/SourceFile.scala
index a2642628a4..64b6972298 100644
--- a/src/reflect/scala/reflect/internal/util/SourceFile.scala
+++ b/src/reflect/scala/reflect/internal/util/SourceFile.scala
@@ -154,18 +154,23 @@ class BatchSourceFile(val file : AbstractFile, content0: Array[Char]) extends So
case _ => false
}
- def calculateLineIndices(cs: Array[Char]) = {
- val buf = new ArrayBuffer[Int]
- buf += 0
- for (i <- 0 until cs.length) if (isAtEndOfLine(i)) buf += i + 1
- buf += cs.length // sentinel, so that findLine below works smoother
- buf.toArray
+ private lazy val lineIndices: Array[Int] = {
+ def calculateLineIndices(cs: Array[Char]) = {
+ val buf = new ArrayBuffer[Int]
+ buf += 0
+ for (i <- 0 until cs.length) if (isAtEndOfLine(i)) buf += i + 1
+ buf += cs.length // sentinel, so that findLine below works smoother
+ buf.toArray
+ }
+ calculateLineIndices(content)
}
- private lazy val lineIndices: Array[Int] = calculateLineIndices(content)
- def lineToOffset(index : Int): Int = lineIndices(index)
+ def lineToOffset(index: Int): Int = {
+ val offset = lineIndices(index)
+ if (offset < length) offset else throw new IndexOutOfBoundsException(index.toString)
+ }
- private var lastLine = 0
+ private[this] var lastLine = 0
/** Convert offset to line in this source file.
* Lines are numbered from 0.
diff --git a/src/reflect/scala/reflect/runtime/JavaUniverse.scala b/src/reflect/scala/reflect/runtime/JavaUniverse.scala
index a87d1d23cc..a9d415277b 100644
--- a/src/reflect/scala/reflect/runtime/JavaUniverse.scala
+++ b/src/reflect/scala/reflect/runtime/JavaUniverse.scala
@@ -91,7 +91,7 @@ class JavaUniverse extends InternalSymbolTable with JavaUniverseForce with Refle
// Main challenges that runtime reflection presents wrt initialization are:
// 1) Extravagant completion scheme that enters package members on-demand rather than a result of scanning a directory with class files.
// (That's a direct consequence of the fact that in general case we can't enumerate all classes in a classloader.
- // As Paul rightfully mentioned, we could specialcase classloaders that point to filesystems, but that is left for future work).
+ // As Paul rightfully mentioned, we could special case classloaders that point to filesystems, but that is left for future work).
// 2) Presence of synthetic symbols that aren't loaded by normal means (from classfiles) but are synthesized on-the-fly,
// and the necessity to propagate these synthetic symbols from rootMirror to other mirrors,
// complicated by the fact that such symbols depend on normal symbols (e.g. AnyRef depends on Object).
diff --git a/src/repl/scala/tools/nsc/interpreter/InteractiveReader.scala b/src/repl/scala/tools/nsc/interpreter/InteractiveReader.scala
index 1f81d9965c..88a011e996 100644
--- a/src/repl/scala/tools/nsc/interpreter/InteractiveReader.scala
+++ b/src/repl/scala/tools/nsc/interpreter/InteractiveReader.scala
@@ -117,7 +117,7 @@ class SplashLoop(reader: InteractiveReader, prompt: String) extends Runnable {
thread = null
}
- /** Block for the result line, or null on ctl-D. */
+ /** Block for the result line, or null on ctrl-D. */
def line: String = result.take getOrElse null
}
object SplashLoop {
diff --git a/src/repl/scala/tools/nsc/interpreter/Phased.scala b/src/repl/scala/tools/nsc/interpreter/Phased.scala
index dd327a13d4..da77be7a79 100644
--- a/src/repl/scala/tools/nsc/interpreter/Phased.scala
+++ b/src/repl/scala/tools/nsc/interpreter/Phased.scala
@@ -9,7 +9,7 @@ package interpreter
import scala.language.implicitConversions
/** Mix this into an object and use it as a phasing
- * swiss army knife.
+ * Swiss Army knife.
*/
trait Phased {
val global: Global
diff --git a/src/scaladoc/scala/tools/nsc/doc/ScaladocAnalyzer.scala b/src/scaladoc/scala/tools/nsc/doc/ScaladocAnalyzer.scala
index d8ec7b18fd..4e99434051 100644
--- a/src/scaladoc/scala/tools/nsc/doc/ScaladocAnalyzer.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/ScaladocAnalyzer.scala
@@ -101,12 +101,26 @@ trait ScaladocAnalyzer extends Analyzer {
abstract class ScaladocSyntaxAnalyzer[G <: Global](val global: G) extends SyntaxAnalyzer {
import global._
- class ScaladocUnitScanner(unit0: CompilationUnit, patches0: List[BracePatch]) extends UnitScanner(unit0, patches0) {
-
- private var docBuffer: StringBuilder = null // buffer for comments (non-null while scanning)
- private var inDocComment = false // if buffer contains double-star doc comment
- private var lastDoc: DocComment = null // last comment if it was double-star doc
+ trait ScaladocScanner extends DocScanner {
+ // When `docBuffer == null`, we're not in a doc comment.
+ private var docBuffer: StringBuilder = null
+
+ override protected def beginDocComment(prefix: String): Unit =
+ if (docBuffer == null) docBuffer = new StringBuilder(prefix)
+
+ protected def ch: Char
+ override protected def processCommentChar(): Unit =
+ if (docBuffer != null) docBuffer append ch
+
+ protected def docPosition: Position
+ override protected def finishDocComment(): Unit =
+ if (docBuffer != null) {
+ registerDocComment(docBuffer.toString, docPosition)
+ docBuffer = null
+ }
+ }
+ class ScaladocUnitScanner(unit0: CompilationUnit, patches0: List[BracePatch]) extends UnitScanner(unit0, patches0) with ScaladocScanner {
private object unmooredParser extends { // minimalist comment parser
val global: Global = ScaladocSyntaxAnalyzer.this.global
}
@@ -148,40 +162,7 @@ abstract class ScaladocSyntaxAnalyzer[G <: Global](val global: G) extends Syntax
reporter.warning(doc.pos, "discarding unmoored doc comment")
}
- override def flushDoc(): DocComment = (try lastDoc finally lastDoc = null)
-
- override protected def putCommentChar() {
- if (inDocComment)
- docBuffer append ch
-
- nextChar()
- }
- override def skipDocComment(): Unit = {
- inDocComment = true
- docBuffer = new StringBuilder("/**")
- super.skipDocComment()
- }
- override def skipBlockComment(): Unit = {
- inDocComment = false // ??? this means docBuffer won't receive contents of this comment???
- docBuffer = new StringBuilder("/*")
- super.skipBlockComment()
- }
- override def skipComment(): Boolean = {
- // emit a block comment; if it's double-star, make Doc at this pos
- def foundStarComment(start: Int, end: Int) = try {
- val str = docBuffer.toString
- val pos = Position.range(unit.source, start, start, end)
- if (inDocComment) {
- signalParsedDocComment(str, pos)
- lastDoc = DocComment(str, pos)
- }
- true
- } finally {
- docBuffer = null
- inDocComment = false
- }
- super.skipComment() && ((docBuffer eq null) || foundStarComment(offset, charOffset - 2))
- }
+ protected def docPosition: Position = Position.range(unit.source, offset, offset, charOffset - 2)
}
class ScaladocUnitParser(unit: CompilationUnit, patches: List[BracePatch]) extends UnitParser(unit, patches) {
override def newScanner() = new ScaladocUnitScanner(unit, patches)
@@ -214,52 +195,17 @@ abstract class ScaladocSyntaxAnalyzer[G <: Global](val global: G) extends Syntax
}
}
- class ScaladocJavaUnitScanner(unit: CompilationUnit) extends JavaUnitScanner(unit) {
-
- private var docBuffer: StringBuilder = _
- private var inDocComment = false
+ class ScaladocJavaUnitScanner(unit: CompilationUnit) extends JavaUnitScanner(unit) with ScaladocScanner {
private var docStart: Int = 0
- private var lastDoc: DocComment = null
-
- override def init() = {
- docBuffer = new StringBuilder
- super.init()
- }
-
- // get last doc comment
- def flushDoc(): DocComment = try lastDoc finally lastDoc = null
-
- override protected def putCommentChar(): Unit = {
- if (inDocComment) docBuffer append in.ch
- in.next
- }
- override protected def skipBlockComment(isDoc: Boolean): Unit = {
- // condition is true when comment is entered the first time,
- // i.e. immediately after "/*" and when current character is "*"
- if (!inDocComment && isDoc) {
- docBuffer append "/*"
- docStart = currentPos.start
- inDocComment = true
- }
- super.skipBlockComment(isDoc)
+ override protected def beginDocComment(prefix: String): Unit = {
+ super.beginDocComment(prefix)
+ docStart = currentPos.start
}
- override protected def skipComment(): Boolean = {
- val skipped = super.skipComment()
- if (skipped && inDocComment) {
- val raw = docBuffer.toString
- val position = Position.range(unit.source, docStart, docStart, in.cpos)
- lastDoc = DocComment(raw, position)
- signalParsedDocComment(raw, position)
- docBuffer.setLength(0) // clear buffer
- inDocComment = false
- true
- } else {
- skipped
- }
- }
+ protected def ch = in.ch
+ override protected def docPosition = Position.range(unit.source, docStart, docStart, in.cpos)
}
class ScaladocJavaUnitParser(unit: CompilationUnit) extends {
diff --git a/src/scaladoc/scala/tools/nsc/doc/base/MemberLookupBase.scala b/src/scaladoc/scala/tools/nsc/doc/base/MemberLookupBase.scala
index 9de6ec4ab9..613bbd9aec 100644
--- a/src/scaladoc/scala/tools/nsc/doc/base/MemberLookupBase.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/base/MemberLookupBase.scala
@@ -183,7 +183,7 @@ trait MemberLookupBase {
val member = query.substring(last_index, index).replaceAll("\\\\([#\\.])", "$1")
// we want to allow javadoc-style links [[#member]] -- which requires us to remove empty members from the first
- // elemnt in the list
+ // element in the list
if ((member != "") || (!members.isEmpty))
members ::= member
last_index = index + 1
diff --git a/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DotDiagramGenerator.scala b/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DotDiagramGenerator.scala
index 2deb669ea9..99af2f627f 100644
--- a/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DotDiagramGenerator.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DotDiagramGenerator.scala
@@ -211,7 +211,7 @@ class DotDiagramGenerator(settings: doc.Settings, dotRunner: DotRunner) extends
// escape HTML characters in node names
def escape(name: String) = name.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")
- // assemble node attribues in a map
+ // assemble node attributes in a map
val attr = scala.collection.mutable.Map[String, String]()
// link
diff --git a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/scheduler.js b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/scheduler.js
index 52fb1770ee..eb396bb5d3 100644
--- a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/scheduler.js
+++ b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/scheduler.js
@@ -65,7 +65,7 @@ function Scheduler() {
scheduler.queues[idx].push(new scheduler.work(fn, self, args));
if (scheduler.timeout == undefined) doWork();
} else {
- throw("queue for add is non existant");
+ throw("queue for add is non-existent");
}
}
@@ -86,7 +86,7 @@ function Scheduler() {
if (idx != -1)
return scheduler.queues[idx].length == 0;
else
- throw("queue for label '" + label + "' is non existant");
+ throw("queue for label '" + label + "' is non-existent");
}
this.scheduleLast = function(label, fn) {
diff --git a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.css b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.css
index f222749dd2..c120698e91 100644
--- a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.css
+++ b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.css
@@ -562,7 +562,7 @@ div#definition > h4#signature > span.modifier_kind > i.unfold-arrow,
font-weight: bold;
}
-/* Comments text formating */
+/* Comments text formatting */
.cmt {
color: #103a51;
diff --git a/src/scaladoc/scala/tools/nsc/doc/model/Entity.scala b/src/scaladoc/scala/tools/nsc/doc/model/Entity.scala
index 757f13f79a..e71383f7e7 100644
--- a/src/scaladoc/scala/tools/nsc/doc/model/Entity.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/model/Entity.scala
@@ -256,11 +256,11 @@ trait DocTemplateEntity extends MemberTemplateEntity {
* only if the `docsourceurl` setting has been set. */
def sourceUrl: Option[java.net.URL]
- /** All class, trait and object templates which are part of this template's linearization, in lineratization order.
+ /** All class, trait and object templates which are part of this template's linearization, in linearization order.
* This template's linearization contains all of its direct and indirect super-classes and super-traits. */
def linearizationTemplates: List[TemplateEntity]
- /** All instantiated types which are part of this template's linearization, in lineratization order.
+ /** All instantiated types which are part of this template's linearization, in linearization order.
* This template's linearization contains all of its direct and indirect super-types. */
def linearizationTypes: List[TypeEntity]
@@ -511,9 +511,9 @@ trait ImplicitConversion {
/** Shadowing captures the information that the member is shadowed by some other members
* There are two cases of implicitly added member shadowing:
- * 1) shadowing from a original class member (the class already has that member)
+ * 1) shadowing from an original class member (the class already has that member)
* in this case, it won't be possible to call the member directly, the type checker will fail attempting to adapt
- * the call arguments (or if they fit it will call the original class' method)
+ * the call arguments (or if they fit it will call the original class method)
* 2) shadowing from other possible implicit conversions ()
* this will result in an ambiguous implicit converion error
*/
diff --git a/src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala b/src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala
index fb9a5ce7eb..6e62ce0317 100644
--- a/src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala
@@ -886,8 +886,8 @@ class ModelFactory(val global: Global, val settings: doc.Settings) {
// units.filter should return only one element
(currentRun.units filter (_.source.file == aSym.sourceFile)).toList match {
case List(unit) =>
- // SI-4922 `sym == aSym` is insufficent if `aSym` is a clone of symbol
- // of the parameter in the tree, as can happen with type parametric methods.
+ // SI-4922 `sym == aSym` is insufficient if `aSym` is a clone of symbol
+ // of the parameter in the tree, as can happen with type parameterized methods.
def isCorrespondingParam(sym: Symbol) = (
sym != null &&
sym != NoSymbol &&
diff --git a/test/files/jvm/future-spec/FutureTests.scala b/test/files/jvm/future-spec/FutureTests.scala
index d0de2f5542..a1934efdd0 100644
--- a/test/files/jvm/future-spec/FutureTests.scala
+++ b/test/files/jvm/future-spec/FutureTests.scala
@@ -123,7 +123,7 @@ class FutureTests extends MinimalScalaTest {
assert(f.mapTo[String] eq f, "Future.mapTo must be the same instance as Future.mapTo")
assert(f.zip(f) eq f, "Future.zip must be the same instance as Future.zip")
assert(f.flatten eq f, "Future.flatten must be the same instance as Future.flatten")
- assert(f.failed eq f, "Future.failed must be the same instance as Future.failed")
+ assert(f.failed.value == Some(Success(e)), "Future.failed.failed must become successful") // SI-10034
ECNotUsed(ec => f.foreach(_ => fail("foreach should not have been called"))(ec))
ECNotUsed(ec => f.onSuccess({ case _ => fail("onSuccess should not have been called") })(ec))
diff --git a/test/files/jvm/serialization-new.check b/test/files/jvm/serialization-new.check
index 90da8a085d..da41ba4bdd 100644
--- a/test/files/jvm/serialization-new.check
+++ b/test/files/jvm/serialization-new.check
@@ -268,12 +268,12 @@ x = ParHashSet(1, 2, 3)
y = ParHashSet(1, 2, 3)
x equals y: true, y equals x: true
-x = ParRange(0, 1, 2, 3, 4)
-y = ParRange(0, 1, 2, 3, 4)
+x = ParRange 0 to 4
+y = ParRange 0 to 4
x equals y: true, y equals x: true
-x = ParRange(0, 1, 2, 3)
-y = ParRange(0, 1, 2, 3)
+x = ParRange 0 until 4
+y = ParRange 0 until 4
x equals y: true, y equals x: true
x = ParMap(5 -> 1, 10 -> 2)
diff --git a/test/files/jvm/serialization.check b/test/files/jvm/serialization.check
index 964c68e528..38017d829f 100644
--- a/test/files/jvm/serialization.check
+++ b/test/files/jvm/serialization.check
@@ -268,12 +268,12 @@ x = ParHashSet(1, 2, 3)
y = ParHashSet(1, 2, 3)
x equals y: true, y equals x: true
-x = ParRange(0, 1, 2, 3, 4)
-y = ParRange(0, 1, 2, 3, 4)
+x = ParRange 0 to 4
+y = ParRange 0 to 4
x equals y: true, y equals x: true
-x = ParRange(0, 1, 2, 3)
-y = ParRange(0, 1, 2, 3)
+x = ParRange 0 until 4
+y = ParRange 0 until 4
x equals y: true, y equals x: true
x = ParMap(5 -> 1, 10 -> 2)
diff --git a/test/files/neg/t9953.check b/test/files/neg/t9953.check
new file mode 100644
index 0000000000..f5dcbcacee
--- /dev/null
+++ b/test/files/neg/t9953.check
@@ -0,0 +1,6 @@
+t9953.scala:10: warning: Object and X are unrelated: they will never compare equal
+ def b = y == x // warn
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/test/files/neg/t9953.flags b/test/files/neg/t9953.flags
new file mode 100644
index 0000000000..85d8eb2ba2
--- /dev/null
+++ b/test/files/neg/t9953.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/test/files/neg/t9953.scala b/test/files/neg/t9953.scala
new file mode 100644
index 0000000000..faaee86d50
--- /dev/null
+++ b/test/files/neg/t9953.scala
@@ -0,0 +1,13 @@
+
+class X(val v: Int) extends AnyVal
+trait T extends Any
+object Y extends T
+
+class C {
+ val x = new X(42)
+ val y = new Object
+ val a: T = null
+ def b = y == x // warn
+ def c = y == a // no warn
+ def d = Y == a // no warn
+}
diff --git a/test/files/pos/t6734.scala b/test/files/pos/t6734.scala
new file mode 100644
index 0000000000..88932cd2cc
--- /dev/null
+++ b/test/files/pos/t6734.scala
@@ -0,0 +1,17 @@
+
+// desugars to package p { object `package` }
+// previously, synthetic p.C was incorrectly added to this tree
+// This only matters because synthetics are not hygienic
+package object p
+
+package p {
+ import scala.concurrent.Future
+ case class C private[p] (value: Future[Int]) // private to avoid rewriting C.apply to new C
+}
+
+package client {
+ trait X {
+ import scala.concurrent.Future
+ def f = p.C(Future(42)(null)) // ensure synthetics were generated, i.e., p.C.apply
+ }
+}
diff --git a/test/files/pos/t6978.flags b/test/files/pos/t6978.flags
new file mode 100644
index 0000000000..7949c2afa2
--- /dev/null
+++ b/test/files/pos/t6978.flags
@@ -0,0 +1 @@
+-Xlint -Xfatal-warnings
diff --git a/test/files/pos/t6978/J.java b/test/files/pos/t6978/J.java
new file mode 100644
index 0000000000..1b9029ce53
--- /dev/null
+++ b/test/files/pos/t6978/J.java
@@ -0,0 +1,5 @@
+
+public class J {
+ public int f() { return 42; }
+}
+
diff --git a/test/files/pos/t6978/S.scala b/test/files/pos/t6978/S.scala
new file mode 100644
index 0000000000..41897db5ac
--- /dev/null
+++ b/test/files/pos/t6978/S.scala
@@ -0,0 +1,7 @@
+
+trait X { def f: Int }
+
+object Test extends J with X with App {
+ println(f)
+}
+
diff --git a/test/files/run/t10032.check b/test/files/run/t10032.check
new file mode 100644
index 0000000000..565fe25848
--- /dev/null
+++ b/test/files/run/t10032.check
@@ -0,0 +1,82 @@
+t1
+ i1
+ a1
+t2
+ i1
+ a1
+ a2
+ a3
+t3
+ i1
+ a1
+ a3
+t3
+ e1
+ a1
+ i2
+ a2
+ a3
+t4
+ i1
+ i2
+t4
+ e1
+ i2
+t5
+ i1
+ a1
+ a3
+t5
+ e1
+ a1
+ i2
+ a3
+t6
+ i1
+ i2
+ i3
+t6
+ e1
+ i2
+ i3
+t7
+ i1
+ a1
+t7
+ e1
+ i2
+ a1
+t8
+ i1
+ i2
+ a1
+ a2
+t8
+ e1
+ i2
+ a1
+ a2
+t9
+ i1
+ i2
+ a1
+t9
+ e1
+ i2
+ a1
+t10
+ i1
+ i2
+ i3
+t10
+ e1
+ i2
+ i3
+t11
+ i1
+ i2
+ a1
+t11
+ e1
+ i2
+ a1
diff --git a/test/files/run/t10032.scala b/test/files/run/t10032.scala
new file mode 100644
index 0000000000..f7e8ef459f
--- /dev/null
+++ b/test/files/run/t10032.scala
@@ -0,0 +1,164 @@
+object Test extends App {
+ def a1(): Unit = println(" a1")
+ def a2(): Unit = println(" a2")
+ def a3(): Unit = println(" a3")
+
+ def i1: Int = { println(" i1"); 1 }
+ def i2: Int = { println(" i2"); 2 }
+ def i3: Int = { println(" i3"); 3 }
+
+ def e1: Int = { println(" e1"); throw new Exception() }
+
+ def t1: Int = {
+ println("t1")
+ try {
+ synchronized { return i1 }
+ } finally {
+ synchronized { a1() }
+ }
+ }
+
+ def t2: Int = {
+ println("t2")
+ try {
+ try { return i1 }
+ finally { a1() }
+ } finally {
+ try { a2() }
+ finally { a3() }
+ }
+ }
+
+ def t3(i: => Int): Int = {
+ println("t3")
+ try {
+ try { return i }
+ finally { a1() }
+ } catch {
+ case _: Throwable =>
+ try { i2 }
+ finally { a2() } // no cleanup version
+ } finally {
+ a3()
+ }
+ }
+
+ def t4(i: => Int): Int = {
+ println("t4")
+ try {
+ return i
+ } finally {
+ return i2
+ }
+ }
+
+ def t5(i: => Int): Int = {
+ println("t5")
+ try {
+ try {
+ try { return i }
+ finally { a1() }
+ } catch {
+ case _: Throwable => i2
+ }
+ } finally {
+ a3()
+ }
+ }
+
+ def t6(i: => Int): Int = {
+ println("t6")
+ try {
+ try { return i }
+ finally { return i2 }
+ } finally {
+ return i3
+ }
+ }
+
+ def t7(i: => Int): Int = {
+ println("t7")
+ try { i }
+ catch {
+ case _: Throwable =>
+ return i2
+ } finally {
+ a1() // cleanup required, early return in handler
+ }
+ }
+
+ def t8(i: => Int): Int = {
+ println("t8")
+ try {
+ try { i }
+ finally { // no cleanup version
+ try { return i2 }
+ finally { a1() } // cleanup version required
+ }
+ } finally { // cleanup version required
+ a2()
+ }
+ }
+
+ def t9(i: => Int): Int = {
+ println("t9")
+ try {
+ return i
+ } finally {
+ try { return i2 }
+ finally { a1() }
+ }
+ }
+
+ def t10(i: => Int): Int = {
+ println("t10")
+ try {
+ return i
+ } finally {
+ try { return i2 }
+ finally { return i3 }
+ }
+ }
+
+ // this changed semantics between 2.12.0 and 2.12.1, see https://github.com/scala/scala/pull/5509#issuecomment-259291609
+ def t11(i: => Int): Int = {
+ println("t11")
+ try {
+ try { return i }
+ finally { return i2 }
+ } finally {
+ a1()
+ }
+ }
+
+ assert(t1 == 1)
+
+ assert(t2 == 1)
+
+ assert(t3(i1) == 1)
+ assert(t3(e1) == 2)
+
+ assert(t4(i1) == 2)
+ assert(t4(e1) == 2)
+
+ assert(t5(i1) == 1)
+ assert(t5(e1) == 2)
+
+ assert(t6(i1) == 3)
+ assert(t6(e1) == 3)
+
+ assert(t7(i1) == 1)
+ assert(t7(e1) == 2)
+
+ assert(t8(i1) == 2)
+ assert(t8(e1) == 2)
+
+ assert(t9(i1) == 2)
+ assert(t9(e1) == 2)
+
+ assert(t10(i1) == 3)
+ assert(t10(e1) == 3)
+
+ assert(t11(i1) == 2)
+ assert(t11(e1) == 2)
+}
diff --git a/test/files/run/t10059/A.java b/test/files/run/t10059/A.java
new file mode 100644
index 0000000000..49b6447817
--- /dev/null
+++ b/test/files/run/t10059/A.java
@@ -0,0 +1,3 @@
+public class A {
+ public static int foo(T t) { return t.m(1, 2, 3); }
+}
diff --git a/test/files/run/t10059/Test.scala b/test/files/run/t10059/Test.scala
new file mode 100644
index 0000000000..7bbb623e74
--- /dev/null
+++ b/test/files/run/t10059/Test.scala
@@ -0,0 +1,9 @@
+abstract class T {
+ @annotation.varargs def m(l: Int*): Int
+}
+class C extends T {
+ override def m(l: Int*): Int = 1
+}
+object Test extends App {
+ assert(A.foo(new C) == 1)
+}
diff --git a/test/files/run/t8433.check b/test/files/run/t8433.check
new file mode 100644
index 0000000000..9480ca51cb
--- /dev/null
+++ b/test/files/run/t8433.check
@@ -0,0 +1,2 @@
+high
+high
diff --git a/test/files/run/t8433.scala b/test/files/run/t8433.scala
new file mode 100644
index 0000000000..79e18757b8
--- /dev/null
+++ b/test/files/run/t8433.scala
@@ -0,0 +1,46 @@
+
+import tools.partest.DirectTest
+import reflect.internal.util._
+
+// mimic the resident compiler failure by recompiling
+// the class with new run of same global.
+object Test extends DirectTest {
+
+ override def code = """
+ object Main {
+ def main(args: Array[String]): Unit = {
+ Surf xmain args
+ import trial.core.Rankable
+ object Surf {
+ def xmain(args: Array[String]): Unit = println(new Strategy("win").rank)
+ }
+ class Strategy(name:String) extends Rankable
+ }
+ }
+ """
+
+ override def show(): Unit = {
+ // first, compile the interface
+ val dependency = """
+ |package trial
+ |
+ |object core {
+ | trait Rankable {
+ | val rank: String = "high"
+ | }
+ |}
+ |""".stripMargin
+
+ assert(compileString(newCompiler())(dependency))
+
+ // a resident global
+ val g = newCompiler()
+
+ assert(compileString(g)(code))
+ ScalaClassLoader(getClass.getClassLoader) run ("Main", Nil)
+ assert(compileString(g)(code))
+ ScalaClassLoader(getClass.getClassLoader) run ("Main", Nil)
+ }
+
+ override def extraSettings = s"-usejavacp -d ${testOutput.path}"
+}
diff --git a/test/files/run/t9375.scala b/test/files/run/t9375.scala
index 3995b38666..58893c963b 100644
--- a/test/files/run/t9375.scala
+++ b/test/files/run/t9375.scala
@@ -18,7 +18,7 @@ object SerDes {
import SerDes._
-// tests to make sure that de-serializing an object does not run its constructor
+// tests to make sure that deserializing an object does not run its constructor
trait S extends Serializable {
println(" konstruktor: " + this.getClass)
diff --git a/test/files/run/t9689.check b/test/files/run/t9689.check
new file mode 100644
index 0000000000..61ed6e13a2
--- /dev/null
+++ b/test/files/run/t9689.check
@@ -0,0 +1,14 @@
+
+scala> import bug._
+import bug._
+
+scala> import Wrap._
+import Wrap._
+
+scala> object Bar extends Foo
+defined object Bar
+
+scala> Bar.foo
+ok
+
+scala> :quit
diff --git a/test/files/run/t9689/Test_2.scala b/test/files/run/t9689/Test_2.scala
new file mode 100644
index 0000000000..086ddecdea
--- /dev/null
+++ b/test/files/run/t9689/Test_2.scala
@@ -0,0 +1,12 @@
+import scala.tools.partest.ReplTest
+
+object Test extends ReplTest {
+
+ def code = """
+import bug._
+import Wrap._
+object Bar extends Foo
+Bar.foo
+ """
+
+}
diff --git a/test/files/run/t9689/bug_1.scala b/test/files/run/t9689/bug_1.scala
new file mode 100644
index 0000000000..1dfd7bdad8
--- /dev/null
+++ b/test/files/run/t9689/bug_1.scala
@@ -0,0 +1,8 @@
+
+package bug
+
+object Wrap {
+ trait Foo {
+ def foo: Unit = println("ok")
+ }
+}
diff --git a/test/files/run/t9915/C_1.java b/test/files/run/t9915/C_1.java
new file mode 100644
index 0000000000..4269cf74e0
--- /dev/null
+++ b/test/files/run/t9915/C_1.java
@@ -0,0 +1,20 @@
+/*
+ * javac: -encoding UTF-8
+ */
+public class C_1 {
+ public static final String NULLED = "X\000ABC";
+ public static final String SUPPED = "𐒈𐒝𐒑𐒛𐒐𐒘𐒕𐒖";
+
+ public String nulled() {
+ return C_1.NULLED;
+ }
+ public String supped() {
+ return C_1.SUPPED;
+ }
+ public int nulledSize() {
+ return C_1.NULLED.length();
+ }
+ public int suppedSize() {
+ return C_1.SUPPED.length();
+ }
+}
diff --git a/test/files/run/t9915/Test_2.scala b/test/files/run/t9915/Test_2.scala
new file mode 100644
index 0000000000..afed667cc6
--- /dev/null
+++ b/test/files/run/t9915/Test_2.scala
@@ -0,0 +1,12 @@
+
+object Test extends App {
+ val c = new C_1
+ assert(c.nulled == "X\u0000ABC") // "X\000ABC"
+ assert(c.supped == "𐒈𐒝𐒑𐒛𐒐𐒘𐒕𐒖")
+
+ assert(C_1.NULLED == "X\u0000ABC") // "X\000ABC"
+ assert(C_1.SUPPED == "𐒈𐒝𐒑𐒛𐒐𐒘𐒕𐒖")
+
+ assert(C_1.NULLED.size == "XYABC".size)
+ assert(C_1.SUPPED.codePointCount(0, C_1.SUPPED.length) == 8)
+}
diff --git a/test/files/run/t9944.check b/test/files/run/t9944.check
new file mode 100755
index 0000000000..c2b0adf311
--- /dev/null
+++ b/test/files/run/t9944.check
@@ -0,0 +1,12 @@
+[[syntax trees at end of parser]] // newSource1.scala
+package <empty> {
+ class C extends scala.AnyRef {
+ def <init>() = {
+ super.<init>();
+ ()
+ };
+ def g = 42;
+ def f = StringContext("123\r\n", "\r\n123\r\n").s(g)
+ }
+}
+
diff --git a/test/files/run/t9944.scala b/test/files/run/t9944.scala
new file mode 100644
index 0000000000..01cd481266
--- /dev/null
+++ b/test/files/run/t9944.scala
@@ -0,0 +1,7 @@
+
+import scala.tools.partest.ParserTest
+
+object Test extends ParserTest {
+
+ def code = s"""class C { def g = 42 ; def f = s""\"123\r\n$${ g }\r\n123\r\n""\"}"""
+}
diff --git a/test/junit/scala/collection/IteratorTest.scala b/test/junit/scala/collection/IteratorTest.scala
index 09061a3b29..1709e3c1bf 100644
--- a/test/junit/scala/collection/IteratorTest.scala
+++ b/test/junit/scala/collection/IteratorTest.scala
@@ -186,6 +186,12 @@ class IteratorTest {
assertEquals(1, y.next)
assertFalse(x.hasNext) // was true, after advancing underlying iterator
}
+ // SI-9913
+ @Test def `span leading iterator finishes at state -1`(): Unit = {
+ val (yes, no) = Iterator(1, 2, 3).span(_ => true)
+ assertFalse(no.hasNext)
+ assertTrue(yes.hasNext)
+ }
// SI-9623
@Test def noExcessiveHasNextInJoinIterator: Unit = {
var counter = 0
diff --git a/test/junit/scala/collection/parallel/immutable/ParRangeTest.scala b/test/junit/scala/collection/parallel/immutable/ParRangeTest.scala
new file mode 100644
index 0000000000..f746fc2bf9
--- /dev/null
+++ b/test/junit/scala/collection/parallel/immutable/ParRangeTest.scala
@@ -0,0 +1,15 @@
+package scala.collection.parallel.immutable
+
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+import org.junit.Test
+
+@RunWith(classOf[JUnit4])
+class ParRangeTest {
+
+ @Test
+ def buildParRangeString {
+ assert(ParRange(1, 5, 1, true).toString == "ParRange 1 to 5")
+ }
+
+}
diff --git a/test/junit/scala/reflect/internal/util/SourceFileTest.scala b/test/junit/scala/reflect/internal/util/SourceFileTest.scala
index cad23eba14..2f2029ad2d 100644
--- a/test/junit/scala/reflect/internal/util/SourceFileTest.scala
+++ b/test/junit/scala/reflect/internal/util/SourceFileTest.scala
@@ -5,6 +5,8 @@ import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
+import scala.tools.testing.AssertUtil._
+
@RunWith(classOf[JUnit4])
class SourceFileTest {
def lineContentOf(code: String, offset: Int) =
@@ -57,4 +59,21 @@ class SourceFileTest {
assertEquals("def", lineContentOf("abc\r\ndef", 8))
assertEquals("def", lineContentOf("abc\r\ndef\r\n", 9))
}
+
+ @Test def si9885_lineToOffset(): Unit = {
+ val text = "a\nb\nc\n"
+ val f = new BatchSourceFile("batch", text)
+ assertThrows[IndexOutOfBoundsException] {
+ f.lineToOffset(3)
+ }
+ assertEquals(4, f.lineToOffset(2))
+
+ val p = Position.offset(f, text.length - 1)
+ val q = Position.offset(f, f.lineToOffset(p.line - 1))
+ assertEquals(p.line, q.line)
+ assertEquals(p.column, q.column + 1)
+ assertThrows[IndexOutOfBoundsException] {
+ Position.offset(f, f.lineToOffset(p.line))
+ }
+ }
}
diff --git a/test/junit/scala/util/SpecVersionTest.scala b/test/junit/scala/util/SpecVersionTest.scala
index 4639389dd9..82fc4fdf7b 100644
--- a/test/junit/scala/util/SpecVersionTest.scala
+++ b/test/junit/scala/util/SpecVersionTest.scala
@@ -33,8 +33,6 @@ class SpecVersionTest {
assert(sut9 isJavaAtLeast "1.8")
assert(sut9 isJavaAtLeast "8")
assert(sut9 isJavaAtLeast "9")
- assert(sut9.isJavaAtLeast(9))
- assertFalse(sut9.isJavaAtLeast(10))
assertFalse(sut9.isJavaAtLeast("10"))
}
@@ -47,8 +45,8 @@ class SpecVersionTest {
assert(sut7 isJavaAtLeast "5")
assert(sut7 isJavaAtLeast "1.6")
assert(sut7 isJavaAtLeast "1.7")
- assert(sut7.isJavaAtLeast(7))
- assertFalse(sut7.isJavaAtLeast(9))
+ assert(sut7.isJavaAtLeast("7"))
+ assertFalse(sut7.isJavaAtLeast("9"))
assertFalse(sut7 isJavaAtLeast "1.8")
assertFalse(sut7 isJavaAtLeast "9")
assertFalse(sut7 isJavaAtLeast "10")
@@ -69,7 +67,6 @@ class SpecVersionTest {
@Test def `spec has minor or more`(): Unit = {
val sut = new TestProperties("9.2.5")
- assert(sut.isJavaAtLeast(9))
assert(sut.isJavaAtLeast("9"))
assert(sut.isJavaAtLeast("9.0.1"))
assert(sut.isJavaAtLeast("9.2.1"))
@@ -81,7 +78,6 @@ class SpecVersionTest {
@Test def `compares only major minor security`(): Unit = {
val sut = new TestProperties("9.2.5.1.2.3")
- assert(sut.isJavaAtLeast(9))
assert(sut.isJavaAtLeast("9"))
assert(sut.isJavaAtLeast("9.0.1"))
assert(sut.isJavaAtLeast("9.2.5.9.9.9"))
@@ -90,8 +86,7 @@ class SpecVersionTest {
@Test def `futurely proofed`(): Unit = {
val sut = new TestProperties("10.2.5")
- assert(sut.isJavaAtLeast(9))
- assert(sut.isJavaAtLeast(10))
+ assert(sut.isJavaAtLeast("10"))
assert(sut.isJavaAtLeast("9"))
assert(sut.isJavaAtLeast("9.0.1"))
assert(sut.isJavaAtLeast("9.2.1"))
diff --git a/test/scaladoc/resources/SI-10027.java b/test/scaladoc/resources/SI-10027.java
new file mode 100644
index 0000000000..28d212ffed
--- /dev/null
+++ b/test/scaladoc/resources/SI-10027.java
@@ -0,0 +1,5 @@
+/**
+ * Around 20k characters
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ */
+public class JavaComments {}
diff --git a/test/scaladoc/run/SI-10027.check b/test/scaladoc/run/SI-10027.check
new file mode 100644
index 0000000000..619c56180b
--- /dev/null
+++ b/test/scaladoc/run/SI-10027.check
@@ -0,0 +1 @@
+Done.
diff --git a/test/scaladoc/run/SI-10027.scala b/test/scaladoc/run/SI-10027.scala
new file mode 100644
index 0000000000..d720d8371c
--- /dev/null
+++ b/test/scaladoc/run/SI-10027.scala
@@ -0,0 +1,12 @@
+import scala.tools.nsc.doc.Universe
+import scala.tools.nsc.doc.model._
+import scala.tools.partest.ScaladocJavaModelTest
+
+object Test extends ScaladocJavaModelTest {
+
+ override def resourceFile = "SI-10027.java"
+ override def scaladocSettings = ""
+
+ // just make sure it compiles
+ def testModel(rootPackage: Package) = {}
+}
diff --git a/versions.properties b/versions.properties
index 7b96071386..e7ed0cfc71 100644
--- a/versions.properties
+++ b/versions.properties
@@ -1,14 +1,17 @@
# Scala version used for bootstrapping. (This has no impact on the
# final classfiles, since compiler and library are built first using
# starr, then rebuilt using themselves.)
-starr.version=2.12.0-RC2
+starr.version=2.12.0
-# Set in the following way:
+# These are the versions of the modules that go with this release.
+# These properties are used during PR validation and in dbuild builds.
+
+# The scala.binary.version determines how modules are resolved. For example, it
+# determines which partest artifact is being used for running the tests.
+# It has to be set in the following way:
# - After 2.x.0 is released, the binary version is 2.x.
# - During milestones and RCs, modules are cross-built against the full version.
# So the value is the full version (e.g. 2.12.0-M2).
-# Also determines how modules are resolved. For example, it determines which
-# partest artifact is being used for running the tests.
scala.binary.version=2.12
# external modules shipped with distribution, as specified by scala-library-all's pom
@@ -23,6 +26,4 @@ scala-asm.version=5.1.0-scala-1
# external modules, used internally (not shipped)
partest.version.number=1.0.17
-# TODO: We've embedded these sources in partest-extras for now.
-# after 2.12.0 is out, we can switch back to a public release.
-# scalacheck.version.number=1.11.6
+scalacheck.version.number=1.11.6