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.4 in scala3 #646

Open
wants to merge 3 commits into
base: scala3
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 @@ -6,3 +6,6 @@

# Scala Steward: Reformat with scalafmt 3.7.1
74296b9e7b39881b4182ef0e220cabcde7e3237b

# Scala Steward: Reformat with scalafmt 3.8.4
e87d74d73fdb740066d6c7bf6bfba7587156764a
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.3"
version = "3.8.4"
runner.dialect = Scala3
#project.includePaths = [] # disables formatting
maxColumn = 80
Expand Down
66 changes: 50 additions & 16 deletions core/src/main/scala/coulomb/infra/meta.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ object meta:
case object Constant extends SigMode

object rationalTE:
def unapply(using Quotes)(
def unapply(using
Quotes
)(
tr: quotes.reflect.TypeRepr
): Option[Rational] =
import quotes.reflect.*
Expand Down Expand Up @@ -143,7 +145,10 @@ object meta:
false

// returns tuple: (expr-for-coef, type-of-Res)
def cansig(using qq: Quotes, mode: SigMode)(
def cansig(using
qq: Quotes,
mode: SigMode
)(
uu: quotes.reflect.TypeRepr
): (Rational, List[(quotes.reflect.TypeRepr, Rational)]) =
import quotes.reflect.*
Expand Down Expand Up @@ -198,7 +203,9 @@ object meta:
// treat any other type as if it were a BaseUnit
(Rational.const1, (u, Rational.const1) :: Nil)

def sortsig(using Quotes)(
def sortsig(using
Quotes
)(
sig: List[(quotes.reflect.TypeRepr, Rational)]
): (
List[(quotes.reflect.TypeRepr, Rational)],
Expand All @@ -210,14 +217,18 @@ object meta:
val (nsig, dsig) = sortsig(tail)
if (e > 0) ((u, e) :: nsig, dsig) else (nsig, (u, -e) :: dsig)

def simplify(using Quotes)(
def simplify(using
Quotes
)(
u: quotes.reflect.TypeRepr
): quotes.reflect.TypeRepr =
import quotes.reflect.*
given sigmode: SigMode = SigMode.Simplify
simplifysig(cansig(u)._2)

def simplifysig(using Quotes)(
def simplifysig(using
Quotes
)(
sig: List[(quotes.reflect.TypeRepr, Rational)]
): quotes.reflect.TypeRepr =
import quotes.reflect.*
Expand All @@ -229,7 +240,9 @@ object meta:
TypeRepr.of[/].appliedTo(List(TypeRepr.of[1], d))
case (n, d) => TypeRepr.of[/].appliedTo(List(n, d))

def uProd(using Quotes)(
def uProd(using
Quotes
)(
sig: List[(quotes.reflect.TypeRepr, Rational)]
): quotes.reflect.TypeRepr =
import quotes.reflect.*
Expand All @@ -254,7 +267,9 @@ object meta:
case _ => false

object unitconst:
def unapply(using Quotes)(
def unapply(using
Quotes
)(
u: quotes.reflect.TypeRepr
): Option[Rational] =
u match
Expand All @@ -268,7 +283,10 @@ object meta:
case _ => false

object derivedunit:
def unapply(using qq: Quotes, mode: SigMode)(
def unapply(using
qq: Quotes,
mode: SigMode
)(
u: quotes.reflect.TypeRepr
): Option[(Rational, List[(quotes.reflect.TypeRepr, Rational)])] =
import quotes.reflect.*
Expand All @@ -285,7 +303,9 @@ object meta:
case _ => None

object baseunitTR:
def unapply(using Quotes)(
def unapply(using
Quotes
)(
u: quotes.reflect.TypeRepr
): Option[quotes.reflect.TypeRepr] =
import quotes.reflect.*
Expand All @@ -303,7 +323,9 @@ object meta:
case _ => None

object derivedunitTR:
def unapply(using Quotes)(
def unapply(using
Quotes
)(
u: quotes.reflect.TypeRepr
): Option[quotes.reflect.TypeRepr] =
import quotes.reflect.*
Expand All @@ -328,7 +350,9 @@ object meta:
case _ => None

object deltaunit:
def unapply(using Quotes)(
def unapply(using
Quotes
)(
u: quotes.reflect.TypeRepr
): Option[(Rational, quotes.reflect.TypeRepr)] =
import quotes.reflect.*
Expand All @@ -354,7 +378,9 @@ object meta:
Some((offset, d))
case _ => None

def unifyOp(using Quotes)(
def unifyOp(using
Quotes
)(
sig1: List[(quotes.reflect.TypeRepr, Rational)],
sig2: List[(quotes.reflect.TypeRepr, Rational)],
op: (Rational, Rational) => Rational
Expand All @@ -363,7 +389,9 @@ object meta:
case Nil => sig1
case (u, e) :: tail => unifyOp(insertTerm(u, e, sig1, op), tail, op)

def insertTerm(using Quotes)(
def insertTerm(using
Quotes
)(
u: quotes.reflect.TypeRepr,
e: Rational,
sig: List[(quotes.reflect.TypeRepr, Rational)],
Expand All @@ -376,7 +404,9 @@ object meta:
if (ei == Rational.const0) tail else (u, ei) :: tail
case (u0, e0) :: tail => (u0, e0) :: insertTerm(u, e, tail, op)

def unifyPow(using Quotes)(
def unifyPow(using
Quotes
)(
e: Rational,
sig: List[(quotes.reflect.TypeRepr, Rational)]
): List[(quotes.reflect.TypeRepr, Rational)] =
Expand All @@ -385,7 +415,9 @@ object meta:
case Nil => Nil
case (u, e0) :: tail => (u, e0 * e) :: unifyPow(e, tail)

def typeReprList(using Quotes)(
def typeReprList(using
Quotes
)(
tlist: quotes.reflect.TypeRepr
): List[quotes.reflect.TypeRepr] =
import quotes.reflect.*
Expand Down Expand Up @@ -428,7 +460,9 @@ object meta:
work(t)

object typealias:
def unapply(using Quotes)(
def unapply(using
Quotes
)(
t: quotes.reflect.TypeRepr
): Option[quotes.reflect.TypeRepr] =
import quotes.reflect.*
Expand Down
24 changes: 18 additions & 6 deletions core/src/main/scala/coulomb/infra/show.scala
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ object show:
""

object flatmul:
def unapply(using Quotes)(
def unapply(using
Quotes
)(
u: quotes.reflect.TypeRepr
): Option[List[quotes.reflect.TypeRepr]] =
import quotes.reflect.*
Expand Down Expand Up @@ -148,7 +150,9 @@ object show:
case _ => true

object namedunit:
def unapply(using Quotes)(
def unapply(using
Quotes
)(
u: quotes.reflect.TypeRepr
): Option[quotes.reflect.TypeRepr] =
import quotes.reflect.*
Expand All @@ -159,7 +163,9 @@ object show:
case _ => None

object namedSU:
def unapply(using Quotes)(
def unapply(using
Quotes
)(
u: quotes.reflect.TypeRepr
): Option[quotes.reflect.TypeRepr] =
import quotes.reflect.*
Expand All @@ -175,7 +181,9 @@ object show:
case _ => None

object namedPU:
def unapply(using Quotes)(
def unapply(using
Quotes
)(
u: quotes.reflect.TypeRepr
): Option[quotes.reflect.TypeRepr] =
import quotes.reflect.*
Expand All @@ -199,7 +207,9 @@ object show:
case _ => None

object namedBU:
def unapply(using Quotes)(
def unapply(using
Quotes
)(
u: quotes.reflect.TypeRepr
): Option[quotes.reflect.TypeRepr] =
import quotes.reflect.*
Expand All @@ -215,7 +225,9 @@ object show:
case _ => None

object namedDU:
def unapply(using Quotes)(
def unapply(using
Quotes
)(
u: quotes.reflect.TypeRepr
): Option[quotes.reflect.TypeRepr] =
import quotes.reflect.*
Expand Down
12 changes: 9 additions & 3 deletions core/src/main/scala/coulomb/ops/algebra/cats/deltaquantity.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,23 @@ object deltaquantity:
import coulomb.DeltaQuantity
import coulomb.policy.priority.*

given ctx_DeltaQuantity_Order[V, U, B](using Prio0)(using
given ctx_DeltaQuantity_Order[V, U, B](using
Prio0
)(using
ord: Order[V]
): Order[DeltaQuantity[V, U, B]] =
new infra.QOrder[V, U, B](ord)

given ctx_DeltaQuantity_Hash[V, U, B](using Prio1)(using
given ctx_DeltaQuantity_Hash[V, U, B](using
Prio1
)(using
h: Hash[V]
): Hash[DeltaQuantity[V, U, B]] =
new infra.QHash[V, U, B](h)

given ctx_DeltaQuantity_Eq[V, U, B](using Prio2)(using
given ctx_DeltaQuantity_Eq[V, U, B](using
Prio2
)(using
e: Eq[V]
): Eq[DeltaQuantity[V, U, B]] =
new infra.QEq[V, U, B](e)
Expand Down
12 changes: 9 additions & 3 deletions core/src/main/scala/coulomb/ops/algebra/cats/quantity.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,23 @@ object quantity:
import coulomb.Quantity
import coulomb.policy.priority.*

given ctx_Quantity_Order[V, U](using Prio0)(using
given ctx_Quantity_Order[V, U](using
Prio0
)(using
ord: Order[V]
): Order[Quantity[V, U]] =
new infra.QOrder[V, U](ord)

given ctx_Quantity_Hash[V, U](using Prio1)(using
given ctx_Quantity_Hash[V, U](using
Prio1
)(using
h: Hash[V]
): Hash[Quantity[V, U]] =
new infra.QHash[V, U](h)

given ctx_Quantity_Eq[V, U](using Prio2)(using
given ctx_Quantity_Eq[V, U](using
Prio2
)(using
e: Eq[V]
): Eq[Quantity[V, U]] =
new infra.QEq[V, U](e)
Expand Down
4 changes: 3 additions & 1 deletion core/src/main/scala/coulomb/ops/ops.scala
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ object ValuePromotion:
report.error("no ValuePromotionPolicy was found in scope")
null.asInstanceOf[Nothing]

private def vpp2str(using Quotes)(
private def vpp2str(using
Quotes
)(
vppl: List[quotes.reflect.TypeRepr]
): VppSet[(String, String)] =
import quotes.reflect.*
Expand Down
14 changes: 9 additions & 5 deletions core/src/main/scala/coulomb/ops/standard/pow.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ object pow:
import coulomb.ops.algebra.FractionalPower
import coulomb.policy.priority.*

transparent inline given ctx_pow_FractionalPower[V, U, E](using Prio0)(using
transparent inline given ctx_pow_FractionalPower[V, U, E](using
Prio0
)(using
alg: FractionalPower[V],
su: SimplifiedUnit[U ^ E]
): Pow[V, U, E] =
Expand All @@ -37,8 +39,9 @@ object pow:
alg.pow(q.value, e).withUnit[su.UO]
)

transparent inline given ctx_pow_MultiplicativeGroup[V, U, E](using Prio1)(
using
transparent inline given ctx_pow_MultiplicativeGroup[V, U, E](using
Prio1
)(using
alg: MultiplicativeGroup[V],
aie: typeexpr.AllInt[E],
su: SimplifiedUnit[U ^ E]
Expand All @@ -48,8 +51,9 @@ object pow:
alg.pow(q.value, e).withUnit[su.UO]
)

transparent inline given ctx_pow_MultiplicativeMonoid[V, U, E](using Prio2)(
using
transparent inline given ctx_pow_MultiplicativeMonoid[V, U, E](using
Prio2
)(using
alg: MultiplicativeMonoid[V],
nnie: typeexpr.NonNegInt[E],
su: SimplifiedUnit[U ^ E]
Expand Down
4 changes: 3 additions & 1 deletion parser/src/main/scala/coulomb/parser/infra/meta.scala
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ object meta:
val pnames = ${ Expr(pn1) }
}

private def collect(using Quotes)(
private def collect(using
Quotes
)(
tl: List[quotes.reflect.TypeRepr]
): (Map[String, String], Set[String]) =
import quotes.reflect.*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ object meta:
protected val derived = ${ Expr(du) }
}

private def utlClosure(using Quotes)(
private def utlClosure(using
Quotes
)(
utl: List[quotes.reflect.TypeRepr]
): (Set[RuntimeUnit.UnitType], Map[RuntimeUnit.UnitType, RuntimeUnit]) =
import quotes.reflect.*
Expand All @@ -127,7 +129,9 @@ object meta:
val (hbu, hdu) = utClosure(head)
(hbu ++ tbu, hdu ++ tdu)

private def utClosure(using Quotes)(
private def utClosure(using
Quotes
)(
tr: quotes.reflect.TypeRepr
): (Set[RuntimeUnit.UnitType], Map[RuntimeUnit.UnitType, RuntimeUnit]) =
import quotes.reflect.*
Expand Down Expand Up @@ -166,7 +170,9 @@ object meta:
)
null.asInstanceOf[Nothing]

def moduleUnits(using Quotes)(
def moduleUnits(using
Quotes
)(
mname: String
): List[quotes.reflect.TypeRepr] =
import quotes.reflect.*
Expand Down
Loading
Loading