scala/scala3

ScalaDoc - cannot resolve reference to type

Closed this issue · 1 comments

Compiler version

3.3.3
3.4.1-RC2

Minimized code

https://github.com/OndrejSpanel/scaladoc-cannot-resolve

The repro needs three source files. The core of the issue is:

trait Ops {
  final implicit class Ops[A](private val self: A) {
    def tap(): Unit = ()
  }
}
package object util extends Ops

There is some confusion in the class names. If the implicit class is named differently, the issue does not show.

Output

Using doc in this project prints following error:

cannot resolve reference to type demo.util.package.type.Ops
the classfile defining the type might be missing from the classpath

3.4.2-RC2 compiler reports following enriched exception (thankfully, otherwise locating the issue source would be a nightmare):

  exception occurred while readTasty class file demo.debug.Impl

  An unhandled exception was thrown in the compiler.
  Please file a crash report here:
  https://github.com/scala/scala3/issues/new/choose
  For non-enriched exceptions, compile with -Yno-enrich-error-messages.

     while compiling: class file demo.debug.Impl
        during phase: readTasty
                mode: Mode(ImplicitsEnabled,ReadPositions)
     library version: version 2.13.12
   compiler version: version 3.4.1-RC2

Note

Tool reports:

Main Scala API documentation successful.

But it was not successful, the generated ScalaDoc is incomplete. there are no HTML files created at all.

Expectation

  • code which compiles fine should not throw exception when generating docs
  • if it does, the tool should not report successful completion

Fixed in both Next and LTS (tested using 3.3.4-RC1-bin-20240706-0d787e2-NIGHTLY)