Merge pull request #35 from eed3si9n/wip/warning

Remove some warnings
This commit is contained in:
eugene yokota 2016-04-01 16:11:07 -04:00 committed by Dale Wijnand
commit ceca932026
No known key found for this signature in database
GPG Key ID: 4F256E3D151DF5EF
8 changed files with 20 additions and 24 deletions

View File

@ -89,7 +89,7 @@ object AttributeKey {
def isLocal: Boolean = true
def rank = Int.MaxValue
}
private[sbt] final val LocalLabel = "$local"
private[sbt] final val LocalLabel = "$" + "local"
}
/**

View File

@ -11,7 +11,7 @@ sealed trait KList[+M[_]] {
def transform[N[_]](f: M ~> N): Transform[N]
/** Folds this list using a function that operates on the homogeneous type of the elements of this list. */
def foldr[T](f: (M[_], T) => T, init: T): T = init // had trouble defining it in KNil
def foldr[B](f: (M[_], B) => B, init: B): B = init // had trouble defining it in KNil
/** Applies `f` to the elements of this list in the applicative functor defined by `ap`. */
def apply[N[x] >: M[x], Z](f: Transform[Id] => Z)(implicit ap: Applicative[N]): N[Z]
@ -39,7 +39,7 @@ final case class KCons[H, +T <: KList[M], +M[_]](head: M[H], tail: T) extends KL
np.apply(np.map(g, tt), f(head))
}
def :^:[A, N[x] >: M[x]](h: N[A]) = KCons(h, this)
override def foldr[T](f: (M[_], T) => T, init: T): T = f(head, tail.foldr(f, init))
override def foldr[B](f: (M[_], B) => B, init: B): B = f(head, tail.foldr(f, init))
}
sealed abstract class KNil extends KList[Nothing] {
final type Transform[N[_]] = KNil

View File

@ -87,7 +87,7 @@ abstract class AbstractRMap[K[_], V[_]] extends RMap[K, V] {
*/
class DelegatingPMap[K[_], V[_]](backing: mutable.Map[K[_], V[_]]) extends AbstractRMap[K, V] with PMap[K, V] {
def get[T](k: K[T]): Option[V[T]] = cast[T](backing.get(k))
def update[T](k: K[T], v: V[T]) { backing(k) = v }
def update[T](k: K[T], v: V[T]): Unit = { backing(k) = v }
def remove[T](k: K[T]) = cast(backing.remove(k))
def getOrUpdate[T](k: K[T], make: => V[T]) = cast[T](backing.getOrElseUpdate(k, make))
def mapValue[T](k: K[T], init: V[T], f: V[T] => V[T]): V[T] =

View File

@ -9,7 +9,7 @@ import Types._
trait Param[A[_], B[_]] {
type T
def in: A[T]
def ret(out: B[T])
def ret(out: B[T]): Unit
def ret: B[T]
}

View File

@ -421,14 +421,10 @@ trait Init[Scope] {
def dependencies: Seq[ScopedKey[_]]
def apply[S](g: T => S): Initialize[S]
@deprecated("Will be made private.", "0.13.2")
def mapReferenced(g: MapScoped): Initialize[T]
@deprecated("Will be made private.", "0.13.2")
def mapConstant(g: MapConstant): Initialize[T]
@deprecated("Will be made private.", "0.13.2")
def validateReferenced(g: ValidateRef): ValidatedInit[T] =
validateKeyReferenced(new ValidateKeyRef { def apply[T](key: ScopedKey[T], selfRefOk: Boolean) = g(key) })
private[sbt] def mapReferenced(g: MapScoped): Initialize[T]
private[sbt] def mapConstant(g: MapConstant): Initialize[T]
private[sbt] def validateReferenced(g: ValidateRef): ValidatedInit[T] =
validateKeyReferenced(new ValidateKeyRef { def apply[B](key: ScopedKey[B], selfRefOk: Boolean) = g(key) })
private[sbt] def validateKeyReferenced(g: ValidateKeyRef): ValidatedInit[T]
@ -482,14 +478,14 @@ trait Init[Scope] {
private[sbt] def mapInitialize(f: Initialize[T] => Initialize[T]): Setting[T] = make(key, f(init), pos)
override def toString = "setting(" + key + ") at " + pos
protected[this] def make[T](key: ScopedKey[T], init: Initialize[T], pos: SourcePosition): Setting[T] = new Setting[T](key, init, pos)
protected[this] def make[B](key: ScopedKey[B], init: Initialize[B], pos: SourcePosition): Setting[B] = new Setting[B](key, init, pos)
protected[sbt] def isDerived: Boolean = false
private[sbt] def setScope(s: Scope): Setting[T] = make(key.copy(scope = s), init.mapReferenced(mapScope(const(s))), pos)
/** Turn this setting into a `DefaultSetting` if it's not already, otherwise returns `this` */
private[sbt] def default(id: => Long = nextDefaultID()): DefaultSetting[T] = DefaultSetting(key, init, pos, id)
}
private[Init] sealed class DerivedSetting[T](sk: ScopedKey[T], i: Initialize[T], p: SourcePosition, val filter: Scope => Boolean, val trigger: AttributeKey[_] => Boolean) extends Setting[T](sk, i, p) {
override def make[T](key: ScopedKey[T], init: Initialize[T], pos: SourcePosition): Setting[T] = new DerivedSetting[T](key, init, pos, filter, trigger)
override def make[B](key: ScopedKey[B], init: Initialize[B], pos: SourcePosition): Setting[B] = new DerivedSetting[B](key, init, pos, filter, trigger)
protected[sbt] override def isDerived: Boolean = true
override def default(_id: => Long): DefaultSetting[T] = new DerivedSetting[T](sk, i, p, filter, trigger) with DefaultSetting[T] { val id = _id }
override def toString = "derived " + super.toString
@ -498,7 +494,7 @@ trait Init[Scope] {
// This is intended for internal sbt use only, where alternatives like Plugin.globalSettings are not available.
private[Init] sealed trait DefaultSetting[T] extends Setting[T] {
val id: Long
override def make[T](key: ScopedKey[T], init: Initialize[T], pos: SourcePosition): Setting[T] = super.make(key, init, pos) default id
override def make[B](key: ScopedKey[B], init: Initialize[B], pos: SourcePosition): Setting[B] = super.make(key, init, pos) default id
override final def hashCode = id.hashCode
override final def equals(o: Any): Boolean = o match { case d: DefaultSetting[_] => d.id == id; case _ => false }
override def toString = s"default($id) " + super.toString
@ -547,7 +543,7 @@ trait Init[Scope] {
case None => this
case Some(const) => new Value(() => transform(const))
}
private[sbt] def processAttributes[S](init: S)(f: (S, AttributeMap) => S): S = init
private[sbt] def processAttributes[B](init: B)(f: (B, AttributeMap) => B): B = init
}
private[this] final class GetValue[S, T](val scopedKey: ScopedKey[S], val transform: S => T) extends Keyed[S, T]
trait KeyedInitialize[T] extends Keyed[T, T] {
@ -585,7 +581,7 @@ trait Init[Scope] {
new Bind[S, T](s => handleUndefined(f(s) validateKeyReferenced g), validIn)
}
def mapConstant(g: MapConstant) = new Bind[S, T](s => f(s) mapConstant g, in mapConstant g)
private[sbt] def processAttributes[S](init: S)(f: (S, AttributeMap) => S): S = in.processAttributes(init)(f)
private[sbt] def processAttributes[B](init: B)(f: (B, AttributeMap) => B): B = in.processAttributes(init)(f)
}
private[sbt] final class Optional[S, T](val a: Option[Initialize[S]], val f: Option[S] => T) extends Initialize[T] {
def dependencies = deps(a.toList)
@ -599,7 +595,7 @@ trait Init[Scope] {
def evaluate(ss: Settings[Scope]): T = f(a.flatMap(i => trapBadRef(evaluateT(ss)(i))))
// proper solution is for evaluate to be deprecated or for external use only and a new internal method returning Either be used
private[this] def trapBadRef[A](run: => A): Option[A] = try Some(run) catch { case e: InvalidReference => None }
private[sbt] def processAttributes[S](init: S)(f: (S, AttributeMap) => S): S = a match {
private[sbt] def processAttributes[B](init: B)(f: (B, AttributeMap) => B): B = a match {
case None => init
case Some(i) => i.processAttributes(init)(f)
}
@ -633,7 +629,7 @@ trait Init[Scope] {
{
val tx = alist.transform(inputs, validateKeyReferencedT(g))
val undefs = alist.toList(tx).flatMap(_.left.toSeq.flatten)
val get = new (ValidatedInit ~> Initialize) { def apply[T](vr: ValidatedInit[T]) = vr.right.get }
val get = new (ValidatedInit ~> Initialize) { def apply[B](vr: ValidatedInit[B]) = vr.right.get }
if (undefs.isEmpty) Right(new Apply(f, alist.transform(tx, get), alist)) else Left(undefs)
}

View File

@ -31,7 +31,7 @@ object Signals {
import sun.misc.{ Signal, SignalHandler }
val intSignal = new Signal(signal)
val newHandler = new SignalHandler {
def handle(sig: Signal) { handler() }
def handle(sig: Signal): Unit = { handler() }
}
val oldHandler = Signal.handle(intSignal, newHandler)
object unregisterNewHandler extends Registration {
@ -74,7 +74,7 @@ private final class Signals0 {
import sun.misc.{ Signal, SignalHandler }
val intSignal = new Signal(signal)
val newHandler = new SignalHandler {
def handle(sig: Signal) { handler() }
def handle(sig: Signal): Unit = { handler() }
}
val oldHandler = Signal.handle(intSignal, newHandler)

View File

@ -52,7 +52,7 @@ abstract class JLine extends LineReader {
}
}
private[this] def resume() {
private[this] def resume(): Unit = {
jline.TerminalFactory.reset
JLine.terminal.init
reader.drawLine()

View File

@ -7,7 +7,7 @@ package complete
import History.number
import java.io.File
final class History private (val lines: IndexedSeq[String], val path: Option[File], error: String => Unit) extends NotNull {
final class History private (val lines: IndexedSeq[String], val path: Option[File], error: String => Unit) {
private def reversed = lines.reverse
def all: Seq[String] = lines