Skip to content

Commit d8f4044

Browse files
scala-stewardMateuszKubuszok
authored andcommitted
Reformat with scalafmt 3.11.1
Executed command: scalafmt --non-interactive
1 parent 580ce7d commit d8f4044

7 files changed

Lines changed: 67 additions & 27 deletions

File tree

chimney/src/main/scala-2/io/scalaland/chimney/dsl/PartialTransformerDefinition.scala

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -826,8 +826,8 @@ final class PartialTransformerDefinition[From, To, Overrides <: TransformerOverr
826826

827827
/** Scope overrides to apply to all derivations matching `[FromMatch, ToMatch]`.
828828
*
829-
* When chimney recursively derives transformations for nested types, any `forAll`-scoped overrides whose
830-
* `FromMatch` and `ToMatch` are supertypes of the current derivation pair will be injected.
829+
* When chimney recursively derives transformations for nested types, any `forAll`-scoped overrides whose `FromMatch`
830+
* and `ToMatch` are supertypes of the current derivation pair will be injected.
831831
*
832832
* @tparam FromMatch
833833
* source type to match (subtypes of this will also match)
@@ -838,8 +838,7 @@ final class PartialTransformerDefinition[From, To, Overrides <: TransformerOverr
838838
*
839839
* @since 1.10.0
840840
*/
841-
def forAll[FromMatch, ToMatch]
842-
: PartialTransformerDefinitionForAll[From, To, Overrides, Flags, FromMatch, ToMatch] =
841+
def forAll[FromMatch, ToMatch]: PartialTransformerDefinitionForAll[From, To, Overrides, Flags, FromMatch, ToMatch] =
843842
new PartialTransformerDefinitionForAll[From, To, Overrides, Flags, FromMatch, ToMatch](runtimeData)
844843

845844
/** Build Partial Transformer using current configuration.

chimney/src/main/scala-2/io/scalaland/chimney/dsl/TransformerDefinition.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,8 @@ final class TransformerDefinition[From, To, Overrides <: TransformerOverrides, F
417417

418418
/** Scope overrides to apply to all derivations matching `[FromMatch, ToMatch]`.
419419
*
420-
* When chimney recursively derives transformations for nested types, any `forAll`-scoped overrides whose
421-
* `FromMatch` and `ToMatch` are supertypes of the current derivation pair will be injected.
420+
* When chimney recursively derives transformations for nested types, any `forAll`-scoped overrides whose `FromMatch`
421+
* and `ToMatch` are supertypes of the current derivation pair will be injected.
422422
*
423423
* @tparam FromMatch
424424
* source type to match (subtypes of this will also match)

chimney/src/main/scala-2/io/scalaland/chimney/internal/compiletime/ChimneyTypesPlatform.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,9 @@ private[compiletime] trait ChimneyTypesPlatform extends ChimneyTypes { this: Chi
386386
}
387387
}
388388
object ForAll extends ForAllModule {
389-
def unapply[A](A: Type[A]): Option[(??, ??, ?<[runtime.TransformerOverrides], ?<[runtime.TransformerOverrides])] =
389+
def unapply[A](
390+
A: Type[A]
391+
): Option[(??, ??, ?<[runtime.TransformerOverrides], ?<[runtime.TransformerOverrides])] =
390392
A.asCtor[runtime.TransformerOverrides.ForAll[?, ?, ?, ?]].map { A0 =>
391393
(
392394
A0.param(0),

chimney/src/main/scala-3/io/scalaland/chimney/dsl/PartialTransformerDefinition.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -848,8 +848,8 @@ final class PartialTransformerDefinition[From, To, Overrides <: TransformerOverr
848848

849849
/** Scope overrides to apply to all derivations matching `[FromMatch, ToMatch]`.
850850
*
851-
* When chimney recursively derives transformations for nested types, any `forAll`-scoped overrides whose
852-
* `FromMatch` and `ToMatch` are supertypes of the current derivation pair will be injected.
851+
* When chimney recursively derives transformations for nested types, any `forAll`-scoped overrides whose `FromMatch`
852+
* and `ToMatch` are supertypes of the current derivation pair will be injected.
853853
*
854854
* @tparam FromMatch
855855
* source type to match (subtypes of this will also match)

chimney/src/main/scala-3/io/scalaland/chimney/dsl/TransformerDefinition.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,8 @@ final class TransformerDefinition[From, To, Overrides <: TransformerOverrides, F
432432

433433
/** Scope overrides to apply to all derivations matching `[FromMatch, ToMatch]`.
434434
*
435-
* When chimney recursively derives transformations for nested types, any `forAll`-scoped overrides whose
436-
* `FromMatch` and `ToMatch` are supertypes of the current derivation pair will be injected.
435+
* When chimney recursively derives transformations for nested types, any `forAll`-scoped overrides whose `FromMatch`
436+
* and `ToMatch` are supertypes of the current derivation pair will be injected.
437437
*
438438
* @tparam FromMatch
439439
* source type to match (subtypes of this will also match)

chimney/src/main/scala-3/io/scalaland/chimney/internal/compiletime/ChimneyTypesPlatform.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,9 @@ private[compiletime] trait ChimneyTypesPlatform extends ChimneyTypes { this: Chi
379379
}
380380
}
381381
object ForAll extends ForAllModule {
382-
def unapply[A](tpe: Type[A]): Option[(??, ??, ?<[runtime.TransformerOverrides], ?<[runtime.TransformerOverrides])] =
382+
def unapply[A](
383+
tpe: Type[A]
384+
): Option[(??, ??, ?<[runtime.TransformerOverrides], ?<[runtime.TransformerOverrides])] =
383385
tpe match {
384386
case '[runtime.TransformerOverrides.ForAll[fromMatch, toMatch, inner, tail]] =>
385387
Some(

chimney/src/main/scala-3/io/scalaland/chimney/internal/compiletime/derivation/transformer/TransformerMacros.scala

Lines changed: 52 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,16 @@ object TransformerMacros {
105105
(overridesType, flagsType) match {
106106
case ('[o], '[f]) =>
107107
new TransformerMacros(quotes)
108-
.deriveTotalTransformerWithConfig[From, To, o & runtime.TransformerOverrides, f & runtime.TransformerFlags, ImplicitScopeFlags](
109-
td.asInstanceOf[Expr[TransformerDefinition[From, To, o & runtime.TransformerOverrides, f & runtime.TransformerFlags]]]
108+
.deriveTotalTransformerWithConfig[
109+
From,
110+
To,
111+
o & runtime.TransformerOverrides,
112+
f & runtime.TransformerFlags,
113+
ImplicitScopeFlags
114+
](
115+
td.asInstanceOf[Expr[
116+
TransformerDefinition[From, To, o & runtime.TransformerOverrides, f & runtime.TransformerFlags]
117+
]]
110118
)
111119
}
112120
}
@@ -121,8 +129,16 @@ object TransformerMacros {
121129
val (overridesType, flagsType) = resolveOverridesAndFlagsTypes(td)
122130
(overridesType, flagsType) match {
123131
case ('[o], '[f]) =>
124-
val typedTd = td.asInstanceOf[Expr[TransformerDefinition[From, To, o & runtime.TransformerOverrides, f & runtime.TransformerFlags]]]
125-
new TransformerMacros(quotes).deriveTotalTransformationResult[From, To, o & runtime.TransformerOverrides, f & runtime.TransformerFlags, ImplicitScopeFlags](
132+
val typedTd = td.asInstanceOf[Expr[
133+
TransformerDefinition[From, To, o & runtime.TransformerOverrides, f & runtime.TransformerFlags]
134+
]]
135+
new TransformerMacros(quotes).deriveTotalTransformationResult[
136+
From,
137+
To,
138+
o & runtime.TransformerOverrides,
139+
f & runtime.TransformerFlags,
140+
ImplicitScopeFlags
141+
](
126142
source,
127143
'{ $typedTd.runtimeData }
128144
)
@@ -148,8 +164,16 @@ object TransformerMacros {
148164
(overridesType, flagsType) match {
149165
case ('[o], '[f]) =>
150166
new TransformerMacros(quotes)
151-
.derivePartialTransformerWithConfig[From, To, o & runtime.TransformerOverrides, f & runtime.TransformerFlags, ImplicitScopeFlags](
152-
td.asInstanceOf[Expr[PartialTransformerDefinition[From, To, o & runtime.TransformerOverrides, f & runtime.TransformerFlags]]]
167+
.derivePartialTransformerWithConfig[
168+
From,
169+
To,
170+
o & runtime.TransformerOverrides,
171+
f & runtime.TransformerFlags,
172+
ImplicitScopeFlags
173+
](
174+
td.asInstanceOf[Expr[
175+
PartialTransformerDefinition[From, To, o & runtime.TransformerOverrides, f & runtime.TransformerFlags]
176+
]]
153177
)
154178
}
155179
}
@@ -166,8 +190,16 @@ object TransformerMacros {
166190
val (overridesType, flagsType) = resolveOverridesAndFlagsTypes(td)
167191
(overridesType, flagsType) match {
168192
case ('[o], '[f]) =>
169-
val typedTd = td.asInstanceOf[Expr[PartialTransformerDefinition[From, To, o & runtime.TransformerOverrides, f & runtime.TransformerFlags]]]
170-
new TransformerMacros(quotes).derivePartialTransformationResult[From, To, o & runtime.TransformerOverrides, f & runtime.TransformerFlags, ImplicitScopeFlags](
193+
val typedTd = td.asInstanceOf[Expr[
194+
PartialTransformerDefinition[From, To, o & runtime.TransformerOverrides, f & runtime.TransformerFlags]
195+
]]
196+
new TransformerMacros(quotes).derivePartialTransformationResult[
197+
From,
198+
To,
199+
o & runtime.TransformerOverrides,
200+
f & runtime.TransformerFlags,
201+
ImplicitScopeFlags
202+
](
171203
source,
172204
Expr(failFast),
173205
'{ $typedTd.runtimeData }
@@ -184,7 +216,7 @@ object TransformerMacros {
184216

185217
def extractAllArgs(tpe: TypeRepr): Option[(Type[?], Type[?])] = {
186218
val args = tpe.dealias.typeArgs
187-
if (args.length >= 4) {
219+
if args.length >= 4 then {
188220
// Both Overrides (index 2) and Flags (index 3) must be concrete (not TypeBounds/wildcards)
189221
(args(2), args(3)) match {
190222
case (_: TypeBounds, _) | (_, _: TypeBounds) => None
@@ -210,29 +242,34 @@ object TransformerMacros {
210242
val flagsFromBaseType: Option[Type[?]] = widened.baseClasses.iterator
211243
.filter(cls => cls == tdClassSym || cls == ptdClassSym)
212244
.map(cls => widened.baseType(cls).typeArgs)
213-
.collectFirst { case args if args.length >= 4 && !args(3).match { case TypeBounds(_, _) => true; case _ => false } =>
214-
args(3).asType
245+
.collectFirst {
246+
case args if args.length >= 4 && !args(3).match { case TypeBounds(_, _) => true; case _ => false } =>
247+
args(3).asType
215248
}
216249

217250
// Get Overrides from the val definition's RHS tree
218251
val overridesFromTree: Option[Type[?]] = {
219252
val inner = term match { case Inlined(_, _, i) => i; case t => t }
220253
val sym = inner.symbol
221-
if (sym.isValDef) {
254+
if sym.isValDef then {
222255
sym.tree match {
223256
case ValDef(_, _, Some(rhs)) =>
224257
def findOverrides(t: Tree): Option[Type[?]] = t match {
225258
case Select(qualifier, _) =>
226259
val qTpe = qualifier.asInstanceOf[Term].tpe.widen.dealias
227260
val args = qTpe.typeArgs
228-
if (args.length >= 4 && !args(2).match { case TypeBounds(_, _) => true; case _ => false }) Some(args(2).asType)
261+
if args.length >= 4 && !args(2).match { case TypeBounds(_, _) => true; case _ => false } then Some(
262+
args(2).asType
263+
)
229264
else findOverrides(qualifier)
230265
case Inlined(_, _, inner) => findOverrides(inner)
231266
case Block(_, expr) => findOverrides(expr)
232-
case TypeApply(inner, _) =>
267+
case TypeApply(inner, _) =>
233268
val tTpe = t.asInstanceOf[Term].tpe.widen.dealias
234269
val args = tTpe.typeArgs
235-
if (args.length >= 4 && !args(2).match { case TypeBounds(_, _) => true; case _ => false }) Some(args(2).asType)
270+
if args.length >= 4 && !args(2).match { case TypeBounds(_, _) => true; case _ => false } then Some(
271+
args(2).asType
272+
)
236273
else findOverrides(inner)
237274
case _ => None
238275
}

0 commit comments

Comments
 (0)