diff --git a/sbt-test/sbt-dotty/scaladoc-regressions/build.sbt b/sbt-test/sbt-dotty/scaladoc-regressions/build.sbt deleted file mode 100644 index bfdadb5ee038..000000000000 --- a/sbt-test/sbt-dotty/scaladoc-regressions/build.sbt +++ /dev/null @@ -1,9 +0,0 @@ -ThisBuild / scalaVersion := sys.props("plugin.scalaVersion") - -lazy val i20476 = project - .in(file("i20476")) - .enablePlugins(ScalaJSPlugin) - -lazy val i18231 = project - .in(file("i18231")) - .settings(scalacOptions += "-release:8") diff --git a/sbt-test/sbt-dotty/scaladoc-regressions/i18231/src/main/scala/main.scala b/sbt-test/sbt-dotty/scaladoc-regressions/i18231/src/main/scala/main.scala deleted file mode 100644 index 82788aa829f0..000000000000 --- a/sbt-test/sbt-dotty/scaladoc-regressions/i18231/src/main/scala/main.scala +++ /dev/null @@ -1,4 +0,0 @@ -object Foo { - @Deprecated - def foo(): Unit = ??? -} diff --git a/sbt-test/sbt-dotty/scaladoc-regressions/i20476/src/main/scala/main.scala b/sbt-test/sbt-dotty/scaladoc-regressions/i20476/src/main/scala/main.scala deleted file mode 100644 index 31eb78c816cd..000000000000 --- a/sbt-test/sbt-dotty/scaladoc-regressions/i20476/src/main/scala/main.scala +++ /dev/null @@ -1,5 +0,0 @@ -package demo - -import scala.scalajs.js - -def bar: js.Promise[Int] = js.Promise.resolve(()).`then`(_ => 1) diff --git a/sbt-test/sbt-dotty/scaladoc-regressions/project/plugins.sbt b/sbt-test/sbt-dotty/scaladoc-regressions/project/plugins.sbt deleted file mode 100644 index b9ebfd07bf1f..000000000000 --- a/sbt-test/sbt-dotty/scaladoc-regressions/project/plugins.sbt +++ /dev/null @@ -1 +0,0 @@ -addSbtPlugin("org.scala-js" % "sbt-scalajs" % sys.props("plugin.scalaJSVersion")) diff --git a/sbt-test/sbt-dotty/scaladoc-regressions/test b/sbt-test/sbt-dotty/scaladoc-regressions/test deleted file mode 100644 index 816c0be96141..000000000000 --- a/sbt-test/sbt-dotty/scaladoc-regressions/test +++ /dev/null @@ -1,2 +0,0 @@ -> i18231/doc -> i20476/doc diff --git a/scaladoc/src/dotty/tools/scaladoc/tasty/TastyParser.scala b/scaladoc/src/dotty/tools/scaladoc/tasty/TastyParser.scala index 1a8337e0c6b7..f55451fdc636 100644 --- a/scaladoc/src/dotty/tools/scaladoc/tasty/TastyParser.scala +++ b/scaladoc/src/dotty/tools/scaladoc/tasty/TastyParser.scala @@ -5,7 +5,7 @@ package tasty import java.util.regex.Pattern import scala.util.{Try, Success, Failure} -import scala.tasty.inspector.{ScaladocInternalTastyInspector, Inspector, Tasty} +import scala.tasty.inspector.{TastyInspector, Inspector, Tasty} import scala.quoted._ import dotty.tools.dotc @@ -160,7 +160,7 @@ object ScaladocTastyInspector: report.error("File extension is not `tasty` or `jar`: " + invalidPath) if tastyPaths.nonEmpty then - ScaladocInternalTastyInspector.inspectAllTastyFilesInContext(tastyPaths, jarPaths, classpath)(inspector)(using ctx.compilerContext) + TastyInspector.inspectAllTastyFiles(tastyPaths, jarPaths, classpath)(inspector) val all = inspector.topLevels.result() all.groupBy(_._1).map { case (pckName, members) => diff --git a/scaladoc/src/scala/tasty/inspector/TastyInspector.scala b/scaladoc/src/scala/tasty/inspector/TastyInspector.scala index 190be6a588a1..906578c9d405 100644 --- a/scaladoc/src/scala/tasty/inspector/TastyInspector.scala +++ b/scaladoc/src/scala/tasty/inspector/TastyInspector.scala @@ -1,7 +1,5 @@ -// Renamed copy of tasty-inspector/src/scala/tasty/inspector/TastyInspector.scala +// Copy of tasty-inspector/src/scala/tasty/inspector/TastyInspector.scala // FIXME remove this copy of the file -// Since copying, an inspectAllTastyFilesInContext method was added for scaladoc only -// to fix regressions introduced by the switch from old to a new TastyInspector package scala.tasty.inspector @@ -23,7 +21,7 @@ import dotty.tools.dotc.report import java.io.File.pathSeparator -object ScaladocInternalTastyInspector: +object TastyInspector: /** Load and process TASTy files using TASTy reflect * @@ -43,32 +41,6 @@ object ScaladocInternalTastyInspector: def inspectTastyFilesInJar(jar: String)(inspector: Inspector): Boolean = inspectAllTastyFiles(Nil, List(jar), Nil)(inspector) - private def checkFiles(tastyFiles: List[String], jars: List[String]): Unit = - def checkFile(fileName: String, ext: String): Unit = - val file = dotty.tools.io.Path(fileName) - if !file.ext.toLowerCase.equalsIgnoreCase(ext) then - throw new IllegalArgumentException(s"File extension is not `.$ext`: $file") - else if !file.exists then - throw new IllegalArgumentException(s"File not found: ${file.toAbsolute}") - tastyFiles.foreach(checkFile(_, "tasty")) - jars.foreach(checkFile(_, "jar")) - - /** - * Added for Scaladoc-only. - * Meant to fix regressions introduces by the switch from old to new TastyInspector: - * https://github.com/scala/scala3/issues/18231 - * https://github.com/scala/scala3/issues/20476 - * Stable TastyInspector API does not support passing compiler context. - */ - def inspectAllTastyFilesInContext(tastyFiles: List[String], jars: List[String], dependenciesClasspath: List[String])(inspector: Inspector)(using Context): Boolean = - checkFiles(tastyFiles, jars) - val classes = tastyFiles ::: jars - classes match - case Nil => true - case _ => - val reporter = inspectorDriver(inspector).process(inspectorArgs(dependenciesClasspath, classes), summon[Context]) - !reporter.hasErrors - /** Load and process TASTy files using TASTy reflect * * @param tastyFiles List of paths of `.tasty` files @@ -78,7 +50,14 @@ object ScaladocInternalTastyInspector: * @return boolean value indicating whether the process succeeded */ def inspectAllTastyFiles(tastyFiles: List[String], jars: List[String], dependenciesClasspath: List[String])(inspector: Inspector): Boolean = - checkFiles(tastyFiles, jars) + def checkFile(fileName: String, ext: String): Unit = + val file = dotty.tools.io.Path(fileName) + if !file.ext.toLowerCase.equalsIgnoreCase(ext) then + throw new IllegalArgumentException(s"File extension is not `.$ext`: $file") + else if !file.exists then + throw new IllegalArgumentException(s"File not found: ${file.toAbsolute}") + tastyFiles.foreach(checkFile(_, "tasty")) + jars.foreach(checkFile(_, "jar")) val files = tastyFiles ::: jars inspectFiles(dependenciesClasspath, files)(inspector) @@ -145,4 +124,4 @@ object ScaladocInternalTastyInspector: end inspectFiles -end ScaladocInternalTastyInspector +end TastyInspector diff --git a/scaladoc/test/dotty/tools/scaladoc/no-link-warnings/LinkWarningTest.scala b/scaladoc/test/dotty/tools/scaladoc/no-link-warnings/LinkWarningTest.scala index bcaee696b65c..1d140315cc10 100644 --- a/scaladoc/test/dotty/tools/scaladoc/no-link-warnings/LinkWarningTest.scala +++ b/scaladoc/test/dotty/tools/scaladoc/no-link-warnings/LinkWarningTest.scala @@ -14,7 +14,6 @@ class LinkWarningsTest extends ScaladocTest("noLinkWarnings"): override def runTest = afterRendering { val diagnostics = summon[DocContext].compilerContext.reportedDiagnostics - val filteredWarnings = diagnostics.warningMsgs.filter(_ != "1 warning found") - assertEquals("There should be exactly one warning", 1, filteredWarnings.size) + assertEquals("There should be exactly one warning", 1, diagnostics.warningMsgs.size) assertNoErrors(diagnostics) }