Skip to content

Commit e9eab1a

Browse files
committed
Revert "Inline _N case class product members under -Yscala2-stdlib"
These product members are only in the bytecode. This reverts commit 8c58cbf.
1 parent 0749271 commit e9eab1a

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

compiler/src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -637,10 +637,7 @@ object desugar {
637637
// new C[...](p1, ..., pN)(moreParams)
638638
val (caseClassMeths, enumScaffolding) = {
639639
def syntheticProperty(name: TermName, tpt: Tree, rhs: Tree) =
640-
val mods =
641-
if ctx.settings.Yscala2Stdlib.value then synthetic | Inline
642-
else synthetic
643-
DefDef(name, Nil, tpt, rhs).withMods(mods)
640+
DefDef(name, Nil, tpt, rhs).withMods(synthetic)
644641

645642
def productElemMeths =
646643
val caseParams = derivedVparamss.head.toArray

project/MiMaFilters.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,12 @@ object MiMaFilters {
155155
// Companion module class: Missing type java.io.Serializable
156156
ProblemFilters.exclude[MissingTypesProblem]("scala.*$"),
157157

158+
// Case class product accessors
159+
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.*._1"),
160+
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.*._2"),
161+
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.*._3"),
162+
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.*._4"),
163+
158164
// abstract method elemTag()scala.reflect.ClassTag in class scala.collection.mutable.ArraySeq does not have a correspondent in other version
159165
ProblemFilters.exclude[DirectAbstractMethodProblem]("scala.collection.immutable.ArraySeq.elemTag"),
160166
ProblemFilters.exclude[DirectAbstractMethodProblem]("scala.collection.mutable.ArraySeq.elemTag"),

stdlib-bootstrapped/test/Main.scala

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ object HelloWorld:
1515

1616
testScala2UnapplySignatures()
1717
testScala2ObjectParents()
18-
testScala2ProductMembers()
1918
}
2019

2120
def testScala2UnapplySignatures() = {
@@ -32,11 +31,3 @@ object HelloWorld:
3231
assert(!typeChecks("Either: scala.deriving.Mirror.Sum"))
3332
assert(!typeChecks("Either: scala.deriving.Mirror"))
3433
}
35-
def testScala2ProductMembers() = {
36-
Some(1)._1
37-
Right(1)._1
38-
(1, 2)._1
39-
(1, 2)._2
40-
::(1, Nil)._1
41-
::(1, Nil)._2
42-
}

0 commit comments

Comments
 (0)