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

Document Xsource-features:double-definitions #3059

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion _overviews/scala3-migration/tooling-scala2-xsource3.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ The following table shows backported Scala 3 language semantics available in `-X
| `case-apply-copy-access`: modifiers of synthetic methods | fatal warning | constructor modifiers are used for apply / copy methods of case classes |
| `case-companion-function`: companions are Functions | fatal warning at use site | synthetic case companion objects no longer extend FunctionN, but are adapted at use site with warning |
| `infer-override`: override type inference | fatal warning | inferred type of member uses type of overridden member |
| `double-definitions`: definitions differing in empty parens <sup>2</sup> | fatal warning | double definition error |

Example 1:

Expand All @@ -114,9 +115,17 @@ Example 1:
+ 2
{% endhighlight %}

Example 2:

{% highlight scala %}
class C(x: Int) {
def x(): Int = x // allowed in Scala 2, double definition error in Scala 3
}
{% endhighlight %}

### Changes affecting binary encoding

As of Scala 2.13.14, there are 3 changes in `-Xsource-features` that affect binary encoding of classfiles:
As of Scala 2.13.15, there are 3 changes in `-Xsource-features` that affect binary encoding of classfiles:
Copy link
Member

Choose a reason for hiding this comment

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

is this change intentional?

Copy link
Member

Choose a reason for hiding this comment

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

Yes — this PR will be merged at the time we release 2.13.15 (probably this week).

Copy link
Member

Choose a reason for hiding this comment

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

But the "Changes affecting binary encoding" section is already online (https://docs.scala-lang.org/scala3/guides/migration/tooling-scala2-xsource3.html#changes-affecting-binary-encoding). Or was that section added too soon and not part of 2.13.14 ?

Copy link
Member

@SethTisue SethTisue Aug 18, 2024

Choose a reason for hiding this comment

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

Oh, okay, now I see what you mean. 2.13.15 doesn't add any new changes affecting binary encoding. So bumping the version number is only intended to indicate that the information hasn't fallen out date, it is still accurate for 2.13.15.


1. `case-apply-copy-access`: the constructor modifiers of case classes (`case class C private[p] (x: Int)`) are copied to the synthetic `apply` and `copy` methods.
1. `case-companion-function`: the synthetic companion objects of case classes no longer extend `FunctionN`.
Expand Down