diff --git a/compiler/src/dotty/tools/dotc/core/Denotations.scala b/compiler/src/dotty/tools/dotc/core/Denotations.scala index 84ef94687b13..fdf6bf265096 100644 --- a/compiler/src/dotty/tools/dotc/core/Denotations.scala +++ b/compiler/src/dotty/tools/dotc/core/Denotations.scala @@ -1299,9 +1299,9 @@ object Denotations { } /** The current denotation of the static reference given by path, - * or a MissingRef or NoQualifyingRef instance, if it does not exist. - * if generateStubs is set, generates stubs for missing top-level symbols - */ + * or a MissingRef or NoQualifyingRef instance, if it does not exist. + * if generateStubs is set, generates stubs for missing top-level symbols + */ def staticRef(path: Name, generateStubs: Boolean = true, isPackage: Boolean = false)(using Context): Denotation = { def select(prefix: Denotation, selector: Name): Denotation = { val owner = prefix.disambiguate(_.info.isParameterless) diff --git a/compiler/src/dotty/tools/dotc/core/Phases.scala b/compiler/src/dotty/tools/dotc/core/Phases.scala index 603328d18d44..dba638ca13d6 100644 --- a/compiler/src/dotty/tools/dotc/core/Phases.scala +++ b/compiler/src/dotty/tools/dotc/core/Phases.scala @@ -462,15 +462,14 @@ object Phases { * Enrich crash messages. */ final def monitor(doing: String)(body: Context ?=> Unit)(using Context): Boolean = - val unit = ctx.compilationUnit - if ctx.run.enterUnit(unit) then + ctx.run.enterUnit(ctx.compilationUnit) + && { try {body; true} catch case NonFatal(ex) if !ctx.run.enrichedErrorMessage => - report.echo(ctx.run.enrichErrorMessage(s"exception occurred while $doing $unit")) + report.echo(ctx.run.enrichErrorMessage(s"exception occurred while $doing ${ctx.compilationUnit}")) throw ex finally ctx.run.advanceUnit() - else - false + } inline def runSubPhase[T](id: Run.SubPhase)(inline body: (Run.SubPhase, Context) ?=> T)(using Context): T = given Run.SubPhase = id diff --git a/compiler/src/dotty/tools/dotc/fromtasty/TastyFileUtil.scala b/compiler/src/dotty/tools/dotc/fromtasty/TastyFileUtil.scala index bc04cc648a65..9bd3016de1f5 100644 --- a/compiler/src/dotty/tools/dotc/fromtasty/TastyFileUtil.scala +++ b/compiler/src/dotty/tools/dotc/fromtasty/TastyFileUtil.scala @@ -15,7 +15,7 @@ object TastyFileUtil { * package foo * class Foo * ``` - * then `getClassName("./out/foo/Foo.tasty") returns `Some("./out")` + * then `getClassPath("./out/foo/Foo.tasty") returns `Some("./out")` */ def getClassPath(file: AbstractFile): Option[String] = getClassName(file).map { className => @@ -37,14 +37,11 @@ object TastyFileUtil { assert(file.extension == "tasty") val bytes = file.toByteArray val names = new TastyClassName(bytes).readName() - names.map { case (packageName, className) => - val fullName = packageName match { - case EMPTY_PACKAGE => s"${className.lastPart}" - case _ => s"$packageName.${className.lastPart}" - } - fullName - } - } + names.map: (packageName, className) => + if packageName == EMPTY_PACKAGE then + s"${className.lastPart.encode}" + else + s"${packageName.encode}.${className.lastPart.encode}" } diff --git a/scaladoc-testcases/src/tests/encoded.name.scala b/scaladoc-testcases/src/tests/encoded.name.scala new file mode 100644 index 000000000000..d47bf83bfe15 --- /dev/null +++ b/scaladoc-testcases/src/tests/encoded.name.scala @@ -0,0 +1,2 @@ + +def exampleMember = "hello, world" diff --git a/scaladoc/src/scala/tasty/inspector/TastyInspector.scala b/scaladoc/src/scala/tasty/inspector/TastyInspector.scala index 14e5f019b433..47501521d612 100644 --- a/scaladoc/src/scala/tasty/inspector/TastyInspector.scala +++ b/scaladoc/src/scala/tasty/inspector/TastyInspector.scala @@ -9,7 +9,7 @@ import scala.quoted.runtime.impl.QuotesImpl import dotty.tools.dotc.Compiler import dotty.tools.dotc.Driver import dotty.tools.dotc.Run -import dotty.tools.dotc.core.Contexts.Context +import dotty.tools.dotc.core.Contexts.{Context, ctx} import dotty.tools.dotc.core.Mode import dotty.tools.dotc.core.Phases.Phase import dotty.tools.dotc.fromtasty._ @@ -69,7 +69,7 @@ object TastyInspector: override def phaseName: String = "tastyInspector" override def runOn(units: List[CompilationUnit])(using ctx0: Context): List[CompilationUnit] = - // NOTE: although this is a phase, do not expect this to be ran with an xsbti.CompileProgress + // NOTE: although this is a phase, do not expect this to be run with an xsbti.CompileProgress val ctx = QuotesCache.init(ctx0.fresh) runOnImpl(units)(using ctx)