Skip to content

Commit

Permalink
Attempt to fix cryptic missing implicit.
Browse files Browse the repository at this point in the history
ArgParserImplicits has been the cause of many cryptic zinc compile
crashes even before 2.12.4 upgrade. Maybe moving the implicits helps.
  • Loading branch information
olafurpg committed Dec 7, 2017
1 parent 620c630 commit 3e13f0c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
2 changes: 1 addition & 1 deletion scalafix-cli/src/main/scala/scalafix/cli/Cli.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import org.typelevel.paiges.Doc

object Cli {
private def wrap(msg: String) = Doc.paragraph(msg).render(70)
import scalafix.internal.cli.ArgParserImplicits._
import scalafix.internal.cli.ScalafixOptions._
private lazy val withHelp: Messages[WithHelp[ScalafixOptions]] = {
val messages =
OptionsMessages.copy(optionsDesc = "[options] [<file>...]").withHelp
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import scalafix.internal.config.ScalafixReporter
import scalafix.internal.rule.ProcedureSyntax
import scalafix.rule.ScalafixRules
import caseapp._
import caseapp.core.ArgParser
import caseapp.core.Messages
import caseapp.core.Parser

case class CommonOptions(
@Hidden workingDirectory: String = System.getProperty("user.dir"),
Expand Down Expand Up @@ -161,3 +164,12 @@ case class ScalafixOptions(
outStream = if (stdout) common.err else common.out
)
}

object ScalafixOptions {
implicit val inputStreamRead: ArgParser[InputStream] =
ArgParser.instance[InputStream]("stdin")(_ => Right(System.in))
implicit val printStreamRead: ArgParser[PrintStream] =
ArgParser.instance[PrintStream]("stdout")(_ => Right(System.out))
val OptionsParser: Parser[ScalafixOptions] = Parser.apply[ScalafixOptions]
val OptionsMessages: Messages[ScalafixOptions] = Messages[ScalafixOptions]
}

0 comments on commit 3e13f0c

Please sign in to comment.