Skip to content

Add explicit types to stdlib bootstrapped #18032

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

nicolasstucki
Copy link
Contributor

No description provided.

@nicolasstucki nicolasstucki self-assigned this Jun 21, 2023
@nicolasstucki nicolasstucki force-pushed the add-explicit-types-to-stdlib-bootstrapped branch from 6369906 to 4a342e1 Compare June 22, 2023 08:00
@nicolasstucki nicolasstucki marked this pull request as ready for review June 22, 2023 14:31
@nicolasstucki nicolasstucki requested a review from sjrd June 22, 2023 14:31
@nicolasstucki nicolasstucki assigned sjrd and unassigned nicolasstucki Jun 22, 2023
Copy link
Member

@sjrd sjrd left a comment

Choose a reason for hiding this comment

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

I'm not comfortable with having copies of such giant files in this repo, only for tiny, surgical changes. The upstream sources will inevitably change, and then who is going to track those changes and re-apply them here?

IMO we should upstream the necessary changes, then wait for the next release of Scala 2.13. In the meantime, we can keep ignoring them with tasty-mima filters.

@@ -173,7 +173,7 @@ object ManifestFactory {

@SerialVersionUID(1L)
final private[reflect] class ByteManifest extends AnyValManifest[scala.Byte]("Byte") {
def runtimeClass = java.lang.Byte.TYPE
def runtimeClass: Class[java.lang.Byte] = java.lang.Byte.TYPE
Copy link
Member

Choose a reason for hiding this comment

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

This is annoying because it is not actually correct. The Java signature of Byte.TYPE says it returns a Class<java.lang.Byte>, but it actually returns the class for the primitive type byte. In Scala, that should be typed as Class[scala.Byte] instead.

Since this lives in a private[reflect] class, I suggest we keep ignoring it for now, and instead send a patch upstream to declare it as

Suggested change
def runtimeClass: Class[java.lang.Byte] = java.lang.Byte.TYPE
def runtimeClass: Class[_] = java.lang.Byte.TYPE

The same applies to all the other changes in this file.

@nicolasstucki
Copy link
Contributor Author

I will change this directly in Scala 2.

nicolasstucki added a commit to nicolasstucki/scala that referenced this pull request Jun 26, 2023
Add explicit result type to methods where Scala 2 and Scala 3 disagree
with the inferred type. The aim is to have the same type in the Scala 2
pickles and the Scala 3 TASTy.

Follow up of scala#10435

These where identified in and tested in
  * scala/scala3#18032
  * scala/scala3#18029
  * scala/scala3#17975 (BitSet)
hamzaremmal pushed a commit to hamzaremmal/scala3 that referenced this pull request May 2, 2025
Add explicit result type to methods where Scala 2 and Scala 3 disagree
with the inferred type. The aim is to have the same type in the Scala 2
pickles and the Scala 3 TASTy.

Follow up of scala/scala#10435

These where identified in and tested in
  * scala#18032
  * scala#18029
  * scala#17975 (BitSet)
hamzaremmal pushed a commit that referenced this pull request May 7, 2025
Add explicit result type to methods where Scala 2 and Scala 3 disagree
with the inferred type. The aim is to have the same type in the Scala 2
pickles and the Scala 3 TASTy.

Follow up of scala/scala#10435

These where identified in and tested in
  * #18032
  * #18029
  * #17975 (BitSet)
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.

2 participants