Skip to content

Conversation

@hamzaremmal
Copy link
Member

To preserve the same source compatibility, we mark toString and hashCode as methods with empty parameter lists in all the inherited files from Scala 2. Note that I checked for other java defined methods that would qualify for this change but I couldn't find any (reviewer should double check too since we cannot fix this after 3.8.0).

Closes #19616
Supersedes #24452

@hamzaremmal hamzaremmal requested a review from a team as a code owner November 17, 2025 12:48
@hamzaremmal hamzaremmal requested a review from sjrd November 17, 2025 12:49
@hamzaremmal hamzaremmal added the backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it. label Nov 17, 2025
@hamzaremmal hamzaremmal added this to the 3.8.0 milestone Nov 17, 2025
@som-snytt
Copy link
Contributor

If Scala 3 is not going to add parens to the overriding definition, surely it should warn. Otherwise it's a gotcha forever.

I'll contribute a warning if it is deemed useful.

@hamzaremmal
Copy link
Member Author

No need for a warning, this is only to not break source compatibility and already existing macros. Scala 2 already added those parentheses for Java defined methods. This is just porting those changes only in the Scala 2 inherited files. You see that Tuple.scala didn't change this.

@sjrd I just saw that I had some unsaved changes locally that had to do with this PR, I'll include them and go over the list a second time.

@som-snytt thank you for the help!

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.

Forgotten:

  • TupleXXL.toString() and hashCode(). (I know it was always Scala 3-only, and it's not even really public, but for consistency.)

I checked all the suspects: toString, hashCode, run, call, get, apply and getClass.

@hamzaremmal
Copy link
Member Author

hamzaremmal commented Nov 18, 2025

Forgotten:

TupleXXL.toString() and hashCode(). (I know it was always Scala 3-only, and it's not even really public, but for consistency.)

It was not really forgotten, I omitted it because it is Scala 3 only and TASTy already exist for it. Isn't this a TASTy breaking change?

@sjrd
Copy link
Member

sjrd commented Nov 19, 2025

Fair enough. Maybe add a comment then, that it has no () on purpose, for historical reasons?

@hamzaremmal hamzaremmal requested a review from sjrd November 19, 2025 17:09
@hamzaremmal hamzaremmal merged commit 73bbcfe into scala:main Nov 20, 2025
83 of 84 checks passed
@hamzaremmal hamzaremmal deleted the port-tostring branch November 20, 2025 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Map.+= not a member of Map[String, String] (using scala2-library-tasty)

3 participants