Skip to content

Commit 3ce94b2

Browse files
committed
Document Xsource-features:double-definitions
1 parent 860b588 commit 3ce94b2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

_overviews/scala3-migration/tooling-scala2-xsource3.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ The following table shows backported Scala 3 language semantics available in `-X
105105
| `case-apply-copy-access`: modifiers of synthetic methods | fatal warning | constructor modifiers are used for apply / copy methods of case classes |
106106
| `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 |
107107
| `infer-override`: override type inference | fatal warning | inferred type of member uses type of overridden member |
108+
| `double-definitions`: definitions differing in empty parens <sup>2</sup> | fatal warning | double definition error |
108109

109110
Example 1:
110111

@@ -114,9 +115,17 @@ Example 1:
114115
+ 2
115116
{% endhighlight %}
116117

118+
Example 2:
119+
120+
{% highlight scala %}
121+
class C(x: Int) {
122+
def x(): Int = x // allowed in Scala 2, double definition error in Scala 3
123+
}
124+
{% endhighlight %}
125+
117126
### Changes affecting binary encoding
118127

119-
As of Scala 2.13.14, there are 3 changes in `-Xsource-features` that affect binary encoding of classfiles:
128+
As of Scala 2.13.15, there are 3 changes in `-Xsource-features` that affect binary encoding of classfiles:
120129

121130
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.
122131
1. `case-companion-function`: the synthetic companion objects of case classes no longer extend `FunctionN`.

0 commit comments

Comments
 (0)