This repository has been archived by the owner on Jan 24, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Prepare for migration - move scala2 code which cannot be migrated to separate directory * Compile base scala-3 code * Enable tests for product derivation * Enable basic tests for collections * Autoderivation should in the end returns Derived[Diff] * Convert Derived to value class so it can be inlined (this is required by inline macro in scala3) * Migrate ignore and modify macros to scala3 * Fix more of the DiffTest * Migrate modifyMacro test * Migrate ObjectMatcherTest * Migrate DiffModifyIntegrationTest * Fix docs compilation * Bring back use of auto-derivation in scala-2 tests * Fix js build * Unify return type of `derived` method across scala versions * Restore auto derivation for scala3 * Migrate useMatcher macro to scala3 * Uncomment "coproduct types with ignored fields" test * Split derivedDiff into two methods * Uncomment "set of products" test * Uncomment rest of DiffModifyIntegrationTest * Unify tests across scala versions * Migrate scalatest to scala3 * Enable scala3 for cats module * Enable scala3 for tagging module * Enable scala3 for munit * Add test for non case class instances to core * Make fallback work on scala3 * Change autoDerive to autoDerived * Cross compile core for scala3 js * Cross compile utest for scala3 and scala3 js * Enable autoDerivation in a way that works on all versions * Enable scala3 js for cats module * Enable scala3 js for tagging module * Enable scala3 js for munit module * Enable scala3 js for scalatest module * Run scalafmt across all modules * Simplify code as there is no need for DerivedLens anymore after switch to be an invariant tc * Add missing autoDerivation to specs2-test * Enable scala3 for refined module * Update diffx supported scala version * Add note on autoDerived method
- Loading branch information
1 parent
dee5ab9
commit c6c6b32
Showing
45 changed files
with
668 additions
and
353 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
version = 3.0.8 | ||
maxColumn = 120 | ||
runner.dialect = scala3 | ||
fileOverride { | ||
"glob:**/scala-2/**" { | ||
runner.dialect = scala213 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
core/src/main/scala-2/com/softwaremill/diffx/DiffCompanionMacro.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.softwaremill.diffx | ||
|
||
import com.softwaremill.diffx.generic.DiffMagnoliaDerivation | ||
import magnolia.Magnolia | ||
|
||
trait DiffCompanionMacro extends DiffMagnoliaDerivation { | ||
def derived[T]: Diff[T] = macro Magnolia.gen[T] | ||
} |
5 changes: 5 additions & 0 deletions
5
core/src/main/scala-2/com/softwaremill/diffx/DiffLensMacro.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.softwaremill.diffx | ||
|
||
trait DiffLensMacro[T, U] { | ||
def useMatcher[M](matcher: ObjectMatcher[M]): Diff[T] = macro ModifyMacro.withObjectMatcher[T, U, M] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.softwaremill.diffx | ||
|
||
trait DiffMacro[T] { | ||
def modify[U](path: T => U): DiffLens[T, U] = macro ModifyMacro.modifyMacro[T, U] | ||
def ignore[U](path: T => U)(implicit conf: DiffConfiguration): Diff[T] = macro ModifyMacro.ignoreMacro[T, U] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
8 changes: 8 additions & 0 deletions
8
core/src/main/scala-3/com/softwaremill/diffx/DiffCompanionMacro.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.softwaremill.diffx | ||
|
||
import com.softwaremill.diffx.generic.DiffMagnoliaDerivation | ||
import com.softwaremill.diffx.generic.auto.DiffAutoDerivationOn | ||
|
||
trait DiffCompanionMacro extends DiffMagnoliaDerivation { | ||
given fallback[T](using DiffAutoDerivationOn): Derived[Diff[T]] = Derived(Diff.useEquals[T]) | ||
} |
7 changes: 7 additions & 0 deletions
7
core/src/main/scala-3/com/softwaremill/diffx/DiffLensMacro.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.softwaremill.diffx | ||
|
||
trait DiffLensMacro[T, U] { outer: DiffLens[T, U] => | ||
inline def useMatcher[M](inline matcher: ObjectMatcher[M]): Diff[T] = ${ | ||
ModifyMacro.withObjectMatcher[T, U, M]('outer)('matcher) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.softwaremill.diffx | ||
|
||
trait DiffMacro[T] { outer: Diff[T] => | ||
inline def modify[U](inline path: T => U): DiffLens[T, U] = ${ ModifyMacro.modifyMacro[T, U]('outer)('path) } | ||
inline def ignore[U](inline path: T => U)(implicit config: DiffConfiguration): Diff[T] = ${ | ||
ModifyMacro.ignoreMacro[T, U]('outer)('path, 'config) | ||
} | ||
} |
Oops, something went wrong.