Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explain message #1830

Merged
merged 5 commits into from Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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
@@ -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"))
}
}
}
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)

}