Skip to content

Commit 166398c

Browse files
committed
Add missing Case flag on Scala 2 library unapply
1 parent e892362 commit 166398c

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ jobs:
143143
./project/scripts/sbt ";sjsSandbox/run ;sjsSandbox/test ;sjsJUnitTests/test ;set sjsJUnitTests/scalaJSLinkerConfig ~= switchToESModules ;sjsJUnitTests/test ;sjsCompilerTests/test"
144144
145145
- name: Test with Scala 2 library TASTy (fast)
146-
run: ./project/scripts/sbt ";set ThisBuild/Build.useScala2LibraryTasty := true ;scala3-bootstrapped/testCompilation i5" # only test a subset of test to avoid doubling the CI execution time
146+
run: ./project/scripts/sbt ";set ThisBuild/Build.useScala2LibraryTasty := true ;scala3-bootstrapped/testCompilation i5; scala3-bootstrapped/testCompilation tests/run/typelevel-peano.scala; scala3-bootstrapped/testOnly dotty.tools.backend.jvm.DottyBytecodeTests" # only test a subset of test to avoid doubling the CI execution time
147147

148148

149149
test_scala2_library_tasty:

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,13 +805,16 @@ object desugar {
805805
else if caseClassInScala2Library then scala2LibCompatUnapplyRhs(unapplyParam.name)
806806
else Ident(unapplyParam.name)
807807
val unapplyResTp = if (arity == 0) Literal(Constant(true)) else TypeTree()
808+
val unapplyMods =
809+
if ctx.settings.YcompileScala2Library.value then synthetic | Case
810+
else synthetic
808811

809812
DefDef(
810813
methName,
811814
joinParams(derivedTparams, (unapplyParam :: Nil) :: Nil),
812815
unapplyResTp,
813816
unapplyRHS
814-
).withMods(synthetic)
817+
).withMods(unapplyMods)
815818
}
816819
val toStringMeth =
817820
DefDef(nme.toString_, Nil, TypeTree(), Literal(Constant(className.toString))).withMods(Modifiers(Override | Synthetic))

compiler/test/dotty/tools/backend/jvm/DottyBytecodeTests.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,7 @@ class DottyBytecodeTests extends DottyBytecodeTest {
10581058
TypeOp(CHECKCAST, "scala/collection/immutable/$colon$colon"),
10591059
VarOp(ASTORE, 3),
10601060
VarOp(ALOAD, 3),
1061-
Invoke(INVOKEVIRTUAL, "scala/collection/immutable/$colon$colon", "next$access$1", "()Lscala/collection/immutable/List;", false),
1061+
Invoke(INVOKEVIRTUAL, "scala/collection/immutable/$colon$colon", "next", "()Lscala/collection/immutable/List;", false),
10621062
VarOp(ASTORE, 4),
10631063
VarOp(ALOAD, 3),
10641064
Invoke(INVOKEVIRTUAL, "scala/collection/immutable/$colon$colon", "head", "()Ljava/lang/Object;", false),
@@ -1112,7 +1112,7 @@ class DottyBytecodeTests extends DottyBytecodeTest {
11121112
Invoke(INVOKESTATIC, "scala/runtime/BoxesRunTime", "unboxToInt", "(Ljava/lang/Object;)I", false),
11131113
VarOp(ISTORE, 4),
11141114
VarOp(ALOAD, 3),
1115-
Invoke(INVOKEVIRTUAL, "scala/collection/immutable/$colon$colon", "next$access$1", "()Lscala/collection/immutable/List;", false),
1115+
Invoke(INVOKEVIRTUAL, "scala/collection/immutable/$colon$colon", "next", "()Lscala/collection/immutable/List;", false),
11161116
VarOp(ASTORE, 5),
11171117
Op(ICONST_1),
11181118
VarOp(ILOAD, 4),

0 commit comments

Comments
 (0)