Closed
Description
Compiler version
3.1.1
Minimized code
object C:
// This code errors on publishLocal
// def retry(i: Int)(fn: => Unit): Unit =
// for i <- 0 until i do fn
// this code errors on publishLocal
// def asFuture[A](a: => A): Future[A] =
// Future { a }
// this works fine
def asFuture(a: => String): Future[String] =
Future { a }
object B:
export C.*
@main def test(): Unit =
import B.*
// retry(2)(println("abcd"))
println(asFuture("abcd"))
Output
[info] Main Scala API documentation to /home/august/prog/test-projects/extension-bug/projectB/target/scala-3.1.1/api...
[warn] -- Warning: projectB/src/main/scala/com/example/b/B.scala:18:11 ----------------
[warn] 18 | export C.*
[warn] | ^
[warn] |java.lang.ClassCastException: class dotty.tools.dotc.ast.Trees$TypeApply cannot be cast to class dotty.tools.dotc.ast.Trees$Select (dotty.tools.dotc.ast.Trees$TypeApply and dotty.tools.dotc.ast.Trees$Select are in unnamed module of loader sbt.internal.classpath.ClassLoaderCache$Key$CachedClassLoader @6602629)
[warn] | at scala.quoted.runtime.impl.QuotesImpl$reflect$SelectMethods$.name(QuotesImpl.scala:496)
[warn] | at dotty.tools.scaladoc.tasty.ClassLikeSupport.$anonfun$10(ClassLikeSupport.scala:154)
[warn] | at scala.Option.fold(Option.scala:263)
[warn] | at dotty.tools.scaladoc.tasty.ClassLikeSupport.parseMember$$anonfun$1(ClassLikeSupport.scala:154)
Expectation
This seems like a ScalaDoc issue, but I've encountered flakiness when using these extension methods in projects depending on them, although that's hard to reproduce, so maybe I'm imagining it.