From 8f1fb2d2323aa24898f34ec26cf659a070023e69 Mon Sep 17 00:00:00 2001 From: Pierre DAL-PRA Date: Fri, 7 Aug 2015 00:23:14 +0200 Subject: [PATCH] Fix additional warnings --- cache/src/test/scala/CacheTest.scala | 4 +-- .../scala/sbt/inc/TestCaseGenerators.scala | 2 +- .../src/main/scala/xsbt/ExtractAPI.scala | 2 +- .../sbt/compiler/AnalyzingCompiler.scala | 2 +- .../scala/sbt/ivyint/SbtChainResolver.scala | 20 ++++++------ ivy/src/test/scala/BaseIvySpecification.scala | 11 ++----- ivy/src/test/scala/CachedResolutionSpec.scala | 4 +-- .../src/main/scala/sbt/BasicCommands.scala | 2 +- .../command/src/main/scala/sbt/MainLoop.scala | 2 +- main/command/src/main/scala/sbt/Watched.scala | 2 +- main/src/main/scala/sbt/EvaluateTask.scala | 2 +- main/src/main/scala/sbt/Extracted.scala | 4 +-- main/src/main/scala/sbt/Load.scala | 2 +- main/src/main/scala/sbt/Project.scala | 4 +-- main/src/test/scala/ParseKey.scala | 2 +- main/src/test/scala/TestBuild.scala | 2 +- run/src/test/scala/sbt/ForkTest.scala | 8 ++--- tasks/standard/src/test/scala/Test.scala | 2 +- .../standard/src/test/scala/checkResult.scala | 4 +-- util/complete/src/test/scala/ParserTest.scala | 32 +++++++++---------- .../logic/src/test/scala/sbt/logic/Test.scala | 2 +- 21 files changed, 54 insertions(+), 61 deletions(-) diff --git a/cache/src/test/scala/CacheTest.scala b/cache/src/test/scala/CacheTest.scala index cbb7319b7..ca66ba925 100644 --- a/cache/src/test/scala/CacheTest.scala +++ b/cache/src/test/scala/CacheTest.scala @@ -12,7 +12,7 @@ object CacheTest // extends Properties("Cache test") import FileInfo.hash._ import Ordering._ import sbinary.DefaultProtocol.FileFormat - def test { + def test(): Unit = { lazy val create = new File("test") val length = cached(lengthCache) { @@ -28,4 +28,4 @@ object CacheTest // extends Properties("Cache test") } c(create :+: fileLength :+: HNil) } -} \ No newline at end of file +} diff --git a/compile/inc/src/test/scala/sbt/inc/TestCaseGenerators.scala b/compile/inc/src/test/scala/sbt/inc/TestCaseGenerators.scala index 2037dddda..7591183b1 100644 --- a/compile/inc/src/test/scala/sbt/inc/TestCaseGenerators.scala +++ b/compile/inc/src/test/scala/sbt/inc/TestCaseGenerators.scala @@ -81,7 +81,7 @@ object TestCaseGenerators { private[this] def lzy[T <: AnyRef](x: T) = SafeLazy.strict(x) def genNameHash(defn: String): Gen[xsbti.api._internalOnly_NameHash] = - value(new xsbti.api._internalOnly_NameHash(defn, defn.hashCode())) + const(new xsbti.api._internalOnly_NameHash(defn, defn.hashCode())) def genNameHashes(defns: Seq[String]): Gen[xsbti.api._internalOnly_NameHashes] = { def partitionAccordingToMask[T](mask: List[Boolean], xs: List[T]): (List[T], List[T]) = { diff --git a/compile/interface/src/main/scala/xsbt/ExtractAPI.scala b/compile/interface/src/main/scala/xsbt/ExtractAPI.scala index d42b1a457..5c2cbf61b 100644 --- a/compile/interface/src/main/scala/xsbt/ExtractAPI.scala +++ b/compile/interface/src/main/scala/xsbt/ExtractAPI.scala @@ -266,7 +266,7 @@ class ExtractAPI[GlobalType <: CallbackGlobal](val global: GlobalType, private def mkStructure(info: Type, s: Symbol, inherit: Boolean): xsbti.api.Structure = { - val (declared, inherited) = info.members.reverse.partition(_.owner == s) + val (declared, inherited) = info.members.toList.reverse.partition(_.owner == s) val baseTypes = info.baseClasses.tail.map(info.baseType) val ds = if (s.isModuleClass) removeConstructors(declared) else declared val is = if (inherit) removeConstructors(inherited) else Nil diff --git a/compile/src/main/scala/sbt/compiler/AnalyzingCompiler.scala b/compile/src/main/scala/sbt/compiler/AnalyzingCompiler.scala index 3501c3dfb..6f31452ff 100644 --- a/compile/src/main/scala/sbt/compiler/AnalyzingCompiler.scala +++ b/compile/src/main/scala/sbt/compiler/AnalyzingCompiler.scala @@ -148,7 +148,7 @@ object AnalyzingCompiler { } catch { case e: xsbti.CompileFailed => throw new CompileFailed(e.arguments, "Error compiling sbt component '" + id + "'", e.problems) } import sbt.Path._ copy(resources pair rebase(dir, outputDirectory)) - zip((outputDirectory ***) x_! relativeTo(outputDirectory), targetJar) + zip((outputDirectory ***) pair (relativeTo(outputDirectory), false), targetJar) } } } diff --git a/ivy/src/main/scala/sbt/ivyint/SbtChainResolver.scala b/ivy/src/main/scala/sbt/ivyint/SbtChainResolver.scala index 08c8f00e7..6b1f59a15 100644 --- a/ivy/src/main/scala/sbt/ivyint/SbtChainResolver.scala +++ b/ivy/src/main/scala/sbt/ivyint/SbtChainResolver.scala @@ -7,14 +7,14 @@ import java.util.Date import org.apache.ivy.core.settings.IvySettings import org.apache.ivy.core.{ IvyContext, LogOptions } -import org.apache.ivy.core.module.descriptor.{ Artifact => IArtifact, DefaultModuleDescriptor, DefaultDependencyDescriptor, ModuleDescriptor, DependencyDescriptor } +import org.apache.ivy.core.module.descriptor.{ Artifact => IArtifact, DefaultModuleDescriptor, ModuleDescriptor, DependencyDescriptor } import org.apache.ivy.core.resolve.{ ResolvedModuleRevision, ResolveData } import org.apache.ivy.plugins.latest.LatestStrategy import org.apache.ivy.plugins.repository.file.{ FileRepository => IFileRepository, FileResource } import org.apache.ivy.plugins.repository.url.URLResource import org.apache.ivy.plugins.resolver._ import org.apache.ivy.plugins.resolver.util.{ HasLatestStrategy, ResolvedResource } -import org.apache.ivy.util.{ Message, MessageLogger, StringUtils => IvyStringUtils } +import org.apache.ivy.util.{ Message, StringUtils => IvyStringUtils } private[sbt] case class SbtChainResolver( name: String, @@ -88,9 +88,9 @@ private[sbt] case class SbtChainResolver( // - If `isReturnFirst` is true, you return the first value found // - If not, we will ATTEMPT to look at the publish date, which is not correctly discovered for Maven modules and // leads to undefined behavior. - val useLatest = (dd.isChanging || (IvySbt.isChanging(dd.getDependencyRevisionId))) && updateOptions.latestSnapshots + val useLatest = (dd.isChanging || IvySbt.isChanging(dd.getDependencyRevisionId)) && updateOptions.latestSnapshots if (useLatest) { - Message.verbose(s"${getName} is changing. Checking all resolvers on the chain") + Message.verbose(s"$getName is changing. Checking all resolvers on the chain") } val data = new ResolveData(data0, doValidate(data0)) // Returns the value if we've already been resolved from some other branch of the resolution tree. @@ -146,7 +146,7 @@ private[sbt] case class SbtChainResolver( Left(ex) } finally { oldLatest map { _ => doSetLatestStrategy(resolver, oldLatest) } - checkInterrupted + checkInterrupted() } } } @@ -179,7 +179,7 @@ private[sbt] case class SbtChainResolver( } }).reverse.headOption map { case (rmr, resolver) => - Message.warn(s"Choosing ${resolver} for ${rmr.getId}") + Message.warn(s"Choosing $resolver for ${rmr.getId}") // Now that we know the real latest revision, let's force Ivy to use it val artifactOpt = findFirstArtifactRef(rmr.getDescriptor, dd, data, resolver) artifactOpt match { @@ -191,7 +191,7 @@ private[sbt] case class SbtChainResolver( case Some(artifactRef) => val systemMd = toSystem(rmr.getDescriptor) getRepositoryCacheManager.cacheModuleDescriptor(resolver, artifactRef, - toSystem(dd), systemMd.getAllArtifacts().head, None.orNull, getCacheOptions(data)) + toSystem(dd), systemMd.getAllArtifacts.head, None.orNull, getCacheOptions(data)) } rmr } @@ -223,7 +223,7 @@ private[sbt] case class SbtChainResolver( case r: FileResource => try { val parser = rmr.getDescriptor.getParser - val md = parser.parseDescriptor(settings, r.getFile.toURL, r, false) + val md = parser.parseDescriptor(settings, r.getFile.toURI.toURL, r, false) Some(new ResolvedModuleRevision(resolver, resolver, md, rmr.getReport, true)) } catch { case _: ParseException => None @@ -246,7 +246,7 @@ private[sbt] case class SbtChainResolver( Option(artifact.getUrl) map { url => Message.verbose("\tusing url for " + artifact + ": " + url) val resource = - if ("file" == url.getProtocol) new FileResource(new IFileRepository(), new File(url.getPath())) + if ("file" == url.getProtocol) new FileResource(new IFileRepository(), new File(url.getPath)) else new URLResource(url) new ResolvedResource(resource, artifact.getModuleRevisionId.getRevision) } @@ -262,7 +262,7 @@ private[sbt] case class SbtChainResolver( artifactRef(af, data.getDate).toIterator } } - if (artifactRefs.hasNext) Some(artifactRefs.next) + if (artifactRefs.hasNext) Some(artifactRefs.next()) else None } /** Ported from ChainResolver#forcedRevision. */ diff --git a/ivy/src/test/scala/BaseIvySpecification.scala b/ivy/src/test/scala/BaseIvySpecification.scala index 55efa60fa..a8a19ea76 100644 --- a/ivy/src/test/scala/BaseIvySpecification.scala +++ b/ivy/src/test/scala/BaseIvySpecification.scala @@ -4,7 +4,6 @@ import Path._, Configurations._ import java.io.File import org.specs2._ import cross.CrossVersionUtil -import sbt.PublishConfiguration import sbt.ivyint.SbtChainResolver trait BaseIvySpecification extends Specification { @@ -59,15 +58,9 @@ trait BaseIvySpecification extends Specification { IvyActions.updateEither(module, config, UnresolvedWarningConfiguration(), LogicalClock.unknown, Some(currentDependency), log) } - def cleanIvyCache: Unit = - { - IO.delete(currentTarget / "cache") - } + def cleanIvyCache(): Unit = IO.delete(currentTarget / "cache") - def cleanCachedResolutionCache(module: IvySbt#Module): Unit = - { - IvyActions.cleanCachedResolutionCache(module, log) - } + def cleanCachedResolutionCache(module: IvySbt#Module): Unit = IvyActions.cleanCachedResolutionCache(module, log) def ivyUpdate(module: IvySbt#Module) = ivyUpdateEither(module) match { diff --git a/ivy/src/test/scala/CachedResolutionSpec.scala b/ivy/src/test/scala/CachedResolutionSpec.scala index 16021b15c..8edbfaa15 100644 --- a/ivy/src/test/scala/CachedResolutionSpec.scala +++ b/ivy/src/test/scala/CachedResolutionSpec.scala @@ -28,7 +28,7 @@ class CachedResolutionSpec extends BaseIvySpecification { import ShowLines._ def e1 = { - cleanIvyCache + cleanIvyCache() val m = module(ModuleID("com.example", "foo", "0.1.0", Some("compile")), Seq(commonsIo13), Some("2.10.2"), UpdateOptions().withCachedResolution(true)) val report = ivyUpdate(m) @@ -67,7 +67,7 @@ class CachedResolutionSpec extends BaseIvySpecification { // #2046 says that netty:3.2.0.Final is incorrectly evicted by netty:3.2.1.Final def e3 = { // log.setLevel(Level.Debug) - cleanIvyCache + cleanIvyCache() val m = module(ModuleID("com.example", "foo", "0.3.0", Some("compile")), Seq(avro177, dataAvro1940, netty320), Some("2.10.2"), UpdateOptions().withCachedResolution(true)) diff --git a/main/command/src/main/scala/sbt/BasicCommands.scala b/main/command/src/main/scala/sbt/BasicCommands.scala index 95dbb383f..ec81efba9 100644 --- a/main/command/src/main/scala/sbt/BasicCommands.scala +++ b/main/command/src/main/scala/sbt/BasicCommands.scala @@ -134,7 +134,7 @@ object BasicCommands { private[this] def className: Parser[String] = { val base = StringBasic & not('-' ~> any.*, "Class name cannot start with '-'.") - def single(s: String) = Completions.single(Completion.displayStrict(s)) + def single(s: String) = Completions.single(Completion.displayOnly(s)) val compl = TokenCompletions.fixed((seen, level) => if (seen.startsWith("-")) Completions.nil else single("")) token(base, compl) } diff --git a/main/command/src/main/scala/sbt/MainLoop.scala b/main/command/src/main/scala/sbt/MainLoop.scala index 6f34813c5..488decab0 100644 --- a/main/command/src/main/scala/sbt/MainLoop.scala +++ b/main/command/src/main/scala/sbt/MainLoop.scala @@ -96,7 +96,7 @@ object MainLoop { ErrorHandling.wideConvert { state.process(Command.process) } match { case Right(s) => s case Left(t: xsbti.FullReload) => throw t - case Left(t) => handleException(t, state) + case Left(t) => state.handleError(t) } @deprecated("Use State.handleError", "0.13.0") diff --git a/main/command/src/main/scala/sbt/Watched.scala b/main/command/src/main/scala/sbt/Watched.scala index 3dc1bd6e0..d8ef89605 100644 --- a/main/command/src/main/scala/sbt/Watched.scala +++ b/main/command/src/main/scala/sbt/Watched.scala @@ -63,7 +63,7 @@ object Watched { case e: Exception => val log = s.log log.error("Error occurred obtaining files to watch. Terminating continuous execution...") - MainLoop.handleException(e, s, log) + State.handleException(e, s, log) (false, watchState, s.fail) } diff --git a/main/src/main/scala/sbt/EvaluateTask.scala b/main/src/main/scala/sbt/EvaluateTask.scala index db7e32b33..5356fe635 100644 --- a/main/src/main/scala/sbt/EvaluateTask.scala +++ b/main/src/main/scala/sbt/EvaluateTask.scala @@ -247,7 +247,7 @@ object EvaluateTask { { val root = ProjectRef(pluginDef.root, Load.getRootProject(pluginDef.units)(pluginDef.root)) val pluginKey = pluginData - val config = extractedConfig(Project.extract(state), pluginDef, state) + val config = extractedTaskConfig(Project.extract(state), pluginDef, state) val evaluated = apply(pluginDef, ScopedKey(pluginKey.scope, pluginKey.key), state, root, config) val (newS, result) = evaluated getOrElse sys.error("Plugin data does not exist for plugin definition at " + pluginDef.root) Project.runUnloadHooks(newS) // discard states diff --git a/main/src/main/scala/sbt/Extracted.scala b/main/src/main/scala/sbt/Extracted.scala index 6f6fe8933..0ac639765 100644 --- a/main/src/main/scala/sbt/Extracted.scala +++ b/main/src/main/scala/sbt/Extracted.scala @@ -40,8 +40,8 @@ final case class Extracted(structure: BuildStructure, session: SessionSettings, { import EvaluateTask._ val rkey = resolve(key.scopedKey) - val config = extractedConfig(this, structure) - val value: Option[(State, Result[T])] = apply(structure, key.task.scopedKey, state, currentRef, config) + val config = extractedTaskConfig(this, structure, state) + val value: Option[(State, Result[T])] = apply(structure, key.scopedKey, state, currentRef, config) val (newS, result) = getOrError(rkey.scope, rkey.key, value) (newS, processResult(result, newS.log)) } diff --git a/main/src/main/scala/sbt/Load.scala b/main/src/main/scala/sbt/Load.scala index 71a0156ac..3f41f5546 100755 --- a/main/src/main/scala/sbt/Load.scala +++ b/main/src/main/scala/sbt/Load.scala @@ -184,7 +184,7 @@ object Load { def reapply(newSettings: Seq[Setting[_]], structure: sbt.BuildStructure)(implicit display: Show[ScopedKey[_]]): sbt.BuildStructure = { val transformed = finalTransforms(newSettings) - val newData = makeSettings(transformed, structure.delegates, structure.scopeLocal) + val newData = Def.make(transformed)(structure.delegates, structure.scopeLocal, display) val newIndex = structureIndex(newData, transformed, index => BuildUtil(structure.root, structure.units, index, newData), structure.units) val newStreams = mkStreams(structure.units, structure.root, newData) new sbt.BuildStructure(units = structure.units, root = structure.root, settings = transformed, data = newData, index = newIndex, streams = newStreams, delegates = structure.delegates, scopeLocal = structure.scopeLocal) diff --git a/main/src/main/scala/sbt/Project.scala b/main/src/main/scala/sbt/Project.scala index f953eb489..48db490d0 100755 --- a/main/src/main/scala/sbt/Project.scala +++ b/main/src/main/scala/sbt/Project.scala @@ -141,7 +141,7 @@ sealed trait Project extends ProjectDefinition[ProjectReference] { def aggregate(refs: ProjectReference*): Project = copy(aggregate = (aggregate: Seq[ProjectReference]) ++ refs) /** Appends settings to the current settings sequence for this project. */ - def settings(ss: SettingsDefinition*): Project = copy(settings = (settings: Seq[Def.Setting[_]]) ++ ss.flatMap(_.settings)) + def settings(ss: Def.SettingsDefinition*): Project = copy(settings = (settings: Seq[Def.Setting[_]]) ++ ss.flatMap(_.settings)) @deprecated("Use settingSets method.", "0.13.5") def autoSettings(select: AddSettings*): Project = settingSets(select.toSeq: _*) @@ -464,7 +464,7 @@ object Project extends ProjectExtra { def relation(structure: BuildStructure, actual: Boolean)(implicit display: Show[ScopedKey[_]]): Relation[ScopedKey[_], ScopedKey[_]] = relation(structure.settings, actual)(structure.delegates, structure.scopeLocal, display) - private[sbt] def relation(settings: Seq[Setting[_]], actual: Boolean)(implicit delegates: Scope => Seq[Scope], scopeLocal: Def.ScopeLocal, display: Show[ScopedKey[_]]): Relation[ScopedKey[_], ScopedKey[_]] = + private[sbt] def relation(settings: Seq[Def.Setting[_]], actual: Boolean)(implicit delegates: Scope => Seq[Scope], scopeLocal: Def.ScopeLocal, display: Show[ScopedKey[_]]): Relation[ScopedKey[_], ScopedKey[_]] = { type Rel = Relation[ScopedKey[_], ScopedKey[_]] val cMap = Def.flattenLocals(Def.compiled(settings, actual)) diff --git a/main/src/test/scala/ParseKey.scala b/main/src/test/scala/ParseKey.scala index 637782369..d9607e2de 100644 --- a/main/src/test/scala/ParseKey.scala +++ b/main/src/test/scala/ParseKey.scala @@ -123,7 +123,7 @@ object ParseKey extends Properties("Key parser test") { // so that it will use the passed-in `Gen` rather than the one imported // from TestBuild. def structureGenF(f: (Seq[Scope], Env, ProjectRef) => Structure)(implicit mkEnv: Gen[Env]): Gen[Structure] = - structureGen((s, e, p) => Gen.value(f(s, e, p))) + structureGen((s, e, p) => Gen.const(f(s, e, p))) // Here we're shadowing the in-scope implicit called `mkEnv` for this method // so that it will use the passed-in `Gen` rather than the one imported // from TestBuild. diff --git a/main/src/test/scala/TestBuild.scala b/main/src/test/scala/TestBuild.scala index cf67370bc..8167eb8ed 100644 --- a/main/src/test/scala/TestBuild.scala +++ b/main/src/test/scala/TestBuild.scala @@ -214,7 +214,7 @@ object TestBuild { def genAcyclicDirect[A, T](maxDeps: Gen[Int], keyGen: Gen[T], max: Gen[Int])(make: (T, Seq[A]) => A): Gen[Seq[A]] = genAcyclic[A, T](maxDeps, keyGen, max) { t => - Gen.value { deps => + Gen.const { deps => make(t, deps) } } diff --git a/run/src/test/scala/sbt/ForkTest.scala b/run/src/test/scala/sbt/ForkTest.scala index cb9feac73..08bc0ba51 100644 --- a/run/src/test/scala/sbt/ForkTest.scala +++ b/run/src/test/scala/sbt/ForkTest.scala @@ -2,7 +2,7 @@ package sbt import org.scalacheck._ import Prop.{ Exception => _, _ } -import Gen.{ alphaNumChar, frequency, listOf1, oneOf } +import Gen.{ alphaNumChar, frequency, nonEmptyListOf } import java.io.File object ForkTest extends Properties("Fork") { @@ -14,9 +14,9 @@ object ForkTest extends Properties("Fork") { final val MaximumClasspathLength = 100000 lazy val genOptionName = frequency((9, Some("-cp")), (9, Some("-classpath")), (1, None)) - lazy val pathElement = listOf1(alphaNumChar).map(_.mkString) - lazy val path = listOf1(pathElement).map(_.mkString(File.separator)) - lazy val genRelClasspath = listOf1(path) + lazy val pathElement = nonEmptyListOf(alphaNumChar).map(_.mkString) + lazy val path = nonEmptyListOf(pathElement).map(_.mkString(File.separator)) + lazy val genRelClasspath = nonEmptyListOf(path) lazy val requiredEntries = IO.classLocationFile[scala.Option[_]] :: diff --git a/tasks/standard/src/test/scala/Test.scala b/tasks/standard/src/test/scala/Test.scala index b1ace1d56..d92734c56 100644 --- a/tasks/standard/src/test/scala/Test.scala +++ b/tasks/standard/src/test/scala/Test.scala @@ -12,7 +12,7 @@ object Test extends std.TaskExtra { def t3[A, B, C](a: Task[A], b: Task[B], c: Task[C]) = multInputTask[({ type l[L[x]] = (L[A], L[B], L[C]) })#l]((a, b, c))(AList.tuple3) val a = task(3) - val b = task[Boolean](error("test")) + val b = task[Boolean](sys.error("test")) val b2 = task(true) val c = task("asdf") diff --git a/tasks/standard/src/test/scala/checkResult.scala b/tasks/standard/src/test/scala/checkResult.scala index 70de6c4a5..14c992c57 100644 --- a/tasks/standard/src/test/scala/checkResult.scala +++ b/tasks/standard/src/test/scala/checkResult.scala @@ -16,8 +16,8 @@ object checkResult { case i: Incomplete => println(i) "One or more tasks failed" |: false - case e => - e.printStackTrace + case e: Throwable => + e.printStackTrace() "Error in framework" |: false }) } diff --git a/util/complete/src/test/scala/ParserTest.scala b/util/complete/src/test/scala/ParserTest.scala index efe2f3493..f02431e53 100644 --- a/util/complete/src/test/scala/ParserTest.scala +++ b/util/complete/src/test/scala/ParserTest.scala @@ -44,7 +44,7 @@ object ParserTest extends Properties("Completing Parser") { val nested = (token("a1") ~ token("b2")) ~ "c3" val nestedDisplay = (token("a1", "") ~ token("b2", "")) ~ "c3" - val spacePort = (token(Space) ~> Port) + val spacePort = token(Space) ~> Port def p[T](f: T): T = { println(f); f } @@ -58,7 +58,7 @@ object ParserTest extends Properties("Completing Parser") { def checkAll(in: String, parser: Parser[_], expect: Completions): Prop = { val cs = completions(parser, in, 1) - ("completions: " + cs) |: ("Expected: " + expect) |: ((cs == expect): Prop) + ("completions: " + cs) |: ("Expected: " + expect) |: (cs == expect: Prop) } def checkInvalid(in: String) = @@ -68,31 +68,31 @@ object ParserTest extends Properties("Completing Parser") { def checkInv(in: String, parser: Parser[_]): Prop = { val cs = completions(parser, in, 1) - ("completions: " + cs) |: ((cs == Completions.nil): Prop) + ("completions: " + cs) |: (cs == Completions.nil: Prop) } - property("nested tokens a") = checkSingle("", Completion.tokenStrict("", "a1"))(Completion.displayStrict("")) - property("nested tokens a1") = checkSingle("a", Completion.tokenStrict("a", "1"))(Completion.displayStrict("")) + property("nested tokens a") = checkSingle("", Completion.token("", "a1"))(Completion.displayOnly("")) + property("nested tokens a1") = checkSingle("a", Completion.token("a", "1"))(Completion.displayOnly("")) property("nested tokens a inv") = checkInvalid("b") - property("nested tokens b") = checkSingle("a1", Completion.tokenStrict("", "b2"))(Completion.displayStrict("")) - property("nested tokens b2") = checkSingle("a1b", Completion.tokenStrict("b", "2"))(Completion.displayStrict("")) + property("nested tokens b") = checkSingle("a1", Completion.token("", "b2"))(Completion.displayOnly("")) + property("nested tokens b2") = checkSingle("a1b", Completion.token("b", "2"))(Completion.displayOnly("")) property("nested tokens b inv") = checkInvalid("a1a") - property("nested tokens c") = checkSingle("a1b2", Completion.suggestStrict("c3"))() - property("nested tokens c3") = checkSingle("a1b2c", Completion.suggestStrict("3"))() + property("nested tokens c") = checkSingle("a1b2", Completion.suggestion("c3"))() + property("nested tokens c3") = checkSingle("a1b2c", Completion.suggestion("3"))() property("nested tokens c inv") = checkInvalid("a1b2a") - property("suggest space") = checkOne("", spacePort, Completion.tokenStrict("", " ")) - property("suggest port") = checkOne(" ", spacePort, Completion.displayStrict("")) - property("no suggest at end") = checkOne("asdf", "asdf", Completion.suggestStrict("")) - property("no suggest at token end") = checkOne("asdf", token("asdf"), Completion.suggestStrict("")) - property("empty suggest for examples") = checkOne("asdf", any.+.examples("asdf", "qwer"), Completion.suggestStrict("")) - property("empty suggest for examples token") = checkOne("asdf", token(any.+.examples("asdf", "qwer")), Completion.suggestStrict("")) + property("suggest space") = checkOne("", spacePort, Completion.token("", " ")) + property("suggest port") = checkOne(" ", spacePort, Completion.displayOnly("")) + property("no suggest at end") = checkOne("asdf", "asdf", Completion.suggestion("")) + property("no suggest at token end") = checkOne("asdf", token("asdf"), Completion.suggestion("")) + property("empty suggest for examples") = checkOne("asdf", any.+.examples("asdf", "qwer"), Completion.suggestion("")) + property("empty suggest for examples token") = checkOne("asdf", token(any.+.examples("asdf", "qwer")), Completion.suggestion("")) val colors = Set("blue", "green", "red") val base = (seen: Seq[String]) => token(ID examples (colors -- seen)) val sep = token(Space) val repeat = repeatDep(base, sep) - def completionStrings(ss: Set[String]): Completions = Completions(ss.map { s => Completion.tokenStrict("", s) }) + def completionStrings(ss: Set[String]): Completions = Completions(ss.map { s => Completion.token("", s) }) property("repeatDep no suggestions for bad input") = checkInv(".", repeat) property("repeatDep suggest all") = checkAll("", repeat, completionStrings(colors)) diff --git a/util/logic/src/test/scala/sbt/logic/Test.scala b/util/logic/src/test/scala/sbt/logic/Test.scala index a5277582c..f62a9e767 100644 --- a/util/logic/src/test/scala/sbt/logic/Test.scala +++ b/util/logic/src/test/scala/sbt/logic/Test.scala @@ -104,7 +104,7 @@ object TestClauses { Logic.reduceAll(cs, Set(A, B)) } - def all { + def all(): Unit = { println(s"Cycles: $cycles") println(s"xNeg: $excludedNeg") println(s"xPos: $excludedPos")