Skip to content

Commit 651bbdb

Browse files
committed
Merge pull request scala#2299 from retronym/ticket/7294
SI-7294 Towards finality for TupleN
2 parents 1187c98 + da8d7c2 commit 651bbdb

34 files changed

+60
-8
lines changed

src/build/genprod.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ class Tuple(val i: Int) extends Group("Tuple") with Arity {
319319
* @constructor Create a new tuple with {i} elements.{idiomatic}
320320
{params}
321321
*/
322+
@deprecatedInheritance("Tuples will be made final in a future version.", "2.11.0")
322323
case class {className}{covariantArgs}({fields})
323324
extends {Product.className(i)}{invariantArgs}
324325
{{

src/compiler/scala/tools/cmd/gen/Codegen.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ object Codegen {
2323
return println (CodegenSpec.helpMsg)
2424

2525
val out = outDir getOrElse { return println("--out is required.") }
26-
val all = genall || (!anyvals && !products)
26+
val all = genall || !anyvals
2727

2828
echo("Generating sources into " + out)
2929

src/compiler/scala/tools/cmd/gen/CodegenSpec.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,9 @@ trait CodegenSpec extends Spec with Meta.StdOpts with Interpolation {
1414

1515
help("Usage: codegen [<options>]")
1616

17-
// val inDir = "in" / "directory containing templates" --^ ExistingDir
1817
val outDir = "out" / "directory for generated files" --^ ExistingDir
19-
// val install = "install" / "write source files directly to src/library/scala"
2018
val anyvals = "anyvals" / "generate sources for AnyVal types" --?
21-
val products = "products" / "generate sources for ProductN, FunctionN, etc." --?
2219
val genall = "all" / "generate sources for everything" --?
23-
val stamp = "stamp" / "add a timestamp to the generated files" --?
2420
}
2521

2622
object CodegenSpec extends CodegenSpec with Reference {

src/compiler/scala/tools/nsc/typechecker/Checkable.scala

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,18 @@ trait Checkable {
195195
* so I will consult with moors about the optimal time to be doing this.
196196
*/
197197
def areIrreconcilableAsParents(sym1: Symbol, sym2: Symbol): Boolean = areUnrelatedClasses(sym1, sym2) && (
198-
sym1.initialize.isEffectivelyFinal // initialization important
199-
|| sym2.initialize.isEffectivelyFinal
198+
isEffectivelyFinal(sym1) // initialization important
199+
|| isEffectivelyFinal(sym2)
200200
|| !sym1.isTrait && !sym2.isTrait
201201
|| sym1.isSealed && sym2.isSealed && allChildrenAreIrreconcilable(sym1, sym2) && !currentRun.compiles(sym1) && !currentRun.compiles(sym2)
202202
)
203+
private def isEffectivelyFinal(sym: Symbol): Boolean = (
204+
// initialization important
205+
sym.initialize.isEffectivelyFinal || (
206+
settings.future.value && isTupleSymbol(sym) // SI-7294 step into the future and treat TupleN as final.
207+
)
208+
)
209+
203210
def isNeverSubClass(sym1: Symbol, sym2: Symbol) = areIrreconcilableAsParents(sym1, sym2)
204211

205212
private def isNeverSubArgs(tps1: List[Type], tps2: List[Type], tparams: List[Symbol]): Boolean = /*logResult(s"isNeverSubArgs($tps1, $tps2, $tparams)")*/ {

src/library/scala/Function0.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
** |/ **
77
\* */
88
// GENERATED CODE: DO NOT EDIT.
9-
// genprod generated these sources at: Tue Aug 07 11:54:44 CEST 2012
9+
// genprod generated these sources at: Sun Mar 24 14:14:12 CET 2013
1010

1111
package scala
1212

src/library/scala/Tuple1.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ package scala
1515
* @constructor Create a new tuple with 1 elements.
1616
* @param _1 Element 1 of this Tuple1
1717
*/
18+
@deprecatedInheritance("Tuples will be made final in a future version.", "2.11.0")
1819
case class Tuple1[@specialized(Int, Long, Double) +T1](_1: T1)
1920
extends Product1[T1]
2021
{

src/library/scala/Tuple10.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ package scala
2424
* @param _9 Element 9 of this Tuple10
2525
* @param _10 Element 10 of this Tuple10
2626
*/
27+
@deprecatedInheritance("Tuples will be made final in a future version.", "2.11.0")
2728
case class Tuple10[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9, _10: T10)
2829
extends Product10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]
2930
{

src/library/scala/Tuple11.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ package scala
2525
* @param _10 Element 10 of this Tuple11
2626
* @param _11 Element 11 of this Tuple11
2727
*/
28+
@deprecatedInheritance("Tuples will be made final in a future version.", "2.11.0")
2829
case class Tuple11[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9, _10: T10, _11: T11)
2930
extends Product11[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11]
3031
{

src/library/scala/Tuple12.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ package scala
2626
* @param _11 Element 11 of this Tuple12
2727
* @param _12 Element 12 of this Tuple12
2828
*/
29+
@deprecatedInheritance("Tuples will be made final in a future version.", "2.11.0")
2930
case class Tuple12[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9, _10: T10, _11: T11, _12: T12)
3031
extends Product12[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12]
3132
{

src/library/scala/Tuple13.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ package scala
2727
* @param _12 Element 12 of this Tuple13
2828
* @param _13 Element 13 of this Tuple13
2929
*/
30+
@deprecatedInheritance("Tuples will be made final in a future version.", "2.11.0")
3031
case class Tuple13[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9, _10: T10, _11: T11, _12: T12, _13: T13)
3132
extends Product13[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13]
3233
{

0 commit comments

Comments
 (0)