mirror of https://github.com/sbt/sbt.git
Add -Ywarn-unused & -Ywarn-unused-import, & fix warnings
This commit is contained in:
parent
28a40163e7
commit
121e7f5d9e
|
|
@ -14,6 +14,7 @@ def commonSettings: Seq[Setting[_]] = Seq(
|
|||
testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"),
|
||||
javacOptions in compile ++= Seq("-target", "6", "-source", "6", "-Xlint", "-Xlint:-serial"),
|
||||
crossScalaVersions := Seq(scala210, scala211),
|
||||
scalacOptions ++= Seq("-Ywarn-unused", "-Ywarn-unused-import"),
|
||||
previousArtifact := None, // Some(organization.value %% moduleName.value % "1.0.0"),
|
||||
publishArtifact in Compile := true,
|
||||
publishArtifact in Test := false
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package appmacro
|
|||
|
||||
import scala.reflect._
|
||||
import macros._
|
||||
import scala.tools.nsc.Global
|
||||
import ContextUtil.{ DynamicDependencyError, DynamicReferenceError }
|
||||
|
||||
object ContextUtil {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ trait MonadInstance extends Instance {
|
|||
|
||||
import scala.reflect._
|
||||
import macros._
|
||||
import reflect.internal.annotations.compileTimeOnly
|
||||
|
||||
object Instance {
|
||||
final val ApplyName = "app"
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
package sbt.internal.util
|
||||
package appmacro
|
||||
|
||||
import Types.Id
|
||||
import scala.tools.nsc.Global
|
||||
import scala.reflect._
|
||||
import macros._
|
||||
|
||||
|
|
@ -59,7 +57,6 @@ object KListBuilder extends TupleBuilder {
|
|||
val klistType: Type = (inputs :\ knilType)((in, klist) => kconsType(in.tpe, klist))
|
||||
|
||||
val representationC = internal.polyType(tcVariable :: Nil, klistType)
|
||||
val resultType = appliedType(representationC, idTC :: Nil)
|
||||
val input = klist
|
||||
val alistInstance: ctx.universe.Tree = TypeApply(select(Ident(alist), "klist"), TypeTree(representationC) :: Nil)
|
||||
def extract(param: ValDef) = bindKList(param, Nil, inputs.map(_.local))
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
package sbt.internal.util
|
||||
package appmacro
|
||||
|
||||
import Types.Id
|
||||
import scala.tools.nsc.Global
|
||||
import scala.reflect._
|
||||
import macros._
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package sbt.internal.util
|
||||
package appmacro
|
||||
|
||||
import Types.Id
|
||||
import scala.tools.nsc.Global
|
||||
import scala.reflect._
|
||||
import macros._
|
||||
|
|
@ -17,11 +16,10 @@ object TupleNBuilder extends TupleBuilder {
|
|||
|
||||
def make(c: blackbox.Context)(mt: c.Type, inputs: Inputs[c.universe.type]): BuilderResult[c.type] = new BuilderResult[c.type] {
|
||||
val util = ContextUtil[c.type](c)
|
||||
import c.universe.{ Apply => ApplyTree, _ }
|
||||
import c.universe._
|
||||
import util._
|
||||
|
||||
val global: Global = c.universe.asInstanceOf[Global]
|
||||
val mTC: Type = mt.asInstanceOf[c.universe.Type]
|
||||
|
||||
val ctx: c.type = c
|
||||
val representationC: PolyType = {
|
||||
|
|
@ -30,7 +28,6 @@ object TupleNBuilder extends TupleBuilder {
|
|||
val tuple = global.definitions.tupleType(tupleTypeArgs)
|
||||
internal.polyType(tcVariable :: Nil, tuple.asInstanceOf[Type])
|
||||
}
|
||||
val resultType = appliedType(representationC, idTC :: Nil)
|
||||
|
||||
val input: Tree = mkTuple(inputs.map(_.expr))
|
||||
val alistInstance: Tree = {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import sbinary.{ CollectionTypes, DefaultProtocol, Format, Input, JavaFormats, O
|
|||
import java.io.{ ByteArrayInputStream, ByteArrayOutputStream, File, InputStream, OutputStream }
|
||||
import java.net.{ URI, URL }
|
||||
import Types.:+:
|
||||
import DefaultProtocol.{ asProduct2, asSingleton, BooleanFormat, ByteFormat, IntFormat, wrap }
|
||||
import DefaultProtocol.{ asSingleton, BooleanFormat, ByteFormat, IntFormat, wrap }
|
||||
import scala.xml.NodeSeq
|
||||
import scala.language.existentials
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
package sbt.internal.util
|
||||
|
||||
import java.io.{ File, FileNotFoundException }
|
||||
import java.io.File
|
||||
import sbinary.{ DefaultProtocol, Format, Operations }
|
||||
import scala.reflect.Manifest
|
||||
import sbt.io.IO
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
package sbt.internal.util
|
||||
|
||||
import java.io.{ File, IOException }
|
||||
import java.io.File
|
||||
import sbinary.{ DefaultProtocol, Format }
|
||||
import DefaultProtocol._
|
||||
import scala.reflect.Manifest
|
||||
|
|
|
|||
|
|
@ -3,10 +3,8 @@
|
|||
*/
|
||||
package sbt.internal.util
|
||||
|
||||
import Types.:+:
|
||||
import sbinary.{ DefaultProtocol, Format, Input, Output => Out }
|
||||
import DefaultProtocol.ByteFormat
|
||||
import java.io.{ File, InputStream, OutputStream }
|
||||
import sbinary.{ Format, Input, Output => Out }
|
||||
import java.io.File
|
||||
import sbt.io.Using
|
||||
|
||||
trait InputCache[I] {
|
||||
|
|
|
|||
|
|
@ -94,7 +94,6 @@ object Dag {
|
|||
*/
|
||||
private[sbt] def findNegativeCycle[Node](graph: DirectedSignedGraph[Node]): List[graph.Arrow] =
|
||||
{
|
||||
import scala.annotation.tailrec
|
||||
import graph._
|
||||
val finished = new mutable.HashSet[Node]
|
||||
val visited = new mutable.HashSet[Node]
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package sbt.internal.util
|
|||
import java.lang.Runnable
|
||||
import java.util.concurrent.{ atomic, Executor, LinkedBlockingQueue }
|
||||
import atomic.{ AtomicBoolean, AtomicInteger }
|
||||
import Types.{ :+:, ConstK, Id }
|
||||
import Types.{ ConstK, Id }
|
||||
|
||||
object EvaluationState extends Enumeration {
|
||||
val New, Blocked, Ready, Calling, Evaluated = Value
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
*/
|
||||
package sbt.internal.util
|
||||
|
||||
import Types._
|
||||
|
||||
// Used to emulate ~> literals
|
||||
trait Param[A[_], B[_]] {
|
||||
type T
|
||||
|
|
|
|||
|
|
@ -278,7 +278,6 @@ trait Init[Scope] {
|
|||
|
||||
def flattenLocals(compiled: CompiledMap): Map[ScopedKey[_], Flattened] =
|
||||
{
|
||||
import collection.breakOut
|
||||
val locals = compiled flatMap { case (key, comp) => if (key.key.isLocal) Seq[Compiled[_]](comp) else Nil }
|
||||
val ordered = Dag.topologicalSort(locals)(_.dependencies.flatMap(dep => if (dep.key.isLocal) Seq[Compiled[_]](compiled(dep)) else Nil))
|
||||
def flatten(cmap: Map[ScopedKey[_], Flattened], key: ScopedKey[_], deps: Iterable[ScopedKey[_]]): Flattened =
|
||||
|
|
@ -340,11 +339,6 @@ trait Init[Scope] {
|
|||
derivsByDef.getOrElseUpdate(key, new Deriveds(key, new mutable.ListBuffer)).settings += s
|
||||
}
|
||||
|
||||
// sort derived settings so that dependencies come first
|
||||
// this is necessary when verifying that a derived setting's dependencies exist
|
||||
val ddeps = (d: Deriveds) => d.dependencies.flatMap(derivsByDef.get)
|
||||
val sortedDerivs = Dag.topologicalSort(derivsByDef.values)(ddeps)
|
||||
|
||||
// index derived settings by triggering key. This maps a key to the list of settings potentially derived from it.
|
||||
val derivedBy = new mutable.HashMap[AttributeKey[_], mutable.ListBuffer[Derived]]
|
||||
for (s <- derived; d <- s.triggeredBy)
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
*/
|
||||
package sbt.internal.util
|
||||
|
||||
import Types._
|
||||
|
||||
// compilation test
|
||||
object LiteralTest {
|
||||
def x[A[_], B[_]](f: A ~> B) = f
|
||||
|
|
@ -14,4 +12,4 @@ object LiteralTest {
|
|||
|
||||
val a: List[Int] = f(Some(3))
|
||||
val b: List[String] = f(Some("aa"))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ object SettingsExample extends Init[Scope] {
|
|||
|
||||
object SettingsUsage {
|
||||
import SettingsExample._
|
||||
import Types._
|
||||
|
||||
// Define some keys
|
||||
val a = AttributeKey[Int]("a")
|
||||
|
|
|
|||
|
|
@ -5,9 +5,8 @@ package sbt.internal.util
|
|||
|
||||
import jline.console.ConsoleReader
|
||||
import jline.console.history.{ FileHistory, MemoryHistory }
|
||||
import java.io.{ File, InputStream, PrintWriter, FileInputStream, FileDescriptor, FilterInputStream }
|
||||
import java.io.{ File, InputStream, FileInputStream, FileDescriptor, FilterInputStream }
|
||||
import complete.Parser
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import scala.concurrent.duration.Duration
|
||||
import scala.annotation.tailrec
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ object EditDistance {
|
|||
for (i <- 1 to n; s_i = s(i - 1); j <- 1 to m) {
|
||||
val t_j = t(j - 1)
|
||||
val cost = if (s_i == t_j) matchCost else if (lower(s_i) == lower(t_j)) caseCost else subCost
|
||||
val tcost = if (s_i == t_j) matchCost else transposeCost
|
||||
|
||||
val c1 = d(i - 1)(j) + deleteCost
|
||||
val c2 = d(i)(j - 1) + insertCost
|
||||
|
|
@ -39,4 +38,4 @@ object EditDistance {
|
|||
|
||||
d(n)(m)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
package sbt.internal.util
|
||||
package complete
|
||||
|
||||
import java.io.File
|
||||
import sbt.io.IO
|
||||
|
||||
object HistoryCommands {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ package sbt.internal.util
|
|||
package complete
|
||||
|
||||
import jline.console.ConsoleReader
|
||||
import jline.console.completer.{ CandidateListCompletionHandler, Completer, CompletionHandler }
|
||||
import jline.console.completer.{ Completer, CompletionHandler }
|
||||
import scala.annotation.tailrec
|
||||
import collection.JavaConversions
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package sbt.internal.util
|
||||
|
||||
import sbt.util._
|
||||
import java.io.{ BufferedWriter, PrintStream, PrintWriter }
|
||||
|
||||
sealed trait ConsoleOut {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ package sbt.internal.util
|
|||
|
||||
import sbt.util._
|
||||
import org.scalacheck._
|
||||
import Arbitrary.{ arbitrary => arb, _ }
|
||||
import Arbitrary._
|
||||
import Gen.{ listOfN, oneOf }
|
||||
import Prop._
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import java.io.File
|
|||
import sbt.util.Logger
|
||||
import sbt.internal.util.{ ConsoleLogger, BufferedLogger, FullLogger }
|
||||
import sbt.io.IO.wrapNull
|
||||
import sbt.io.{ DirectoryFilter, HiddenFileFilter, Path, GlobFilter }
|
||||
import sbt.io.{ DirectoryFilter, HiddenFileFilter }
|
||||
import sbt.io.syntax._
|
||||
import sbt.internal.io.Resources
|
||||
|
||||
|
|
@ -49,9 +49,6 @@ final class ScriptedTests(resourceBaseDirectory: File, bufferLog: Boolean, handl
|
|||
def scriptedTest(group: String, name: String, log: Logger): Seq[() => Option[String]] =
|
||||
scriptedTest(group, name, { _ => () }, log)
|
||||
def scriptedTest(group: String, name: String, prescripted: File => Unit, log: Logger): Seq[() => Option[String]] = {
|
||||
import Path._
|
||||
import GlobFilter._
|
||||
var failed = false
|
||||
for (groupDir <- (resourceBaseDirectory * group).get; nme <- (groupDir * name).get) yield {
|
||||
val g = groupDir.getName
|
||||
val n = nme.getName
|
||||
|
|
@ -173,4 +170,4 @@ final class ListTests(baseDirectory: File, accept: ScriptedTest => Boolean, log:
|
|||
class PendingTestSuccessException(label: String) extends Exception {
|
||||
override def getMessage: String =
|
||||
s"The pending test $label succeeded. Mark this test as passing to remove this failure."
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ package sbt
|
|||
package internal
|
||||
package scripted
|
||||
|
||||
import java.io.{ BufferedReader, File, InputStreamReader }
|
||||
import java.io.File
|
||||
import scala.util.parsing.combinator._
|
||||
import scala.util.parsing.input.Positional
|
||||
import Character.isWhitespace
|
||||
|
|
@ -80,4 +80,4 @@ class TestScriptParser(handlers: Map[Char, StatementHandler]) extends RegexParse
|
|||
((newline | err("expected start character " + handlers.keys.mkString("(", "", ")"))) ~> failure("end of input"))
|
||||
|
||||
def newline = """\s*([\n\r]|$)""".r
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,9 +8,8 @@ import CacheIO.{ fromFile, toFile }
|
|||
import sbinary.Format
|
||||
import scala.pickling.PicklingException
|
||||
import scala.reflect.Manifest
|
||||
import scala.collection.mutable
|
||||
import sbt.io.IO.{ delete, read, write }
|
||||
import sbt.io.{ IO, Path }
|
||||
import sbt.io.IO
|
||||
import sbt.io.Using
|
||||
import sbt.io.syntax._
|
||||
import sbt.serialization._
|
||||
|
|
@ -257,7 +256,6 @@ object FileFunction {
|
|||
|
||||
def cached(cacheBaseDirectory: File)(inStyle: FilesInfo.Style, outStyle: FilesInfo.Style)(action: UpdateFunction): Set[File] => Set[File] =
|
||||
{
|
||||
import Path._
|
||||
lazy val inCache = Difference.inputs(cacheBaseDirectory / "in-cache", inStyle)
|
||||
lazy val outCache = Difference.outputs(cacheBaseDirectory / "out-cache", outStyle)
|
||||
inputs =>
|
||||
|
|
|
|||
Loading…
Reference in New Issue