Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update scalafmt-core to 3.8.3 #1341

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ e93fe9bcf5ff0c314ca676bf9f3b9c8148574786

# Scala Steward: Reformat with scalafmt 3.7.17
7829f68c27c622dee3a8d1329d82a139f183d0c1

# Scala Steward: Reformat with scalafmt 3.8.3
43072f7eac31de07b775fd580b1186e2dff8e9a3
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=3.7.17
version=3.8.3
runner.dialect = Scala213Source3
fileOverride {
"glob:**/scala-3/**" {
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/spire/math/Interval.scala
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ sealed abstract class Interval[A] extends Serializable { lhs =>
/* Returns the list of disjoint non-empty intervals resulting from the exclusion of the interval with rhs */
def --(rhs: Interval[A])(implicit o: Order[A]): List[Interval[A]] =
if (lhs.intersects(rhs)) {
(~rhs).map(lhs & _).filter(_.nonEmpty)
~rhs.map(lhs & _).filter(_.nonEmpty)
} else {
if (lhs.isEmpty) Nil else List(lhs)
}
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/scala/spire/math/Rational.scala
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,14 @@ sealed abstract class Rational extends ScalaNumber with ScalaNumericConversions
* Returns a `Rational` whose numerator and denominator both fit in an `Int`.
*/
def limitToInt: Rational =
if (signum < 0) -(-this).limitTo(Rational.Two31m0)
if (signum < 0) - -this.limitTo(Rational.Two31m0)
else limitTo(Rational.Two31m1)

/**
* Returns a `Rational` whose numerator and denominator both fit in a `Long`.
*/
def limitToLong: Rational =
if (signum < 0) -(-this).limitTo(Rational.Two63m0)
if (signum < 0) - -this.limitTo(Rational.Two63m0)
else limitTo(Rational.Two63m1)

/**
Expand All @@ -193,7 +193,7 @@ sealed abstract class Rational extends ScalaNumber with ScalaNumericConversions
* A positive integer.
*/
def limitTo(max: SafeLong): Rational = if (this.signum < 0) {
-(-this).limitTo(max)
- -this.limitTo(max)
} else {
require(max.signum > 0, "Limit must be a positive integer.")

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/spire/math/interval/Overlap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ object Overlap {
* An interval that joins [[lower]] and [[upper]] in a continuous interval without intersecting any of them. For
* example for (-5, 1] and (4, 6), a join is (1,4]
*/
def join(implicit o: Order[A]): Interval[A] = (~lower).last.intersect((~upper).head)
def join(implicit o: Order[A]): Interval[A] = ~lower.last.intersect(~upper.head)
}

/**
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/scala/spire/std/byte.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import spire.math.BitString

trait ByteIsEuclideanRing extends EuclideanRing[Byte] {
override def minus(a: Byte, b: Byte): Byte = (a - b).toByte
def negate(a: Byte): Byte = (-a).toByte
def negate(a: Byte): Byte = -a.toByte
def one: Byte = 1.toByte
def plus(a: Byte, b: Byte): Byte = (a + b).toByte
override def pow(a: Byte, b: Int): Byte = Math.pow(a, b).toByte
Expand Down Expand Up @@ -75,7 +75,7 @@ trait ByteOrder extends Order[Byte] {
trait ByteSigned extends Signed[Byte] with ByteOrder {
def order = this
override def signum(a: Byte): Int = java.lang.Integer.signum(a)
override def abs(a: Byte): Byte = if (a < 0) (-a).toByte else a
override def abs(a: Byte): Byte = if (a < 0) -a.toByte else a
}

trait ByteTruncatedDivision extends TruncatedDivisionCRing[Byte] with ByteSigned {
Expand All @@ -95,7 +95,7 @@ class ByteIsBitString extends BitString[Byte] with Serializable {
def zero: Byte = 0: Byte
def and(a: Byte, b: Byte): Byte = (a & b).toByte
def or(a: Byte, b: Byte): Byte = (a | b).toByte
def complement(a: Byte): Byte = (~a).toByte
def complement(a: Byte): Byte = ~a.toByte
override def xor(a: Byte, b: Byte): Byte = (a ^ b).toByte

def signed: Boolean = true
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/scala/spire/std/short.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import spire.util.Opt

trait ShortIsEuclideanRing extends EuclideanRing[Short] {
override def minus(a: Short, b: Short): Short = (a - b).toShort
def negate(a: Short): Short = (-a).toShort
def negate(a: Short): Short = -a.toShort
def one: Short = 1.toShort
def plus(a: Short, b: Short): Short = (a + b).toShort
// override def pow(a: Short, b:Int): Short = Math.pow(a, b).toShort TODO: does not obey laws
Expand Down Expand Up @@ -75,7 +75,7 @@ trait ShortOrder extends Order[Short] {
trait ShortSigned extends Signed[Short] with ShortOrder {
def order = this
override def signum(a: Short): Int = java.lang.Integer.signum(a)
override def abs(a: Short): Short = if (a < 0) (-a).toShort else a.toShort
override def abs(a: Short): Short = if (a < 0) -a.toShort else a.toShort
}

trait ShortTruncatedDivision extends TruncatedDivisionCRing[Short] with ShortSigned {
Expand All @@ -95,7 +95,7 @@ class ShortIsBitString extends BitString[Short] with Serializable {
def zero: Short = 0: Short
def and(a: Short, b: Short): Short = (a & b).toShort
def or(a: Short, b: Short): Short = (a | b).toShort
def complement(a: Short): Short = (~a).toShort
def complement(a: Short): Short = ~a.toShort
override def xor(a: Short, b: Short): Short = (a ^ b).toShort

def signed: Boolean = true
Expand Down
2 changes: 1 addition & 1 deletion laws/src/main/scala/spire/laws/CombinationLaws.scala
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ trait CombinationLaws[A] extends Laws {
name = "signedAdditiveAbGroup",
parent = Some(signedAdditiveCMonoid),
"abs(x) equals abs(-x)" -> forAllSafe { (x: A) =>
x.abs === (-x).abs
x.abs === -x.abs
}
)

Expand Down
2 changes: 1 addition & 1 deletion tests/shared/src/test/scala/spire/math/JetSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class JetSuite extends munit.FunSuite {
val i = Array(1.0f, 2.0f, 3.0f)
val a = Jet(r, i)
assertEquals(-a, new Jet(-r, -i))
assertEquals(-(-a), a)
assertEquals(- -a, a)
}
test("Arithmetic combinations with scalars") {
val r = 13.0f
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class QuaternionSuite extends munit.FunSuite {

test("Quaternion[Double].fromDouble") {
assert(DivisionRing[Quaternion[Rational]].fromDouble(0).isZero)
assert((-DivisionRing[Quaternion[Rational]].fromDouble(-1)).isValidInt)
assert(-DivisionRing[Quaternion[Rational]].fromDouble(-1).isValidInt)
assert(DivisionRing[Quaternion[Rational]].fromDouble(1) === DivisionRing[Quaternion[Rational]].one)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class SafeLongScalaCheckSuite extends munit.ScalaCheckSuite {
sx.isWhole &&
sx.isValidInt == x.isValidInt &&
sx.isValidLong &&
(x == Long.MinValue || (-sx).isValidLong)
(x == Long.MinValue || -sx.isValidLong)
}
}

Expand Down
Loading