-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Correct Java signature for value classes appearing in type arguments #8127
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Value class values are always boxed when used in a generic context. Specifically, in val foo: Option[VC] = Some(vc) the runtime value of `foo` will be a `Some` wrapping a value of the (boxed) class `VC`. This is analogous to what happens with primitive value classes in this situation. Renamed `primitiveOK` to imply that it affects the signature generated for any value class, not just primitives. Fixes scala/bug#11321.
dwijnand
approved these changes
Jun 13, 2019
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.
This fixes a false negative in today's MiMa: lightbend-labs/mima#313.
👍 from me
lrytz
approved these changes
Jun 27, 2019
Thanks! |
Thank you! |
jtjeferreira
added a commit
to jtjeferreira/scala3
that referenced
this pull request
Jun 19, 2024
As suggested in scala#10846 the fix to this issue should be to port scala/scala#8127 to scala3
lrytz
added a commit
to scala/scala3
that referenced
this pull request
Jun 20, 2024
…20463) As suggested in #10846 the fix to this issue should be to port scala/scala#8127 to scala3 I started by adding the same tests as in the scala2 PR and then tried to find the place where to do the fix by adding some log traces. Unfortunately I am still pretty lost because this is my first time looking at the compiler code. Any tips where this needs to be fixed are very welcome. Meanwhile a few questions: * The scala2 fix was done in `src/compiler/scala/tools/nsc/transform/Erasure.scala`, should I do the fix for scala3 in `compiler/src/dotty/tools/dotc/transform/Erasure.scala` as well? * I think I need to do the fix around `ErasedValueType`, either when it is created (in `TypeErasure#eraseDerivedValueClass`) or when it is used (in `Erasure#unbox`). Please also send me any pointers besides https://dotty.epfl.ch/docs/contributing/index.html regarding compiler contributions
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Value class values are always boxed when used in a generic context.
Specifically, in
the runtime value of
foo
will be aSome
wrapping a value of the (boxed) classVC
. This is analogous to what happens with primitive value classes in this situation.Renamed
primitiveOK
to imply that it affects the signature generated for any value class, not just primitives.Fixes scala/bug#11321.