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"),
|
testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"),
|
||||||
javacOptions in compile ++= Seq("-target", "6", "-source", "6", "-Xlint", "-Xlint:-serial"),
|
javacOptions in compile ++= Seq("-target", "6", "-source", "6", "-Xlint", "-Xlint:-serial"),
|
||||||
crossScalaVersions := Seq(scala210, scala211),
|
crossScalaVersions := Seq(scala210, scala211),
|
||||||
|
scalacOptions ++= Seq("-Ywarn-unused", "-Ywarn-unused-import"),
|
||||||
previousArtifact := None, // Some(organization.value %% moduleName.value % "1.0.0"),
|
previousArtifact := None, // Some(organization.value %% moduleName.value % "1.0.0"),
|
||||||
publishArtifact in Compile := true,
|
publishArtifact in Compile := true,
|
||||||
publishArtifact in Test := false
|
publishArtifact in Test := false
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ package appmacro
|
||||||
|
|
||||||
import scala.reflect._
|
import scala.reflect._
|
||||||
import macros._
|
import macros._
|
||||||
import scala.tools.nsc.Global
|
|
||||||
import ContextUtil.{ DynamicDependencyError, DynamicReferenceError }
|
import ContextUtil.{ DynamicDependencyError, DynamicReferenceError }
|
||||||
|
|
||||||
object ContextUtil {
|
object ContextUtil {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ trait MonadInstance extends Instance {
|
||||||
|
|
||||||
import scala.reflect._
|
import scala.reflect._
|
||||||
import macros._
|
import macros._
|
||||||
import reflect.internal.annotations.compileTimeOnly
|
|
||||||
|
|
||||||
object Instance {
|
object Instance {
|
||||||
final val ApplyName = "app"
|
final val ApplyName = "app"
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
package sbt.internal.util
|
package sbt.internal.util
|
||||||
package appmacro
|
package appmacro
|
||||||
|
|
||||||
import Types.Id
|
|
||||||
import scala.tools.nsc.Global
|
|
||||||
import scala.reflect._
|
import scala.reflect._
|
||||||
import macros._
|
import macros._
|
||||||
|
|
||||||
|
|
@ -59,7 +57,6 @@ object KListBuilder extends TupleBuilder {
|
||||||
val klistType: Type = (inputs :\ knilType)((in, klist) => kconsType(in.tpe, klist))
|
val klistType: Type = (inputs :\ knilType)((in, klist) => kconsType(in.tpe, klist))
|
||||||
|
|
||||||
val representationC = internal.polyType(tcVariable :: Nil, klistType)
|
val representationC = internal.polyType(tcVariable :: Nil, klistType)
|
||||||
val resultType = appliedType(representationC, idTC :: Nil)
|
|
||||||
val input = klist
|
val input = klist
|
||||||
val alistInstance: ctx.universe.Tree = TypeApply(select(Ident(alist), "klist"), TypeTree(representationC) :: Nil)
|
val alistInstance: ctx.universe.Tree = TypeApply(select(Ident(alist), "klist"), TypeTree(representationC) :: Nil)
|
||||||
def extract(param: ValDef) = bindKList(param, Nil, inputs.map(_.local))
|
def extract(param: ValDef) = bindKList(param, Nil, inputs.map(_.local))
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
package sbt.internal.util
|
package sbt.internal.util
|
||||||
package appmacro
|
package appmacro
|
||||||
|
|
||||||
import Types.Id
|
|
||||||
import scala.tools.nsc.Global
|
|
||||||
import scala.reflect._
|
import scala.reflect._
|
||||||
import macros._
|
import macros._
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package sbt.internal.util
|
package sbt.internal.util
|
||||||
package appmacro
|
package appmacro
|
||||||
|
|
||||||
import Types.Id
|
|
||||||
import scala.tools.nsc.Global
|
import scala.tools.nsc.Global
|
||||||
import scala.reflect._
|
import scala.reflect._
|
||||||
import macros._
|
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] {
|
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)
|
val util = ContextUtil[c.type](c)
|
||||||
import c.universe.{ Apply => ApplyTree, _ }
|
import c.universe._
|
||||||
import util._
|
import util._
|
||||||
|
|
||||||
val global: Global = c.universe.asInstanceOf[Global]
|
val global: Global = c.universe.asInstanceOf[Global]
|
||||||
val mTC: Type = mt.asInstanceOf[c.universe.Type]
|
|
||||||
|
|
||||||
val ctx: c.type = c
|
val ctx: c.type = c
|
||||||
val representationC: PolyType = {
|
val representationC: PolyType = {
|
||||||
|
|
@ -30,7 +28,6 @@ object TupleNBuilder extends TupleBuilder {
|
||||||
val tuple = global.definitions.tupleType(tupleTypeArgs)
|
val tuple = global.definitions.tupleType(tupleTypeArgs)
|
||||||
internal.polyType(tcVariable :: Nil, tuple.asInstanceOf[Type])
|
internal.polyType(tcVariable :: Nil, tuple.asInstanceOf[Type])
|
||||||
}
|
}
|
||||||
val resultType = appliedType(representationC, idTC :: Nil)
|
|
||||||
|
|
||||||
val input: Tree = mkTuple(inputs.map(_.expr))
|
val input: Tree = mkTuple(inputs.map(_.expr))
|
||||||
val alistInstance: Tree = {
|
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.io.{ ByteArrayInputStream, ByteArrayOutputStream, File, InputStream, OutputStream }
|
||||||
import java.net.{ URI, URL }
|
import java.net.{ URI, URL }
|
||||||
import Types.:+:
|
import Types.:+:
|
||||||
import DefaultProtocol.{ asProduct2, asSingleton, BooleanFormat, ByteFormat, IntFormat, wrap }
|
import DefaultProtocol.{ asSingleton, BooleanFormat, ByteFormat, IntFormat, wrap }
|
||||||
import scala.xml.NodeSeq
|
import scala.xml.NodeSeq
|
||||||
import scala.language.existentials
|
import scala.language.existentials
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
*/
|
*/
|
||||||
package sbt.internal.util
|
package sbt.internal.util
|
||||||
|
|
||||||
import java.io.{ File, FileNotFoundException }
|
import java.io.File
|
||||||
import sbinary.{ DefaultProtocol, Format, Operations }
|
import sbinary.{ DefaultProtocol, Format, Operations }
|
||||||
import scala.reflect.Manifest
|
import scala.reflect.Manifest
|
||||||
import sbt.io.IO
|
import sbt.io.IO
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
*/
|
*/
|
||||||
package sbt.internal.util
|
package sbt.internal.util
|
||||||
|
|
||||||
import java.io.{ File, IOException }
|
import java.io.File
|
||||||
import sbinary.{ DefaultProtocol, Format }
|
import sbinary.{ DefaultProtocol, Format }
|
||||||
import DefaultProtocol._
|
import DefaultProtocol._
|
||||||
import scala.reflect.Manifest
|
import scala.reflect.Manifest
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,8 @@
|
||||||
*/
|
*/
|
||||||
package sbt.internal.util
|
package sbt.internal.util
|
||||||
|
|
||||||
import Types.:+:
|
import sbinary.{ Format, Input, Output => Out }
|
||||||
import sbinary.{ DefaultProtocol, Format, Input, Output => Out }
|
import java.io.File
|
||||||
import DefaultProtocol.ByteFormat
|
|
||||||
import java.io.{ File, InputStream, OutputStream }
|
|
||||||
import sbt.io.Using
|
import sbt.io.Using
|
||||||
|
|
||||||
trait InputCache[I] {
|
trait InputCache[I] {
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,6 @@ object Dag {
|
||||||
*/
|
*/
|
||||||
private[sbt] def findNegativeCycle[Node](graph: DirectedSignedGraph[Node]): List[graph.Arrow] =
|
private[sbt] def findNegativeCycle[Node](graph: DirectedSignedGraph[Node]): List[graph.Arrow] =
|
||||||
{
|
{
|
||||||
import scala.annotation.tailrec
|
|
||||||
import graph._
|
import graph._
|
||||||
val finished = new mutable.HashSet[Node]
|
val finished = new mutable.HashSet[Node]
|
||||||
val visited = new mutable.HashSet[Node]
|
val visited = new mutable.HashSet[Node]
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package sbt.internal.util
|
||||||
import java.lang.Runnable
|
import java.lang.Runnable
|
||||||
import java.util.concurrent.{ atomic, Executor, LinkedBlockingQueue }
|
import java.util.concurrent.{ atomic, Executor, LinkedBlockingQueue }
|
||||||
import atomic.{ AtomicBoolean, AtomicInteger }
|
import atomic.{ AtomicBoolean, AtomicInteger }
|
||||||
import Types.{ :+:, ConstK, Id }
|
import Types.{ ConstK, Id }
|
||||||
|
|
||||||
object EvaluationState extends Enumeration {
|
object EvaluationState extends Enumeration {
|
||||||
val New, Blocked, Ready, Calling, Evaluated = Value
|
val New, Blocked, Ready, Calling, Evaluated = Value
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,6 @@
|
||||||
*/
|
*/
|
||||||
package sbt.internal.util
|
package sbt.internal.util
|
||||||
|
|
||||||
import Types._
|
|
||||||
|
|
||||||
// Used to emulate ~> literals
|
// Used to emulate ~> literals
|
||||||
trait Param[A[_], B[_]] {
|
trait Param[A[_], B[_]] {
|
||||||
type T
|
type T
|
||||||
|
|
|
||||||
|
|
@ -278,7 +278,6 @@ trait Init[Scope] {
|
||||||
|
|
||||||
def flattenLocals(compiled: CompiledMap): Map[ScopedKey[_], Flattened] =
|
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 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))
|
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 =
|
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
|
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.
|
// 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]]
|
val derivedBy = new mutable.HashMap[AttributeKey[_], mutable.ListBuffer[Derived]]
|
||||||
for (s <- derived; d <- s.triggeredBy)
|
for (s <- derived; d <- s.triggeredBy)
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,6 @@
|
||||||
*/
|
*/
|
||||||
package sbt.internal.util
|
package sbt.internal.util
|
||||||
|
|
||||||
import Types._
|
|
||||||
|
|
||||||
// compilation test
|
// compilation test
|
||||||
object LiteralTest {
|
object LiteralTest {
|
||||||
def x[A[_], B[_]](f: A ~> B) = f
|
def x[A[_], B[_]](f: A ~> B) = f
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ object SettingsExample extends Init[Scope] {
|
||||||
|
|
||||||
object SettingsUsage {
|
object SettingsUsage {
|
||||||
import SettingsExample._
|
import SettingsExample._
|
||||||
import Types._
|
|
||||||
|
|
||||||
// Define some keys
|
// Define some keys
|
||||||
val a = AttributeKey[Int]("a")
|
val a = AttributeKey[Int]("a")
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,8 @@ package sbt.internal.util
|
||||||
|
|
||||||
import jline.console.ConsoleReader
|
import jline.console.ConsoleReader
|
||||||
import jline.console.history.{ FileHistory, MemoryHistory }
|
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 complete.Parser
|
||||||
import java.util.concurrent.atomic.AtomicBoolean
|
|
||||||
import scala.concurrent.duration.Duration
|
import scala.concurrent.duration.Duration
|
||||||
import scala.annotation.tailrec
|
import scala.annotation.tailrec
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ object EditDistance {
|
||||||
for (i <- 1 to n; s_i = s(i - 1); j <- 1 to m) {
|
for (i <- 1 to n; s_i = s(i - 1); j <- 1 to m) {
|
||||||
val t_j = t(j - 1)
|
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 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 c1 = d(i - 1)(j) + deleteCost
|
||||||
val c2 = d(i)(j - 1) + insertCost
|
val c2 = d(i)(j - 1) + insertCost
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
package sbt.internal.util
|
package sbt.internal.util
|
||||||
package complete
|
package complete
|
||||||
|
|
||||||
import java.io.File
|
|
||||||
import sbt.io.IO
|
import sbt.io.IO
|
||||||
|
|
||||||
object HistoryCommands {
|
object HistoryCommands {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ package sbt.internal.util
|
||||||
package complete
|
package complete
|
||||||
|
|
||||||
import jline.console.ConsoleReader
|
import jline.console.ConsoleReader
|
||||||
import jline.console.completer.{ CandidateListCompletionHandler, Completer, CompletionHandler }
|
import jline.console.completer.{ Completer, CompletionHandler }
|
||||||
import scala.annotation.tailrec
|
import scala.annotation.tailrec
|
||||||
import collection.JavaConversions
|
import collection.JavaConversions
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package sbt.internal.util
|
package sbt.internal.util
|
||||||
|
|
||||||
import sbt.util._
|
|
||||||
import java.io.{ BufferedWriter, PrintStream, PrintWriter }
|
import java.io.{ BufferedWriter, PrintStream, PrintWriter }
|
||||||
|
|
||||||
sealed trait ConsoleOut {
|
sealed trait ConsoleOut {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ package sbt.internal.util
|
||||||
|
|
||||||
import sbt.util._
|
import sbt.util._
|
||||||
import org.scalacheck._
|
import org.scalacheck._
|
||||||
import Arbitrary.{ arbitrary => arb, _ }
|
import Arbitrary._
|
||||||
import Gen.{ listOfN, oneOf }
|
import Gen.{ listOfN, oneOf }
|
||||||
import Prop._
|
import Prop._
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import java.io.File
|
||||||
import sbt.util.Logger
|
import sbt.util.Logger
|
||||||
import sbt.internal.util.{ ConsoleLogger, BufferedLogger, FullLogger }
|
import sbt.internal.util.{ ConsoleLogger, BufferedLogger, FullLogger }
|
||||||
import sbt.io.IO.wrapNull
|
import sbt.io.IO.wrapNull
|
||||||
import sbt.io.{ DirectoryFilter, HiddenFileFilter, Path, GlobFilter }
|
import sbt.io.{ DirectoryFilter, HiddenFileFilter }
|
||||||
import sbt.io.syntax._
|
import sbt.io.syntax._
|
||||||
import sbt.internal.io.Resources
|
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]] =
|
def scriptedTest(group: String, name: String, log: Logger): Seq[() => Option[String]] =
|
||||||
scriptedTest(group, name, { _ => () }, log)
|
scriptedTest(group, name, { _ => () }, log)
|
||||||
def scriptedTest(group: String, name: String, prescripted: File => Unit, log: Logger): Seq[() => Option[String]] = {
|
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 {
|
for (groupDir <- (resourceBaseDirectory * group).get; nme <- (groupDir * name).get) yield {
|
||||||
val g = groupDir.getName
|
val g = groupDir.getName
|
||||||
val n = nme.getName
|
val n = nme.getName
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ package sbt
|
||||||
package internal
|
package internal
|
||||||
package scripted
|
package scripted
|
||||||
|
|
||||||
import java.io.{ BufferedReader, File, InputStreamReader }
|
import java.io.File
|
||||||
import scala.util.parsing.combinator._
|
import scala.util.parsing.combinator._
|
||||||
import scala.util.parsing.input.Positional
|
import scala.util.parsing.input.Positional
|
||||||
import Character.isWhitespace
|
import Character.isWhitespace
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,8 @@ import CacheIO.{ fromFile, toFile }
|
||||||
import sbinary.Format
|
import sbinary.Format
|
||||||
import scala.pickling.PicklingException
|
import scala.pickling.PicklingException
|
||||||
import scala.reflect.Manifest
|
import scala.reflect.Manifest
|
||||||
import scala.collection.mutable
|
|
||||||
import sbt.io.IO.{ delete, read, write }
|
import sbt.io.IO.{ delete, read, write }
|
||||||
import sbt.io.{ IO, Path }
|
import sbt.io.IO
|
||||||
import sbt.io.Using
|
import sbt.io.Using
|
||||||
import sbt.io.syntax._
|
import sbt.io.syntax._
|
||||||
import sbt.serialization._
|
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] =
|
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 inCache = Difference.inputs(cacheBaseDirectory / "in-cache", inStyle)
|
||||||
lazy val outCache = Difference.outputs(cacheBaseDirectory / "out-cache", outStyle)
|
lazy val outCache = Difference.outputs(cacheBaseDirectory / "out-cache", outStyle)
|
||||||
inputs =>
|
inputs =>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue