Skip to content

Commit d9af5a4

Browse files
committed
Drop Scala 2 for tasty-lib module
1 parent 6284812 commit d9af5a4

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

build.mill.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ object `build-module` extends Cross[Build](Scala.scala3MainVersions)
107107
with CrossScalaDefaultToInternal
108108
object runner extends Runner
109109
object `test-runner` extends TestRunner
110-
object `tasty-lib` extends Cross[TastyLib](Scala.all) with CrossScalaDefaultToInternal
110+
object `tasty-lib` extends Cross[TastyLib](Scala.scala3MainVersions)
111+
with CrossScalaDefaultToInternal
111112
// Runtime classes used within native image on Scala 3 replacing runtime from Scala
112113
object `scala3-runtime` extends Cross[Scala3Runtime](Scala.scala3MainVersions)
113114
with CrossScalaDefaultToInternal
@@ -1316,7 +1317,7 @@ trait TestRunner extends SbtModule
13161317

13171318
trait TastyLib extends ScalaCliCrossSbtModule
13181319
with ScalaCliPublishModule
1319-
with ScalaCliScalafixLegacyModule {
1320+
with ScalaCliScalafixModule {
13201321
override def crossScalaVersion: String = crossValue
13211322
def constantsFile: T[PathRef] = Task(persistent = true) {
13221323
val dir = Task.dest / "constants"

modules/tasty-lib/src/main/scala/scala/build/tastylib/TastyBuffer.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class TastyBuffer(initialSize: Int) {
5959
/** Like writeNat, but for longs. Note that the binary representation of LongNat is identical to
6060
* Nat if the long value is in the range Int.MIN_VALUE to Int.MAX_VALUE.
6161
*/
62-
def writeLongNat(x: Long): Unit = {
62+
private def writeLongNat(x: Long): Unit = {
6363
def writePrefix(x: Long): Unit = {
6464
val y = x >>> 7
6565
if (y != 0L) writePrefix(y)
@@ -79,7 +79,7 @@ class TastyBuffer(initialSize: Int) {
7979
def getNat(at: Addr): Int = getLongNat(at).toInt
8080

8181
/** The long natural number at address `at` */
82-
def getLongNat(at: Addr): Long = {
82+
private def getLongNat(at: Addr): Long = {
8383
var b = 0L
8484
var x = 0L
8585
var idx = at.index

modules/tasty-lib/src/main/scala/scala/build/tastylib/TastyReader.scala

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ package scala.build.tastylib
1616

1717
import java.io.OutputStream
1818

19-
import scala.build.tastylib.TastyBuffer._
19+
import scala.build.tastylib.TastyBuffer.*
2020
import scala.collection.mutable
2121

2222
class TastyReader(val bytes: Array[Byte], val start: Int, val end: Int, val base: Int = 0) {
2323

2424
def this(bytes: Array[Byte]) = this(bytes, 0, bytes.length)
2525

26-
private[this] var bp: Int = start
26+
private var bp: Int = start
2727

2828
def pos: Int = bp
2929
def read: TastyReader.Bytes = TastyReader.Bytes(bytes, start, bp)
@@ -50,7 +50,7 @@ class TastyReader(val bytes: Array[Byte], val start: Int, val end: Int, val base
5050
def readNat(): Int = readLongNat().toInt
5151
def readInt(): Int = readLongInt().toInt
5252

53-
def readLongNat(): Long = {
53+
private def readLongNat(): Long = {
5454
var b = 0L
5555
var x = 0L
5656
while ({
@@ -62,7 +62,7 @@ class TastyReader(val bytes: Array[Byte], val start: Int, val end: Int, val base
6262
x
6363
}
6464

65-
def readLongInt(): Long = {
65+
private def readLongInt(): Long = {
6666
var b = bytes(bp)
6767
var x: Long = (b << 1).toByte >> 1
6868
bp += 1
@@ -95,6 +95,7 @@ class TastyReader(val bytes: Array[Byte], val start: Int, val end: Int, val base
9595
}
9696

9797
def doUntil(end: Addr)(op: => Unit): Unit = {
98+
// noinspection LoopVariableNotUpdated
9899
while (bp < index(end)) op
99100
assert(bp == index(end))
100101
}

modules/tasty-lib/src/main/scala/scala/build/tastylib/TastyUnpickler.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ package scala.build.tastylib
1616

1717
import scala.build.tastylib.TastyBuffer.NameRef
1818
import scala.build.tastylib.TastyFormat.NameTags
19-
import scala.build.tastylib.TastyName._
19+
import scala.build.tastylib.TastyName.*
2020
import scala.build.tastylib.TastyReader.Bytes
2121
import scala.collection.mutable
2222

2323
object TastyUnpickler {
2424

2525
final class NameTable {
26-
private[this] val names = new mutable.ArrayBuffer[(Option[TastyName], Bytes)]
26+
private val names = new mutable.ArrayBuffer[(Option[TastyName], Bytes)]
2727
def add(
2828
name: Option[TastyName],
2929
bytes: Bytes
@@ -39,7 +39,7 @@ import TastyUnpickler._
3939

4040
private class TastyUnpickler(reader: TastyReader) { self =>
4141

42-
private[this] val nameTable = new NameTable
42+
private val nameTable = new NameTable
4343

4444
def nameAtRef: NameTable = nameTable
4545

0 commit comments

Comments
 (0)