Skip to content

-from-tasty compilation fails on correct scala.js code #14178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pikinier20 opened this issue Dec 28, 2021 · 3 comments
Closed

-from-tasty compilation fails on correct scala.js code #14178

pikinier20 opened this issue Dec 28, 2021 · 3 comments
Assignees
Labels
area:tasty-format issues relating to TASTy as a portable standard itype:bug

Comments

@pikinier20
Copy link
Contributor

Compiler version

Newest master - c94b333
The bug occurs also on 3.1.0

Minimized code

import scala.scalajs.js

trait Foo[A] {
    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

For command:
~/dotty/dist/target/pack/bin/scalac -scalajs -from-tasty target/scala-3.1.2-RC1-bin-SNAPSHOT/classes/Foo.tasty

-- Error: src/main/scala/test2.scala:8:4 ---------------------------------------
8 |    p.`then`[Unit](
  |    ^^^^^^^^^^^^^
  |undefined: this.p.then # -1: TermRef(AppliedType(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class scalajs)),object js),Promise),List(TypeRef(ThisType(TypeRef(ThisType(TypeRef(ThisType(TypeRef(NoPrefix,module class <root>)),module class <empty>)),trait Foo)),type A))),then) at readTasty
-- Error: src/main/scala/test2.scala:10:4 --------------------------------------
10 |    js.defined(onRejected)
   |    ^^^^^^^^^^
   |undefined: scala.scalajs.js.defined.apply # -1: TermRef(TermRef(TermRef(ThisType(TypeRef(NoPrefix,module class scalajs)),object js),defined),apply) at readTasty
2 errors found

Expectation

The same as for standard compilation which passes.

@smarter
Copy link
Member

smarter commented Dec 28, 2021

Does this also happen if you add scalajs-library_2.13 to the classpath?

@pikinier20
Copy link
Contributor Author

No, it doesn't. So probably somehow the library is missing in classpath argument passed to Scaladoc

@pikinier20
Copy link
Contributor Author

Okey, there's no bug. I realized that it might be related to sbt version since we've made some changes in scalacOptions resolution for doc task. The problem is gone on sbt 1.5.3+ since from this version the -scalajs flag is passed to Scaladoc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:tasty-format issues relating to TASTy as a portable standard itype:bug
Projects
None yet
Development

No branches or pull requests

3 participants