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
|
||||
implicit def commandBuilder(s: String): CommandBuilder = new CommandBuilder(s)
|
||||
final class CommandBuilder(commandName: String) {
|
||||
type NamedCommand = (String, List[String] => Unit)
|
||||
extension (commandName: String) {
|
||||
def nonEmpty(action: List[String] => Unit): NamedCommand =
|
||||
commandName -> { paths =>
|
||||
if (paths.isEmpty)
|
||||
|
|
|
|||
|
|
@ -9,11 +9,8 @@
|
|||
package sbt
|
||||
|
||||
private[sbt] trait IOSyntax0 extends IOSyntax1 {
|
||||
implicit def alternative[A, B](f: A => Option[B]): Alternative[A, B] = new Alternative[A, B] {
|
||||
override def |(g: A => Option[B]): A => Option[B] = (a: A) => f(a) orElse g(a)
|
||||
extension [A, B](f: A => Option[B]) {
|
||||
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 Alternative[A, B] {
|
||||
def |(g: A => Option[B]): A => Option[B]
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue