Skip to content

Commit 4f681a1

Browse files
committed
Add missing Case flag on Scala 2 library unapply
1 parent 7271cac commit 4f681a1

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ jobs:
144144
./project/scripts/sbt ";sjsSandbox/run ;sjsSandbox/test ;sjsJUnitTests/test ;set sjsJUnitTests/scalaJSLinkerConfig ~= switchToESModules ;sjsJUnitTests/test ;sjsCompilerTests/test"
145145
146146
- name: Test with Scala 2 library TASTy (fast)
147-
run: ./project/scripts/sbt ";set ThisBuild/Build.useScala2LibraryTasty := true ;scala3-bootstrapped/testCompilation i5; scala3-bootstrapped/testCompilation tests/run/typelevel-peano.scala" # only test a subset of test to avoid doubling the CI execution time
147+
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
148148

149149
test_scala2_library_tasty:
150150
runs-on: [self-hosted, Linux]

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))

0 commit comments

Comments
 (0)