mirror of https://github.com/sbt/sbt.git
use extension instead of implicit
This commit is contained in:
parent
d199f86a44
commit
4da8d942ce
|
|
@ -98,10 +98,10 @@ class FileCommands(baseDirectory: File) extends BasicStatementHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private type NamedCommand = (String, List[String] => Unit)
|
||||||
|
|
||||||
// these are for readability of the command list
|
// these are for readability of the command list
|
||||||
implicit def commandBuilder(s: String): CommandBuilder = new CommandBuilder(s)
|
extension (commandName: String) {
|
||||||
final class CommandBuilder(commandName: String) {
|
|
||||||
type NamedCommand = (String, List[String] => Unit)
|
|
||||||
def nonEmpty(action: List[String] => Unit): NamedCommand =
|
def nonEmpty(action: List[String] => Unit): NamedCommand =
|
||||||
commandName -> { paths =>
|
commandName -> { paths =>
|
||||||
if (paths.isEmpty)
|
if (paths.isEmpty)
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,8 @@
|
||||||
package sbt
|
package sbt
|
||||||
|
|
||||||
private[sbt] trait IOSyntax0 extends IOSyntax1 {
|
private[sbt] trait IOSyntax0 extends IOSyntax1 {
|
||||||
implicit def alternative[A, B](f: A => Option[B]): Alternative[A, B] = new Alternative[A, B] {
|
extension [A, B](f: A => Option[B]) {
|
||||||
override def |(g: A => Option[B]): A => Option[B] = (a: A) => f(a) orElse g(a)
|
def |(g: A => Option[B]): A => Option[B] = (a: A) => f(a) orElse g(a)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private[sbt] sealed trait IOSyntax1 extends sbt.io.IOSyntax with sbt.nio.file.syntax0
|
private[sbt] sealed trait IOSyntax1 extends sbt.io.IOSyntax with sbt.nio.file.syntax0
|
||||||
private[sbt] sealed trait Alternative[A, B] {
|
|
||||||
def |(g: A => Option[B]): A => Option[B]
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue