Skip to content
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

Fix #14168: Do not elide fields required for Scala.js interop semantics. #16187

Merged
merged 1 commit into from
Oct 18, 2022

Conversation

sjrd
Copy link
Member

@sjrd sjrd commented Oct 14, 2022

No description provided.

@sjrd sjrd force-pushed the sjs-mandatory-fields branch 3 times, most recently from ecf4e9f to 1b9b1cb Compare October 14, 2022 16:19
* the call site introduces an explicit `BoxedUnit.UNIT`. Even if the
* field has not been initialized at all (with `= _`), this results in
* an actual `()` value.
* In Scala 3, the same pattern returns `null`, as a `BoxedUnit`, so we
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we instead change the behavior of Scala 3? We already have some logic for "unboxing" nulls from value classes: https://github.com/lampepfl/dotty/blob/3636ee6d0fda29daf9ef6e4e0491e2e504b227ed/compiler/src/dotty/tools/dotc/transform/Erasure.scala#L292-L317

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot change it without breaking binary compatibility ;)

@sjrd sjrd force-pushed the sjs-mandatory-fields branch from 1b9b1cb to 49b7cda Compare October 18, 2022 15:22
@sjrd sjrd enabled auto-merge October 18, 2022 15:30
@sjrd sjrd merged commit 96d4ccd into scala:main Oct 18, 2022
@sjrd sjrd deleted the sjs-mandatory-fields branch October 18, 2022 16:40
@xerial
Copy link
Contributor

xerial commented Oct 18, 2022

Thanks, @sjrd for fixing this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants