Skip to content

Commit 015f73f

Browse files
committed
chore: fix mandatory binary incompatibilities between Scala 2 and Scala 3
1 parent aa284a9 commit 015f73f

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

project/Scala2LibraryBootstrappedMiMaFilters.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ object Scala2LibraryBootstrappedMiMaFilters {
7474
"scala.collection.mutable.PriorityQueue#ResizableArrayAccess.this",
7575
"scala.concurrent.BatchingExecutor#AbstractBatch.this",
7676
"scala.concurrent.Channel#LinkedList.this",
77-
"scala.Enumeration#ValueOrdering.this",
78-
"scala.io.Source#RelaxedPosition.this",
7977
"scala.collection.IterableOnceOps#Maximized.this", // New in 2.13.11: private inner class
8078
"scala.util.Properties.<clinit>",
8179
"scala.util.Sorting.scala$util$Sorting$$mergeSort$default$5",

scala2-library-bootstrapped/src/scala/Enumeration.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,12 @@ abstract class Enumeration (initial: Int) extends Serializable {
272272

273273
/** An ordering by id for values of this set */
274274
implicit object ValueOrdering extends Ordering[Value] {
275+
276+
// IMPORTANT:
277+
// Scala 3 removes unnecessary outer pointers while Scala 2 doesn't
278+
// This is important to capture the outer pointer when compiling with
279+
// dotc to maintain our binary compatibility requirements
280+
private val _ = Enumeration.this
275281
def compare(x: Value, y: Value): Int = x compare y
276282
}
277283

scala2-library-bootstrapped/src/scala/io/Source.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,13 @@ abstract class Source extends Iterator[Char] with Closeable {
292292
*/
293293
@nowarn("cat=deprecation")
294294
object RelaxedPosition extends Position {
295+
296+
// IMPORTANT:
297+
// Scala 3 removes unnecessary outer pointers while Scala 2 doesn't
298+
// This is important to capture the outer pointer when compiling with
299+
// dotc to maintain our binary compatibility requirements
300+
private val _ = Source.this
301+
295302
def checkInput(line: Int, column: Int): Unit = ()
296303
}
297304
object RelaxedPositioner extends Positioner(RelaxedPosition) { }

0 commit comments

Comments
 (0)