From bc6ad0115868118a7b2343f9b4633070dd748962 Mon Sep 17 00:00:00 2001 From: katrinafyi <39479354+katrinafyi@users.noreply.github.com> Date: Wed, 23 Jul 2025 22:26:28 +1000 Subject: [PATCH 1/2] doctool: propagate errors from inspectAllTastyFiles it's not pretty, but it does work. tested with: ``` sbt 'scaladoc/runMain dotty.tools.scaladoc.Main ./bad -d a -siteroot empty' ``` and it will produce something like ``` -- Error: src/main/scala/Main.scala:26:12 -------------------------------------- undefined: m.parse # -1: TermRef(TermRef(NoPrefix,val m),parse) at readTasty 1 error found Failure [error] nonzero exit code returned from runner: 1 [error] (scaladoc / Compile / runMain) nonzero exit code returned from runner: 1 ``` --- scaladoc/src/dotty/tools/scaladoc/tasty/TastyParser.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scaladoc/src/dotty/tools/scaladoc/tasty/TastyParser.scala b/scaladoc/src/dotty/tools/scaladoc/tasty/TastyParser.scala index f55451fdc636..f124fe8f8be5 100644 --- a/scaladoc/src/dotty/tools/scaladoc/tasty/TastyParser.scala +++ b/scaladoc/src/dotty/tools/scaladoc/tasty/TastyParser.scala @@ -160,7 +160,9 @@ object ScaladocTastyInspector: report.error("File extension is not `tasty` or `jar`: " + invalidPath) if tastyPaths.nonEmpty then - TastyInspector.inspectAllTastyFiles(tastyPaths, jarPaths, classpath)(inspector) + val tastyOk = TastyInspector.inspectAllTastyFiles(tastyPaths, jarPaths, classpath)(inspector) + if !tastyOk then + report.error("Failure") val all = inspector.topLevels.result() all.groupBy(_._1).map { case (pckName, members) => From 7d298937e4c3d934b5f27b36bce0699beb506558 Mon Sep 17 00:00:00 2001 From: katrinafyi <39479354+katrinafyi@users.noreply.github.com> Date: Wed, 23 Jul 2025 23:19:00 +1000 Subject: [PATCH 2/2] improve tasty failure message Co-authored-by: Tomasz Godzik --- scaladoc/src/dotty/tools/scaladoc/tasty/TastyParser.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scaladoc/src/dotty/tools/scaladoc/tasty/TastyParser.scala b/scaladoc/src/dotty/tools/scaladoc/tasty/TastyParser.scala index f124fe8f8be5..264579496dbc 100644 --- a/scaladoc/src/dotty/tools/scaladoc/tasty/TastyParser.scala +++ b/scaladoc/src/dotty/tools/scaladoc/tasty/TastyParser.scala @@ -162,7 +162,7 @@ object ScaladocTastyInspector: if tastyPaths.nonEmpty then val tastyOk = TastyInspector.inspectAllTastyFiles(tastyPaths, jarPaths, classpath)(inspector) if !tastyOk then - report.error("Failure") + report.error("Failed to analyse some of the tasty files, please check the above logs for details") val all = inspector.topLevels.result() all.groupBy(_._1).map { case (pckName, members) =>