Skip to content

Commit

Permalink
Merge pull request #1830 from lwronski/explain-message
Browse files Browse the repository at this point in the history
Explain message
  • Loading branch information
lwronski authored Feb 7, 2023
2 parents 76d4fad + 2a3e247 commit a9d8c51
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ object ConsoleBloopBuildClient {
val prefix = diagnosticPrefix(diag.getSeverity)

val line = (diag.getRange.getStart.getLine + 1).toString + ":"
val col = (diag.getRange.getStart.getCharacter + 1).toString + ":"
val col = (diag.getRange.getStart.getCharacter + 1).toString
val msgIt = diag.getMessage.linesIterator

val path0 = path match {
Expand All @@ -183,9 +183,9 @@ object ConsoleBloopBuildClient {
"." + File.separator + p.relativeTo(Os.pwd).toString
case Right(p) => p.toString
}
logger.error(s"$prefix$path0:$line$col" + (if (msgIt.hasNext) " " + msgIt.next() else ""))
logger.error(s"$prefix$path0:$line$col")
for (line <- msgIt)
logger.message(prefix + line)
logger.error(prefix + line)
val codeOpt = {
val lineOpt =
if (diag.getRange.getStart.getLine == diag.getRange.getEnd.getLine)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,9 +488,8 @@ abstract class CompileTestDefinitions(val scalaVersionOpt: Option[String])
test("generate scoverage.coverage file") {
val fileName = "Hello.scala"
val inputs = TestInputs(
os.rel / fileName -> // scala version should updated to 3.3 after release
s"""//> using scala "3.2.0-RC1-bin-20220604-13ce496-NIGHTLY"
|//> using options "-coverage-out:."
os.rel / fileName ->
s"""//> using options "-coverage-out:."
|
|@main def main = ()
|""".stripMargin
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
package scala.cli.integration

class CompileTestsDefault extends CompileTestDefinitions(scalaVersionOpt = None)
import com.eed3si9n.expecty.Expecty.expect
class CompileTestsDefault extends CompileTestDefinitions(scalaVersionOpt = None) {
test("render explain message") {
val fileName = "Hello.scala"
val inputs = TestInputs(
os.rel / fileName -> // should be dump to 3.3.1 after release
s"""//> using scala "3.3.1-RC1-bin-20230203-3ef1e73-NIGHTLY"
|//> using options "--explain"
|
|class A
|val i: Int = A()
|""".stripMargin
)
inputs.fromRoot { root =>
val out = os.proc(TestUtil.cli, "compile", extraOptions, fileName)
.call(cwd = root, check = false, mergeErrIntoOut = true).out.trim()

expect(out.contains("Explanation"))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ object ActionablePreprocessor {
.map(handler => handler.createActionableDiagnostics(options))
.sequence
.left.map(CompositeBuildException(_))
.map((v: Seq[Seq[Any]]) => v.flatten)
.asInstanceOf[Either[BuildException, Seq[ActionableDiagnostic]]]
.map(_.flatten)

}

0 comments on commit a9d8c51

Please sign in to comment.