-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Scala.js: Various JS interop fixes #9763
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
Conversation
Normally, annotations applied to a class have no business being replicated on a synthetic companion object. One exception was the `@alpha` method, which is supposed to apply as well. Instead of trying to identify those annotations without the symbols during `Desugar`, we change `erasedName` to go look on the companion class of synthetic module classes.
The `PrepJSInterop` phase is responsible for: * Performing all kinds of Scala.js-specific compile-time checks, and emitting the appropriate compile errors. * Perform some transformations that are necessary for JavaScript interop, notably generating exports forwarders. This commit ports all the functionality of `PrepJSInterop` from Scala 2, except the following: * Handling of `scala.Enumeration`s: it is unclear whether we still want to support that in the core, or if it should be handled by an optional compiler plugin in the future. * Exports: they will be done later. * Warnings about duplicate fields in `js.Dynamic.literal`: mostly because they are non-essential. The test cases are ported from the Scala.js compiler tests.
This is a forward port of the upstream commit scala-js/scala-js@3c3b100 We now require the option `-scalajs-genStaticForwardersForNonTopLevelObjects` to emit static forwarders for non-top-level objects. In addition, we take `-XnoForwarders` into account, which we were erroneously not doing before.
This is a forward port of the upstream commit scala-js/scala-js@6c82635 Since dotc does not support warning suppression yet, we use a regular warning to report when we avoid emitting static forwarders.
And enable a number of tests that have been updated upstream to be compatible with dotty.
This is a forward port of the back-end changes in the upstream commit scala-js/scala-js@a1a27f2
This is very important, as it prevents `SelectStatic` from creating dangling references to global scope objects. Such dangling references are invalid and trigger an error in the back-end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, and thank you for opening this PR! 🎉
All contributors have signed the CLA, thank you! ❤️
Commit Messages
We want to keep history, but for that to actually be useful we have
some rules on how to format our commit messages (relevant xkcd).
Please stick to these guidelines for commit messages:
- Separate subject from body with a blank line
- When fixing an issue, start your commit message with
Fix #<ISSUE-NBR>:
- Limit the subject line to 72 characters
- Capitalize the subject line
- Do not end the subject line with a period
- Use the imperative mood in the subject line ("Add" instead of "Added")
- Wrap the body at 80 characters
- Use the body to explain what and why vs. how
adapted from https://chris.beams.io/posts/git-commit
Have an awesome day! ☀️
Oops. I created this PR from the wrong branch. This is superseded by #9767. |
Depends on
#9758 and#9725.