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

Do not skip extension methods. #144

Merged
merged 1 commit into from
Nov 23, 2016
Merged

Conversation

szeiger
Copy link
Contributor

@szeiger szeiger commented Nov 21, 2016

They are classified as “has a synthetic name” (i.e. contains a “$”) but
regular use of these methods generates calls to the names from other
compilation units.

Fixes #135.

They are classified as “has a synthetic name” (i.e. contains a “$”) but
regular use of these methods generates calls to the names from other
compilation units.

Fixes lightbend-labs#135.
@dwijnand
Copy link
Collaborator

Thanks for looking into this @szeiger!

Copy link
Contributor

@ktoso ktoso left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @szeiger !

@@ -0,0 +1 @@
extension method c$extension(java.lang.String,Int)Unit in object A#B does not have a correspondent in new version
Copy link
Contributor

Choose a reason for hiding this comment

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

So is there a way of making such change in a compatible way..?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, I don't think so. Adding additional overloads should be fine but not adding a first overload.

The $extension methods get an appended number for disambiguation (see https://github.com/scala/scala/blob/9c5d3f81a667917b6a3aed5098182623c417c137/src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala#L30-L38). It is not clear to me from that comment why we need to do this. The signature is the same as the one of the trait method, so I would expect that we can safely overload it in the same way.

Even if we cannot, perhaps we should use $extension0 instead of $extension for the non-overloaded case?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, a change in how extension methods are encoded such that overloads are binary compatible would be hugely beneficial.

@szeiger szeiger merged commit 4f62c2e into lightbend-labs:master Nov 23, 2016
@szeiger szeiger deleted the issue/135 branch November 23, 2016 11:51
@SethTisue SethTisue added this to the 0.1.12 milestone Nov 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants