Skip to content

Commit 285f1da

Browse files
authored
Merge pull request #17 from jatcwang/update_magnolia
update magnolia to new namespace
2 parents 54c762d + 2777e9f commit 285f1da

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

build.sbt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ lazy val core = Project("difflicious-core", file("modules/core"))
3636
.settings(commonSettings)
3737
.settings(
3838
libraryDependencies ++= Seq(
39-
if (isScala3.value) "com.softwaremill.magnolia1_3" %% "magnolia" % "1.0.0-M4"
39+
if (isScala3.value) "com.softwaremill.magnolia1_3" %% "magnolia" % "1.0.0-M7"
4040
// if (isScala3.value) "com.softwaremill.magnolia" %% "magnolia-core" % "2.0.0-M7-SNAPSHOT"
41-
else "com.softwaremill.magnolia" %% "magnolia-core" % "1.0.0-M4",
41+
else "com.softwaremill.magnolia1_2" %% "magnolia" % "1.0.0-M7",
4242
"dev.zio" %% "izumi-reflect" % "1.1.2",
4343
"com.lihaoyi" %% "fansi" % "0.2.14",
4444
) ++ (
@@ -114,7 +114,7 @@ lazy val docs: Project = project
114114
val orig = (ThisProject / makeMicrosite).taskValue
115115
if (isScala3.value) Def.task({})
116116
else Def.task(orig.value)
117-
}.value
117+
}.value,
118118
)
119119
.settings(
120120
mdocIn := file("docs/docs"),

modules/core/src/main/scala-2.13/difflicious/DifferGen.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ import difflicious.DiffResult.MismatchTypeResult
33
import difflicious.differ.RecordDiffer
44
import difflicious.internal.EitherGetSyntax._
55
import difflicious.utils.TypeName.SomeTypeName
6-
import magnolia._
6+
import magnolia1._
77

88
import scala.collection.mutable
99
import scala.collection.immutable.ListMap
1010

1111
trait DifferGen {
1212
type Typeclass[T] = Differ[T]
1313

14-
def combine[T](ctx: ReadOnlyCaseClass[Differ, T]): Differ[T] = {
14+
def join[T](ctx: ReadOnlyCaseClass[Differ, T]): Differ[T] = {
1515
new RecordDiffer[T](
1616
ctx.parameters
1717
.map { p =>
@@ -40,17 +40,17 @@ trait DifferGen {
4040

4141
override def diff(inputs: DiffInput[T]): DiffResult = inputs match {
4242
case DiffInput.ObtainedOnly(obtained) =>
43-
ctx.dispatch(obtained)(sub => sub.typeclass.diff(DiffInput.ObtainedOnly(sub.cast(obtained))))
43+
ctx.split(obtained)(sub => sub.typeclass.diff(DiffInput.ObtainedOnly(sub.cast(obtained))))
4444
case DiffInput.ExpectedOnly(expected) =>
45-
ctx.dispatch(expected)(sub => sub.typeclass.diff(DiffInput.ExpectedOnly(sub.cast(expected))))
45+
ctx.split(expected)(sub => sub.typeclass.diff(DiffInput.ExpectedOnly(sub.cast(expected))))
4646
case DiffInput.Both(obtained, expected) => {
47-
ctx.dispatch(obtained) { obtainedSubtype =>
48-
ctx.dispatch(expected) { expectedSubtype =>
47+
ctx.split(obtained) { obtainedSubtype =>
48+
ctx.split(expected) { expectedSubtype =>
4949
if (obtainedSubtype.typeName.short == expectedSubtype.typeName.short) {
5050
obtainedSubtype.typeclass
5151
.diff(
5252
obtainedSubtype.cast(obtained),
53-
expectedSubtype.cast(expected).asInstanceOf[obtainedSubtype.SType]
53+
expectedSubtype.cast(expected).asInstanceOf[obtainedSubtype.SType],
5454
)
5555
} else {
5656
MismatchTypeResult(
@@ -129,12 +129,12 @@ trait DifferGen {
129129

130130
}
131131

132-
def dispatch[T](ctx: SealedTrait[Differ, T]): Differ[T] =
132+
def split[T](ctx: SealedTrait[Differ, T]): Differ[T] =
133133
new SealedTraitDiffer[T](ctx, isIgnored = false)
134134

135135
def derived[T]: Differ[T] = macro Magnolia.gen[T]
136136

137-
private def toDiffliciousTypeName(typeName: magnolia.TypeName): SomeTypeName = {
137+
private def toDiffliciousTypeName(typeName: magnolia1.TypeName): SomeTypeName = {
138138
difflicious.utils.TypeName(
139139
long = typeName.full,
140140
short = typeName.short,

modules/core/src/main/scala-3/difflicious/DifferGen.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ trait DifferGen extends Derivation[Differ]:
2121
isIgnored = false,
2222
typeName = toDiffliciousTypeName(ctx.typeInfo)
2323
)
24-
24+
2525
override def split[T](ctx: SealedTrait[Differ, T]): Differ[T] =
2626
new SealedTraitDiffer(ctx, isIgnored = false)
2727

@@ -70,6 +70,7 @@ trait DifferGen extends Derivation[Differ]:
7070
subtypes = IArray(newSubtypes.toArray: _*),
7171
annotations = ctx.annotations,
7272
typeAnnotations = ctx.typeAnnotations,
73+
isEnum = ctx.isEnum,
7374
)
7475
new SealedTraitDiffer[T](newSealedTrait, isIgnored = newIgnored)
7576

@@ -99,6 +100,7 @@ trait DifferGen extends Derivation[Differ]:
99100
subtypes = newSubtypes,
100101
annotations = ctx.annotations,
101102
typeAnnotations = ctx.typeAnnotations,
103+
isEnum = ctx.isEnum,
102104
)
103105
new SealedTraitDiffer[T](newSealedTrait, isIgnored)
104106
}

0 commit comments

Comments
 (0)