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 #4640

Closed
wants to merge 3 commits into from
Closed
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 @@ -15,3 +15,6 @@ f025b0198d55d7f5c09ee976eec9e274d8dd0309

# Scala Steward: Reformat with scalafmt 3.5.9
b4d207e9fa9f1463f0827fe20101e7901fecf820

# Scala Steward: Reformat with scalafmt 3.8.3
eafb76d2b73ab736d70938196fb97de9b14c09d1
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=3.8.2
version=3.8.3
align.openParenCallSite = true
align.openParenDefnSite = true
maxColumn = 120
Expand Down
2 changes: 1 addition & 1 deletion algebra-core/src/main/scala/algebra/instances/byte.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ByteAlgebra extends CommutativeRing[Byte] with Serializable {
def one: Byte = 1

def plus(x: Byte, y: Byte): Byte = (x + y).toByte
def negate(x: Byte): Byte = (-x).toByte
def negate(x: Byte): Byte = -x.toByte
override def minus(x: Byte, y: Byte): Byte = (x - y).toByte

def times(x: Byte, y: Byte): Byte = (x * y).toByte
Expand Down
2 changes: 1 addition & 1 deletion algebra-core/src/main/scala/algebra/instances/short.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ShortAlgebra extends CommutativeRing[Short] with Serializable {
def one: Short = 1

def plus(x: Short, y: Short): Short = (x + y).toShort
def negate(x: Short): Short = (-x).toShort
def negate(x: Short): Short = -x.toShort
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, new formatting breaks down this

override def minus(x: Short, y: Short): Short = (x - y).toShort

def times(x: Short, y: Short): Short = (x * y).toShort
Expand Down
28 changes: 14 additions & 14 deletions core/src/main/scala/cats/evidence/As.scala
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ sealed abstract class As[-A, +B] extends Serializable {
*/
def substitute[F[-_]](p: F[B]): F[A]

@inline final def andThen[C](that: (B As C)): (A As C) = As.compose(that, this)
@inline final def andThen[C](that: B As C): A As C = As.compose(that, this)

@inline final def compose[C](that: (C As A)): (C As B) = As.compose(this, that)
@inline final def compose[C](that: C As A): C As B = As.compose(this, that)

@inline final def coerce(a: A): B = As.witness(this)(a)

Expand All @@ -73,9 +73,9 @@ sealed abstract class AsInstances {
* Subtyping forms a category
*/
implicit val liskov: Category[As] = new Category[As] {
def id[A]: (A As A) = refl[A]
def id[A]: A As A = refl[A]

def compose[A, B, C](bc: B As C, ab: A As B): (A As C) = bc.compose(ab)
def compose[A, B, C](bc: B As C, ab: A As B): A As C = bc.compose(ab)
}
}

Expand All @@ -92,7 +92,7 @@ object As extends AsInstances with AsSupport {
/**
* Subtyping is reflexive
*/
implicit def refl[A]: (A As A) =
implicit def refl[A]: A As A =
reflAny.asInstanceOf[A As A]

/**
Expand All @@ -114,7 +114,7 @@ object As extends AsInstances with AsSupport {
/**
* reify a subtype relationship as a Liskov relationship
*/
@inline def reify[A, B >: A]: (A As B) = refl
@inline def reify[A, B >: A]: A As B = refl

/**
* It can be convenient to convert a <:< value into a `<~<` value.
Expand All @@ -127,7 +127,7 @@ object As extends AsInstances with AsSupport {
/**
* We can lift subtyping into any covariant type constructor
*/
def co[T[+_], A, A2](a: A As A2): (T[A] As T[A2]) = {
def co[T[+_], A, A2](a: A As A2): T[A] As T[A2] = {
type L[-Ξ±] = T[Ξ±] As T[A2]
a.substitute[L](refl)
}
Expand Down Expand Up @@ -179,7 +179,7 @@ object As extends AsInstances with AsSupport {
def lift2[T[+_, +_], A, A2, B, B2](
a: A As A2,
b: B As B2
): (T[A, B] As T[A2, B2]) = {
): T[A, B] As T[A2, B2] = {
type a[-X] = T[X, B2] As T[A2, B2]
type b[-X] = T[A, X] As T[A2, B2]
b.substitute[b](a.substitute[a](refl))
Expand All @@ -192,7 +192,7 @@ object As extends AsInstances with AsSupport {
* Given that F has the shape: F[-_], we show that:
* (A As B) implies (F[B] As F[A])
*/
def contra[T[-_], A, B](a: A As B): (T[B] As T[A]) = {
def contra[T[-_], A, B](a: A As B): T[B] As T[A] = {
type L[-Ξ±] = T[B] As T[Ξ±]
a.substitute[L](refl)
}
Expand All @@ -201,27 +201,27 @@ object As extends AsInstances with AsSupport {
// parameter. Here we provide the proof for what we expect to be the
// most common shapes.

def contra1_2[T[-_, _], Z, A, B](a: A As Z): (T[Z, B] As T[A, B]) = {
def contra1_2[T[-_, _], Z, A, B](a: A As Z): T[Z, B] As T[A, B] = {
type L[-Ξ±] = T[Z, B] As T[Ξ±, B]
a.substitute[L](refl)
}

def contra2_2[T[_, -_], Z, A, B](a: B As Z): (T[A, Z] As T[A, B]) = {
def contra2_2[T[_, -_], Z, A, B](a: B As Z): T[A, Z] As T[A, B] = {
type L[-Ξ±] = T[A, Z] As T[A, Ξ±]
a.substitute[L](refl)
}

def contra1_3[T[-_, _, _], Z, A, B, C](a: A As Z): (T[Z, B, C] As T[A, B, C]) = {
def contra1_3[T[-_, _, _], Z, A, B, C](a: A As Z): T[Z, B, C] As T[A, B, C] = {
type L[-Ξ±] = T[Z, B, C] As T[Ξ±, B, C]
a.substitute[L](refl)
}

def contra2_3[T[_, -_, _], Z, A, B, C](a: B As Z): (T[A, Z, C] As T[A, B, C]) = {
def contra2_3[T[_, -_, _], Z, A, B, C](a: B As Z): T[A, Z, C] As T[A, B, C] = {
type L[-Ξ±] = T[A, Z, C] As T[A, Ξ±, C]
a.substitute[L](refl)
}

def contra3_3[T[_, _, -_], Z, A, B, C](a: C As Z): (T[A, B, Z] As T[A, B, C]) = {
def contra3_3[T[_, _, -_], Z, A, B, C](a: C As Z): T[A, B, Z] As T[A, B, C] = {
type L[-Ξ±] = T[A, B, Z] As T[A, B, Ξ±]
a.substitute[L](refl)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ trait ByteInstances {
class ByteGroup extends CommutativeGroup[Byte] {
def combine(x: Byte, y: Byte): Byte = (x + y).toByte
def empty: Byte = 0
def inverse(x: Byte): Byte = (-x).toByte
def inverse(x: Byte): Byte = -x.toByte
override def remove(x: Byte, y: Byte): Byte = (x - y).toByte
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ trait ShortInstances {
class ShortGroup extends CommutativeGroup[Short] {
def combine(x: Short, y: Short): Short = (x + y).toShort
def empty: Short = 0
def inverse(x: Short): Short = (-x).toShort
def inverse(x: Short): Short = -x.toShort
override def remove(x: Short, y: Short): Short = (x - y).toShort
}

Expand Down
14 changes: 7 additions & 7 deletions tests/shared/src/test/scala/cats/tests/AsSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ class AsSuite extends CatsSuite {
test("we can lift subtyping to covariant type constructors") {
val cAsA: Bottom As Top = implicitly
val co: List[Bottom] As List[Top] = As.co(cAsA)
val co2: ((Bottom, String) As (Top, String)) = As.co2(cAsA)
val co2_2: ((String, Bottom) As (String, Top)) = As.co2_2(cAsA)
val co3: ((Bottom, Unit, Unit) As (Top, Unit, Unit)) = As.co3(cAsA)
val co3_2: ((Unit, Bottom, Unit) As (Unit, Top, Unit)) = As.co3_2(cAsA)
val co3_3: ((Unit, Unit, Bottom) As (Unit, Unit, Top)) = As.co3_3(cAsA)
val lift2: ((Bottom, String) As (Top, Any)) = As.lift2(cAsA, implicitly)
val co2: (Bottom, String) As (Top, String) = As.co2(cAsA)
val co2_2: (String, Bottom) As (String, Top) = As.co2_2(cAsA)
val co3: (Bottom, Unit, Unit) As (Top, Unit, Unit) = As.co3(cAsA)
val co3_2: (Unit, Bottom, Unit) As (Unit, Top, Unit) = As.co3_2(cAsA)
val co3_3: (Unit, Unit, Bottom) As (Unit, Unit, Top) = As.co3_3(cAsA)
val lift2: (Bottom, String) As (Top, Any) = As.lift2(cAsA, implicitly)
}

test("we can lift subtyping to contravariant type constructors") {
Expand All @@ -119,7 +119,7 @@ class AsSuite extends CatsSuite {
type EatF23[B, -A, C] = A => (B, C)
type EatF33[B, C, -A] = A => (B, C)

val cAsA: (Bottom As Top) = implicitly
val cAsA: Bottom As Top = implicitly
val contra: Eat[Top] As Eat[Bottom] = As.contra(cAsA)
val contra1_2: EatF[Top, Unit] As EatF[Bottom, Unit] = As.contra1_2(cAsA)
val contra2_2: Eatꟻ[Unit, Top] As Eatꟻ[Unit, Bottom] = As.contra2_2(cAsA)
Expand Down
Loading