Skip to content

Dottydoc fails to read scala.scalajs.js.Promise.then symbol in 3.1.0 and 3.0.2 #14143

Closed
@raquo

Description

@raquo

This seems similar to #11943 but that issue was closed a while ago saying that "this should be fixed in 3.0.1-RC1 / sbt 1.5.3". I use higher versions than those, but I'm still running into it (or a separate, similar issue).

Compiler version

Scala 3.0.2
Scala.js 1.8.0
sbt 1.5.3, 1.5.7, 1.6.0-RC2

Minimized example

def p: js.Promise[A] = ???
def onFulfilled: js.Function1[A, Unit | js.Thenable[Unit]] = ???
def onRejected: js.Function1[Any, Unit | scala.scalajs.js.Thenable[Unit]] = ???

p.`then`[Unit](
  onFulfilled,
  js.defined(onRejected)
)

Output

sbt doc:

[info] Setting Scala version to 3.0.2 on 1 projects.
[info] Reapplying settings...
[info] set current project to Airstream (in build file:/.../airstream/)
[info] compiling 1 Scala source to /.../airstream/target/scala-3.0.2/classes ...
[info] Main Scala API documentation to /.../airstream/target/scala-3.0.2/api...
[info] Skipping unused scalacOptions: -language, -scalajs-mapSourceURI
[error] -- Error: src/main/scala/com/raquo/airstream/timing/JsPromiseEventStream.scala:57:6
[error] 57 |      p.`then`[Unit](
[error]    |      ^^^^^^^^^^^^^
[error]    |undefined: p.then # -1: TermRef(AppliedType(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class scalajs)),object js),class Promise),List(TypeRef(ThisType(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class airstream)),object timing),class JsPromiseEventStream)),type A))),then) at readTasty
[error] one error found
[error] (Compile / doc) DottyDoc Compilation Failed
[error] Total time: 2 s, completed Dec. 20, 2021, 12:17:22 a.m.

Expectation

Since the code compiles, it should be doc-ed without error. Scala 2.13.7 produces no error.

EDIT: original text of the issue had a bit of mismatch between two test runs, I fixed it now.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions