Skip to content

Commit edc13a8

Browse files
committed
Drop support for Scala 2.12.{2-5}.
These were the 2.12.x versions for which we still had some custom code paths, workarounds or exceptions lying around. Scala 2.12.2 and 2.12.3 exhibited compiler crashes on recent changes in the linker, which triggered this decision.
1 parent 98e0875 commit edc13a8

File tree

15 files changed

+17
-746
lines changed

15 files changed

+17
-746
lines changed

Jenkinsfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -546,9 +546,6 @@ allJavaVersions << mainJavaVersion
546546
def mainScalaVersion = "2.12.19"
547547
def mainScalaVersions = ["2.12.19", "2.13.13"]
548548
def otherScalaVersions = [
549-
"2.12.2",
550-
"2.12.3",
551-
"2.12.5",
552549
"2.12.6",
553550
"2.12.7",
554551
"2.12.8",

compiler/src/main/scala/org/scalajs/nscplugin/CompatComponent.scala

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,6 @@ trait CompatComponent {
7171

7272
lazy val DottyEnumSingletonCompat = AttachmentsCompat.Inner.DottyEnumSingletonAlias
7373

74-
implicit final class SAMFunctionCompatOps(self: SAMFunction) {
75-
// Introduced in 2.12.5 to synthesize bridges in LMF classes
76-
def synthCls: Symbol = NoSymbol
77-
}
78-
7974
/* global.genBCode.bTypes.initializeCoreBTypes()
8075
* Early 2.12.x versions require that this method be called from
8176
* GenJSCode.run(), but it disappeared later in the 2.12.x series.

compiler/src/main/scala/org/scalajs/nscplugin/GenJSCode.scala

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6605,16 +6605,10 @@ abstract class GenJSCode[G <: Global with Singleton](val global: G)
66056605

66066606
/* scala/bug#10512: any methods which `samInfo.sam` overrides need
66076607
* bridges made for them.
6608-
* On Scala < 2.12.5, `synthCls` is polyfilled to `NoSymbol` and hence
6609-
* `samBridges` will always be empty. This causes our compiler to be
6610-
* bug-compatible on these versions.
66116608
*/
6612-
val synthCls = samInfo.synthCls
6613-
val samBridges = if (synthCls == NoSymbol) {
6614-
Nil
6615-
} else {
6609+
val samBridges = {
66166610
import scala.reflect.internal.Flags.BRIDGE
6617-
synthCls.info.findMembers(excludedFlags = 0L, requiredFlags = BRIDGE).toList
6611+
samInfo.synthCls.info.findMembers(excludedFlags = 0L, requiredFlags = BRIDGE).toList
66186612
}
66196613

66206614
for (sam <- samInfo.sam :: samBridges) {

compiler/src/test/scala/org/scalajs/nscplugin/test/JSInteropTest.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4419,10 +4419,6 @@ class JSInteropTest extends DirectTest with TestHelpers {
44194419

44204420
val postUnarySpace = {
44214421
val hasNoSpace = {
4422-
version == "2.12.2" ||
4423-
version == "2.12.3" ||
4424-
version == "2.12.4" ||
4425-
version == "2.12.5" ||
44264422
version == "2.12.6" ||
44274423
version == "2.12.7" ||
44284424
version == "2.12.8" ||

compiler/src/test/scala/org/scalajs/nscplugin/test/StaticForwardersWarningsTopLevelOnlyTest.scala

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,6 @@ class StaticForwardersWarningsTopLevelOnlyTest extends DirectTest with TestHelpe
2424

2525
@Test
2626
def warnWhenAvoidingStaticForwardersForTopLevelObject: Unit = {
27-
val jvmBackendIssuesWarningOfItsOwn = {
28-
scalaVersion != "2.12.2" &&
29-
scalaVersion != "2.12.3" &&
30-
scalaVersion != "2.12.4"
31-
}
32-
val jvmBackendMessage = if (!jvmBackendIssuesWarningOfItsOwn) {
33-
""
34-
} else {
35-
"""
36-
|newSource1.scala:4: warning: Generated class a differs only in case from A.
37-
| Such classes will overwrite one another on case-insensitive filesystems.
38-
| object a {
39-
| ^
40-
"""
41-
}
42-
4327
"""
4428
class A
4529
@@ -50,7 +34,11 @@ class StaticForwardersWarningsTopLevelOnlyTest extends DirectTest with TestHelpe
5034
s"""
5135
|newSource1.scala:4: warning: Not generating the static forwarders of a because its name differs only in case from the name of another class or trait in this compilation unit.
5236
| object a {
53-
| ^$jvmBackendMessage
37+
| ^
38+
|newSource1.scala:4: warning: Generated class a differs only in case from A.
39+
| Such classes will overwrite one another on case-insensitive filesystems.
40+
| object a {
41+
| ^
5442
"""
5543
}
5644

ir/shared/src/main/scala/org/scalajs/ir/Trees.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ import Position.NoPosition
2020
import Types._
2121

2222
object Trees {
23-
/* The case classes for IR Nodes are sealed instead of final because making
24-
* them final triggers bugs with Scala 2.12.{1-4}, in combination
25-
* with their `implicit val pos`.
23+
/* The case classes for IR Nodes are sealed instead of final for historical
24+
* reasons. Making them final used to trigger bugs with Scala 2.12.{1-4}, in
25+
* combination with their `implicit val pos`.
26+
* TODO Now that we dropped support for Scala 2.12.5 and below, we should
27+
* revisit this.
2628
*/
2729

2830
/** Base class for all nodes in the IR.

linker/shared/src/main/scala/org/scalajs/linker/backend/javascript/Trees.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ import org.scalajs.ir.OriginalName.NoOriginalName
2222
import org.scalajs.ir.Position.NoPosition
2323

2424
object Trees {
25-
/* The case classes for JS Trees are sealed instead of final because making
26-
* them final triggers bugs with 2.12.{1-4}, in combination
27-
* with their `implicit val pos`.
25+
/* The case classes for JS Trees are sealed instead of final for historical
26+
* reasons. Making them final used to trigger bugs with Scala 2.12.{1-4}, in
27+
* combination with their `implicit val pos`.
28+
* TODO Now that we dropped support for Scala 2.12.5 and below, we should
29+
* revisit this.
2830
*/
2931

3032
/** AST node of JavaScript. */

project/Build.scala

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -950,9 +950,6 @@ object Build {
950950

951951
val thisBuildSettings = Def.settings(
952952
cross212ScalaVersions := Seq(
953-
"2.12.2",
954-
"2.12.3",
955-
"2.12.5",
956953
"2.12.6",
957954
"2.12.7",
958955
"2.12.8",
@@ -2149,19 +2146,6 @@ object Build {
21492146
includeIf(sharedTestDir / "require-jdk21", javaV >= 21) :::
21502147
includeIf(testDir / "require-scala2", isJSTest)
21512148
},
2152-
2153-
sources in Test := {
2154-
val allSources = (sources in Test).value
2155-
val scalaV = scalaVersion.value
2156-
2157-
val hasBugWithOverriddenMethods =
2158-
Set("2.12.2", "2.12.3", "2.12.4").contains(scalaV)
2159-
2160-
if (hasBugWithOverriddenMethods)
2161-
allSources.filter(_.getName != "SAMWithOverridingBridgesTest.scala")
2162-
else
2163-
allSources
2164-
}
21652149
)
21662150

21672151
def testSuiteBootstrapSetting(testSuiteLinker: Project) = Def.settings(

project/JavalibIRCleaner.scala

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -356,33 +356,6 @@ final class JavalibIRCleaner(baseDirectoryURI: URI) {
356356
JSUnaryOp(JSUnaryOp.!, JSUnaryOp(JSUnaryOp.!, arg)),
357357
BooleanType)
358358

359-
// s"..." interpolator in 2.12.2 up to 2.12.4
360-
case Apply(
361-
ApplyFlags.empty,
362-
New(StringContextClass, MethodIdent(`stringContextCtorMethodName`),
363-
List(ScalaVarArgsReadOnlyLiteral(stringElems))),
364-
MethodIdent(`sMethodName`),
365-
List(ScalaVarArgsReadOnlyLiteral(valueElems))) =>
366-
if (stringElems.size != valueElems.size + 1) {
367-
reportError("Found s\"...\" interpolator but the sizes do not match")
368-
tree
369-
} else {
370-
val processedEscapesStringElems = stringElems.map { s =>
371-
(s: @unchecked) match {
372-
case StringLiteral(value) =>
373-
StringLiteral(StringContext.processEscapes(value))
374-
}
375-
}
376-
val stringsIter = processedEscapesStringElems.iterator
377-
val valuesIter = valueElems.iterator
378-
var result: Tree = stringsIter.next()
379-
while (valuesIter.hasNext) {
380-
result = BinaryOp(BinaryOp.String_+, result, valuesIter.next())
381-
result = BinaryOp(BinaryOp.String_+, result, stringsIter.next())
382-
}
383-
result
384-
}
385-
386359
// LinkingInfo
387360
// Must stay in sync with the definitions in `scala.scalajs.LinkingInfo`
388361
case IntrinsicCall(LinkingInfoClass, `esVersionMethodName`, Nil) =>
@@ -649,7 +622,6 @@ object JavalibIRCleaner {
649622
private val ReadOnlySeq = ClassName("scala.collection.Seq")
650623
private val ScalaSerializable = ClassName("scala.Serializable")
651624
private val ScalaJSRuntimeMod = ClassName("scala.scalajs.runtime.package$")
652-
private val StringContextClass = ClassName("scala.StringContext")
653625
private val UnionType = ClassName("scala.scalajs.js.$bar")
654626
private val UnionTypeMod = ClassName("scala.scalajs.js.$bar$")
655627
private val UnionTypeEvidence = ClassName("scala.scalajs.js.$bar$Evidence")
@@ -671,10 +643,6 @@ object JavalibIRCleaner {
671643
MethodName("jsArrayOps", List(ClassRef(JSArray)), ClassRef(JSArrayOps))
672644
private val number2dynamicMethodName =
673645
MethodName("number2dynamic", List(DoubleRef), ClassRef(JSDynamic))
674-
private val sMethodName =
675-
MethodName("s", List(ClassRef(ReadOnlySeq)), ClassRef(BoxedStringClass))
676-
private val stringContextCtorMethodName =
677-
MethodName.constructor(List(ClassRef(ReadOnlySeq)))
678646
private val toImmutableSeqExtensionMethodName =
679647
MethodName("toSeq$extension", List(ClassRef(JSArray)), ClassRef(ImmutableSeq))
680648
private val toJSVarArgsImmutableMethodName =

scala-test-suite/src/test/resources/2.12.1/BlacklistedTests.txt

Lines changed: 0 additions & 117 deletions
This file was deleted.

0 commit comments

Comments
 (0)