Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: scalalandio/chimney
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.7.5
Choose a base ref
...
head repository: scalalandio/chimney
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0.8.0-M1
Choose a head ref
Loading
Showing with 17,936 additions and 17,987 deletions.
  1. +1 −1 .github/ISSUE_TEMPLATE/bug_report.md
  2. +1 −1 .github/ISSUE_TEMPLATE/feature_request.md
  3. +3 −3 .github/workflows/ci.yml
  4. +0 −19 .github/workflows/docs.yml
  5. +12 −7 .gitignore
  6. +1 −0 .jvmopts
  7. +16 −0 .readthedocs.yaml
  8. +9 −3 .scalafmt.conf
  9. +4 −1 CONTRIBUTING.md
  10. +201 −0 DESIGN.md
  11. +14 −21 README.md
  12. +1 −11 benchmarks/src/main/scala/io/scalaland/chimney/benchmarks/ErrorAccLarge.scala
  13. +0 −14 benchmarks/src/main/scala/io/scalaland/chimney/benchmarks/ErrorAccNestedLarge.scala
  14. +66 −46 benchmarks/src/main/scala/io/scalaland/chimney/benchmarks/ErrorAccSimple.scala
  15. +2 −82 benchmarks/src/main/scala/io/scalaland/chimney/benchmarks/fixtures.scala
  16. +220 −99 build.sbt
  17. +1 −2 ...ts → chimney-cats}/src/main/scala/io/scalaland/chimney/cats/CatsPartialTransformerImplicits.scala
  18. +4 −0 chimney-cats/src/main/scala/io/scalaland/chimney/cats/package.scala
  19. +15 −0 ...ey-cats/src/test/scala/io/scalaland/chimney/cats/PartialTransformerResultErrorSemigroupSpec.scala
  20. +31 −0 chimney-cats/src/test/scala/io/scalaland/chimney/cats/PartialTransformerResultSemigroupalSpec.scala
  21. +128 −0 ...ey-cats/src/test/scala/io/scalaland/chimney/cats/PartialTransformerToCatsDataConversionSpec.scala
  22. +3 −6 {chimneyCats → chimney-cats}/src/test/scala/io/scalaland/chimney/cats/utils/ValidatedUtils.scala
  23. +15 −0 ...acro-commons/src/main/scala-2/io/scalaland/chimney/internal/compiletime/DefinitionsPlatform.scala
  24. +84 −0 ...cro-commons/src/main/scala-2/io/scalaland/chimney/internal/compiletime/ExprPromisesPlatform.scala
  25. +156 −0 chimney-macro-commons/src/main/scala-2/io/scalaland/chimney/internal/compiletime/ExprsPlatform.scala
  26. +8 −0 ...ey-macro-commons/src/main/scala-2/io/scalaland/chimney/internal/compiletime/ResultsPlatform.scala
  27. +163 −0 chimney-macro-commons/src/main/scala-2/io/scalaland/chimney/internal/compiletime/TypesPlatform.scala
  28. +239 −0 ...s/src/main/scala-2/io/scalaland/chimney/internal/compiletime/datatypes/ProductTypesPlatform.scala
  29. +37 −0 .../main/scala-2/io/scalaland/chimney/internal/compiletime/datatypes/SealedHierarchiesPlatform.scala
  30. +55 −0 ...s/src/main/scala-2/io/scalaland/chimney/internal/compiletime/datatypes/ValueClassesPlatform.scala
  31. +10 −0 ...acro-commons/src/main/scala-3/io/scalaland/chimney/internal/compiletime/DefinitionsPlatform.scala
  32. +145 −0 ...cro-commons/src/main/scala-3/io/scalaland/chimney/internal/compiletime/ExprPromisesPlatform.scala
  33. +132 −0 chimney-macro-commons/src/main/scala-3/io/scalaland/chimney/internal/compiletime/ExprsPlatform.scala
  34. +10 −0 ...ey-macro-commons/src/main/scala-3/io/scalaland/chimney/internal/compiletime/ResultsPlatform.scala
  35. +191 −0 chimney-macro-commons/src/main/scala-3/io/scalaland/chimney/internal/compiletime/TypesPlatform.scala
  36. +245 −0 ...s/src/main/scala-3/io/scalaland/chimney/internal/compiletime/datatypes/ProductTypesPlatform.scala
  37. +43 −0 .../main/scala-3/io/scalaland/chimney/internal/compiletime/datatypes/SealedHierarchiesPlatform.scala
  38. +57 −0 ...s/src/main/scala-3/io/scalaland/chimney/internal/compiletime/datatypes/ValueClassesPlatform.scala
  39. +3 −0 chimney-macro-commons/src/main/scala/io/scalaland/chimney/internal/compiletime/Definitions.scala
  40. +94 −0 chimney-macro-commons/src/main/scala/io/scalaland/chimney/internal/compiletime/Existentials.scala
  41. +241 −0 chimney-macro-commons/src/main/scala/io/scalaland/chimney/internal/compiletime/ExprPromises.scala
  42. +229 −0 chimney-macro-commons/src/main/scala/io/scalaland/chimney/internal/compiletime/Exprs.scala
  43. +13 −0 chimney-macro-commons/src/main/scala/io/scalaland/chimney/internal/compiletime/Results.scala
  44. +181 −0 chimney-macro-commons/src/main/scala/io/scalaland/chimney/internal/compiletime/Types.scala
  45. +81 −0 ...commons/src/main/scala/io/scalaland/chimney/internal/compiletime/datatypes/IterableOrArrays.scala
  46. +204 −0 ...cro-commons/src/main/scala/io/scalaland/chimney/internal/compiletime/datatypes/ProductTypes.scala
  47. +31 −0 ...ommons/src/main/scala/io/scalaland/chimney/internal/compiletime/datatypes/SealedHierarchies.scala
  48. +50 −0 ...cro-commons/src/main/scala/io/scalaland/chimney/internal/compiletime/datatypes/ValueClasses.scala
  49. +32 −0 chimney-macro-commons/src/main/scala/io/scalaland/chimney/internal/compiletime/fp/Applicative.scala
  50. +11 −0 ...cro-commons/src/main/scala/io/scalaland/chimney/internal/compiletime/fp/ApplicativeTraverse.scala
  51. +15 −0 chimney-macro-commons/src/main/scala/io/scalaland/chimney/internal/compiletime/fp/Functor.scala
  52. +37 −0 chimney-macro-commons/src/main/scala/io/scalaland/chimney/internal/compiletime/fp/Implicits.scala
  53. +15 −0 chimney-macro-commons/src/main/scala/io/scalaland/chimney/internal/compiletime/fp/Parallel.scala
  54. +7 −0 ...-macro-commons/src/main/scala/io/scalaland/chimney/internal/compiletime/fp/ParallelTraverse.scala
  55. +33 −0 chimney-macro-commons/src/main/scala/io/scalaland/chimney/internal/compiletime/fp/Traverse.scala
  56. +0 −11 chimney/src/main/scala-2.12/io/scalaland/chimney/internal/utils/EitherOrElseCompat.scala
  57. +0 −5 chimney/src/main/scala-2.13/io/scalaland/chimney/internal/utils/EitherOrElseCompat.scala
  58. +25 −0 chimney/src/main/scala-2/io/scalaland/chimney/PartialTransformerCompanionPlatform.scala
  59. +19 −0 chimney/src/main/scala-2/io/scalaland/chimney/PatcherCompanionPlatform.scala
  60. +23 −0 chimney/src/main/scala-2/io/scalaland/chimney/TransformerCompanionPlatform.scala
  61. +33 −26 chimney/src/main/{scala → scala-2}/io/scalaland/chimney/dsl/PartialTransformerDefinition.scala
  62. +30 −32 chimney/src/main/{scala → scala-2}/io/scalaland/chimney/dsl/PartialTransformerInto.scala
  63. +24 −15 chimney/src/main/{scala → scala-2}/io/scalaland/chimney/dsl/PatcherUsing.scala
  64. +128 −0 chimney/src/main/scala-2/io/scalaland/chimney/dsl/TransformerDefinition.scala
  65. +16 −0 chimney/src/main/scala-2/io/scalaland/chimney/dsl/TransformerDefinitionCommons.scala
  66. +126 −0 chimney/src/main/scala-2/io/scalaland/chimney/dsl/TransformerInto.scala
  67. +4 −66 chimney/src/main/{scala → scala-2}/io/scalaland/chimney/dsl/package.scala
  68. +7 −0 chimney/src/main/scala-2/io/scalaland/chimney/internal/compiletime/ChimneyDefinitionsPlatform.scala
  69. +208 −0 chimney/src/main/scala-2/io/scalaland/chimney/internal/compiletime/ChimneyExprsPlatform.scala
  70. +192 −0 chimney/src/main/scala-2/io/scalaland/chimney/internal/compiletime/ChimneyTypesPlatform.scala
  71. +5 −0 ...ain/scala-2/io/scalaland/chimney/internal/compiletime/derivation/patcher/DerivationPlatform.scala
  72. +22 −0 ...src/main/scala-2/io/scalaland/chimney/internal/compiletime/derivation/patcher/PatcherMacros.scala
  73. +40 −0 ...scala-2/io/scalaland/chimney/internal/compiletime/derivation/transformer/DerivationPlatform.scala
  74. +189 −0 .../scala-2/io/scalaland/chimney/internal/compiletime/derivation/transformer/TransformerMacros.scala
  75. +101 −0 ...in/scala-2/io/scalaland/chimney/internal/compiletime/dsl/PartialTransformerDefinitionMacros.scala
  76. +102 −0 ...src/main/scala-2/io/scalaland/chimney/internal/compiletime/dsl/PartialTransformerIntoMacros.scala
  77. +64 −0 .../src/main/scala-2/io/scalaland/chimney/internal/compiletime/dsl/TransformerDefinitionMacros.scala
  78. +64 −0 chimney/src/main/scala-2/io/scalaland/chimney/internal/compiletime/dsl/TransformerIntoMacros.scala
  79. +82 −0 chimney/src/main/scala-2/io/scalaland/chimney/internal/compiletime/dsl/utils/DslMacroUtils.scala
  80. +24 −0 chimney/src/main/scala-3/io/scalaland/chimney/PartialTransformerCompanionPlatform.scala
  81. +16 −0 chimney/src/main/scala-3/io/scalaland/chimney/PatcherCompanionPlatform.scala
  82. +21 −0 chimney/src/main/scala-3/io/scalaland/chimney/TransformerCompanionPlatform.scala
  83. +172 −0 chimney/src/main/scala-3/io/scalaland/chimney/dsl/PartialTransformerDefinition.scala
  84. +193 −0 chimney/src/main/scala-3/io/scalaland/chimney/dsl/PartialTransformerInto.scala
  85. +67 −0 chimney/src/main/scala-3/io/scalaland/chimney/dsl/PatcherUsing.scala
  86. +127 −0 chimney/src/main/scala-3/io/scalaland/chimney/dsl/TransformerDefinition.scala
  87. +22 −0 chimney/src/main/scala-3/io/scalaland/chimney/dsl/TransformerDefinitionCommons.scala
  88. +124 −0 chimney/src/main/scala-3/io/scalaland/chimney/dsl/TransformerInto.scala
  89. +205 −0 chimney/src/main/scala-3/io/scalaland/chimney/dsl/extensions.scala
  90. +7 −0 chimney/src/main/scala-3/io/scalaland/chimney/internal/compiletime/ChimneyDefinitionsPlatform.scala
  91. +169 −0 chimney/src/main/scala-3/io/scalaland/chimney/internal/compiletime/ChimneyExprsPlatform.scala
  92. +190 −0 chimney/src/main/scala-3/io/scalaland/chimney/internal/compiletime/ChimneyTypesPlatform.scala
  93. +7 −0 ...ain/scala-3/io/scalaland/chimney/internal/compiletime/derivation/patcher/DerivationPlatform.scala
  94. +19 −0 ...src/main/scala-3/io/scalaland/chimney/internal/compiletime/derivation/patcher/PatcherMacros.scala
  95. +41 −0 ...scala-3/io/scalaland/chimney/internal/compiletime/derivation/transformer/DerivationPlatform.scala
  96. +150 −0 .../scala-3/io/scalaland/chimney/internal/compiletime/derivation/transformer/TransformerMacros.scala
  97. +77 −0 chimney/src/main/scala-3/io/scalaland/chimney/internal/compiletime/dsl/FieldNameUtils.scala
  98. +170 −0 ...in/scala-3/io/scalaland/chimney/internal/compiletime/dsl/PartialTransformerDefinitionMacros.scala
  99. +175 −0 ...src/main/scala-3/io/scalaland/chimney/internal/compiletime/dsl/PartialTransformerIntoMacros.scala
  100. +106 −0 .../src/main/scala-3/io/scalaland/chimney/internal/compiletime/dsl/TransformerDefinitionMacros.scala
  101. +108 −0 chimney/src/main/scala-3/io/scalaland/chimney/internal/compiletime/dsl/TransformerIntoMacros.scala
  102. +0 −50 chimney/src/main/scala/io/scalaland/chimney/ErrorPathNode.scala
  103. +17 −27 chimney/src/main/scala/io/scalaland/chimney/PartialTransformer.scala
  104. +4 −21 chimney/src/main/scala/io/scalaland/chimney/Patcher.scala
  105. +0 −24 chimney/src/main/scala/io/scalaland/chimney/TransformationError.scala
  106. +7 −43 chimney/src/main/scala/io/scalaland/chimney/Transformer.scala
  107. +0 −76 chimney/src/main/scala/io/scalaland/chimney/TransformerF.scala
  108. +0 −50 chimney/src/main/scala/io/scalaland/chimney/TransformerFErrorPathSupport.scala
  109. +0 −178 chimney/src/main/scala/io/scalaland/chimney/TransformerFSupport.scala
  110. +32 −39 chimney/src/main/scala/io/scalaland/chimney/dsl/FlagsDsl.scala
  111. +6 −2 chimney/src/main/scala/io/scalaland/chimney/dsl/TransformerConfiguration.scala
  112. +0 −204 chimney/src/main/scala/io/scalaland/chimney/dsl/TransformerDefinition.scala
  113. +0 −33 chimney/src/main/scala/io/scalaland/chimney/dsl/TransformerDefinitionCommons.scala
  114. +0 −188 chimney/src/main/scala/io/scalaland/chimney/dsl/TransformerFDefinition.scala
  115. +0 −188 chimney/src/main/scala/io/scalaland/chimney/dsl/TransformerFInto.scala
  116. +0 −203 chimney/src/main/scala/io/scalaland/chimney/dsl/TransformerInto.scala
  117. +0 −44 chimney/src/main/scala/io/scalaland/chimney/internal/PatcherCfg.scala
  118. +0 −17 chimney/src/main/scala/io/scalaland/chimney/internal/TransformerCfg.scala
  119. +3 −0 chimney/src/main/scala/io/scalaland/chimney/internal/compiletime/ChimneyDefinitions.scala
  120. +177 −0 chimney/src/main/scala/io/scalaland/chimney/internal/compiletime/ChimneyExprs.scala
  121. +195 −0 chimney/src/main/scala/io/scalaland/chimney/internal/compiletime/ChimneyTypes.scala
  122. +41 −0 chimney/src/main/scala/io/scalaland/chimney/internal/compiletime/DerivationError.scala
  123. +19 −0 chimney/src/main/scala/io/scalaland/chimney/internal/compiletime/DerivationErrors.scala
  124. +276 −0 chimney/src/main/scala/io/scalaland/chimney/internal/compiletime/DerivationResult.scala
  125. +34 −0 chimney/src/main/scala/io/scalaland/chimney/internal/compiletime/Log.scala
  126. +23 −0 chimney/src/main/scala/io/scalaland/chimney/internal/compiletime/PatcherDerivationError.scala
  127. +16 −12 ...ey/src/main/scala/io/scalaland/chimney/internal/{ → compiletime}/TransformerDerivationError.scala
  128. +55 −0 chimney/src/main/scala/io/scalaland/chimney/internal/compiletime/derivation/GatewayCommons.scala
  129. +37 −0 .../src/main/scala/io/scalaland/chimney/internal/compiletime/derivation/patcher/Configurations.scala
  130. +37 −0 chimney/src/main/scala/io/scalaland/chimney/internal/compiletime/derivation/patcher/Contexts.scala
  131. +158 −0 chimney/src/main/scala/io/scalaland/chimney/internal/compiletime/derivation/patcher/Derivation.scala
  132. +59 −0 chimney/src/main/scala/io/scalaland/chimney/internal/compiletime/derivation/patcher/Gateway.scala
  133. +10 −0 ...c/main/scala/io/scalaland/chimney/internal/compiletime/derivation/patcher/ImplicitSummoning.scala
  134. +240 −0 .../main/scala/io/scalaland/chimney/internal/compiletime/derivation/transformer/Configurations.scala
  135. +160 −0 ...ey/src/main/scala/io/scalaland/chimney/internal/compiletime/derivation/transformer/Contexts.scala
  136. +43 −0 .../src/main/scala/io/scalaland/chimney/internal/compiletime/derivation/transformer/Derivation.scala
  137. +154 −0 ...ney/src/main/scala/io/scalaland/chimney/internal/compiletime/derivation/transformer/Gateway.scala
  138. +33 −0 ...in/scala/io/scalaland/chimney/internal/compiletime/derivation/transformer/ImplicitSummoning.scala
  139. +138 −0 ...y/src/main/scala/io/scalaland/chimney/internal/compiletime/derivation/transformer/ResultOps.scala
  140. +101 −0 ...chimney/internal/compiletime/derivation/transformer/rules/TransformEitherToEitherRuleModule.scala
  141. +47 −0 ...aland/chimney/internal/compiletime/derivation/transformer/rules/TransformImplicitRuleModule.scala
  142. +137 −0 ...ney/internal/compiletime/derivation/transformer/rules/TransformIterableToIterableRuleModule.scala
  143. +76 −0 ...aland/chimney/internal/compiletime/derivation/transformer/rules/TransformMapToMapRuleModule.scala
  144. +68 −0 ...chimney/internal/compiletime/derivation/transformer/rules/TransformOptionToOptionRuleModule.scala
  145. +35 −0 ...ternal/compiletime/derivation/transformer/rules/TransformPartialOptionToNonOptionRuleModule.scala
  146. +540 −0 ...imney/internal/compiletime/derivation/transformer/rules/TransformProductToProductRuleModule.scala
  147. +187 −0 ...ompiletime/derivation/transformer/rules/TransformSealedHierarchyToSealedHierarchyRuleModule.scala
  148. +18 −0 ...aland/chimney/internal/compiletime/derivation/transformer/rules/TransformSubtypesRuleModule.scala
  149. +26 −0 ...aland/chimney/internal/compiletime/derivation/transformer/rules/TransformToOptionRuleModule.scala
  150. +35 −0 ...imney/internal/compiletime/derivation/transformer/rules/TransformTypeToValueClassRuleModule.scala
  151. +33 −0 ...imney/internal/compiletime/derivation/transformer/rules/TransformValueClassToTypeRuleModule.scala
  152. +24 −0 ...internal/compiletime/derivation/transformer/rules/TransformValueClassToValueClassRuleModule.scala
  153. +137 −0 .../io/scalaland/chimney/internal/compiletime/derivation/transformer/rules/TransformationRules.scala
  154. +0 −151 chimney/src/main/scala/io/scalaland/chimney/internal/macros/GenTrees.scala
  155. +0 −228 chimney/src/main/scala/io/scalaland/chimney/internal/macros/MappingMacros.scala
  156. +0 −68 chimney/src/main/scala/io/scalaland/chimney/internal/macros/Model.scala
  157. +0 −137 chimney/src/main/scala/io/scalaland/chimney/internal/macros/PatcherMacros.scala
  158. +0 −312 chimney/src/main/scala/io/scalaland/chimney/internal/macros/TargetConstructorMacros.scala
  159. +0 −342 chimney/src/main/scala/io/scalaland/chimney/internal/macros/TransformerConfigSupport.scala
  160. +0 −1,137 chimney/src/main/scala/io/scalaland/chimney/internal/macros/TransformerMacros.scala
  161. +0 −45 ...n/scala/io/scalaland/chimney/internal/macros/dsl/PartialTransformerDefinitionWhiteboxMacros.scala
  162. +0 −57 ...rc/main/scala/io/scalaland/chimney/internal/macros/dsl/PartialTransformerIntoWhiteboxMacros.scala
  163. +0 −19 chimney/src/main/scala/io/scalaland/chimney/internal/macros/dsl/PatcherBlackboxMacros.scala
  164. +0 −143 chimney/src/main/scala/io/scalaland/chimney/internal/macros/dsl/TransformerBlackboxMacros.scala
  165. +0 −42 ...src/main/scala/io/scalaland/chimney/internal/macros/dsl/TransformerDefinitionWhiteboxMacros.scala
  166. +0 −46 ...rc/main/scala/io/scalaland/chimney/internal/macros/dsl/TransformerFDefinitionWhiteboxMacros.scala
  167. +0 −58 chimney/src/main/scala/io/scalaland/chimney/internal/macros/dsl/TransformerFIntoWhiteboxMacros.scala
  168. +0 −48 chimney/src/main/scala/io/scalaland/chimney/internal/macros/dsl/TransformerIntoWhiteboxMacros.scala
  169. +8 −15 chimney/src/main/scala/io/scalaland/chimney/internal/{ → runtime}/NonEmptyErrorsChain.scala
  170. +9 −0 chimney/src/main/scala/io/scalaland/chimney/internal/runtime/PatcherCfg.scala
  171. +13 −0 chimney/src/main/scala/io/scalaland/chimney/internal/runtime/TransformerCfg.scala
  172. +2 −2 chimney/src/main/scala/io/scalaland/chimney/internal/{ → runtime}/TransformerFlags.scala
  173. +11 −0 chimney/src/main/scala/io/scalaland/chimney/internal/runtime/WithRuntimeDataStore.scala
  174. +0 −16 chimney/src/main/scala/io/scalaland/chimney/internal/utils/AssertUtils.scala
  175. +0 −30 chimney/src/main/scala/io/scalaland/chimney/internal/utils/CompanionUtils.scala
  176. +0 −87 chimney/src/main/scala/io/scalaland/chimney/internal/utils/DslMacroUtils.scala
  177. +0 −17 chimney/src/main/scala/io/scalaland/chimney/internal/utils/EitherUtils.scala
  178. +0 −322 chimney/src/main/scala/io/scalaland/chimney/internal/utils/MacroUtils.scala
  179. +0 −117 chimney/src/main/scala/io/scalaland/chimney/internal/utils/TypeTestUtils.scala
  180. +1 −1 chimney/src/main/scala/io/scalaland/chimney/partial/ErrorMessage.scala
  181. +2 −3 chimney/src/main/scala/io/scalaland/chimney/partial/Path.scala
  182. +60 −64 chimney/src/main/scala/io/scalaland/chimney/partial/Result.scala
  183. +21 −0 chimney/src/test/scala-2/io/scalaland/chimney/VersionCompat.scala
  184. +401 −0 chimney/src/test/scala-3/io/scalaland/chimney/PartialTransformerEnumSpec.scala
  185. +234 −0 chimney/src/test/scala-3/io/scalaland/chimney/TotalTransformerEnumSpec.scala
  186. +31 −0 chimney/src/test/scala-3/io/scalaland/chimney/VersionCompat.scala
  187. +19 −0 chimney/src/test/scala-3/io/scalaland/chimney/fixtures/ColorsEnums.scala
  188. +55 −0 chimney/src/test/scala-3/io/scalaland/chimney/fixtures/NumbersEnums.scala
  189. +66 −0 chimney/src/test/scala-3/io/scalaland/chimney/fixtures/ShapesEnums.scala
  190. +60 −0 chimney/src/test/scala/io/scalaland/chimney/ChimneySpec.scala
  191. +484 −624 chimney/src/test/scala/io/scalaland/chimney/IssuesSpec.scala
  192. +0 −187 chimney/src/test/scala/io/scalaland/chimney/LiftedTransformerErrorPathSpec.scala
  193. +0 −91 chimney/src/test/scala/io/scalaland/chimney/LiftedTransformerImplicitResolutionSpec.scala
  194. +0 −687 chimney/src/test/scala/io/scalaland/chimney/LiftedTransformerJavaBeanSpec.scala
  195. +0 −1,384 chimney/src/test/scala/io/scalaland/chimney/LiftedTransformerProductSpec.scala
  196. +0 −759 chimney/src/test/scala/io/scalaland/chimney/LiftedTransformerSdtLibTypesSpec.scala
  197. +0 −512 chimney/src/test/scala/io/scalaland/chimney/LiftedTransformerSumTypeSpec.scala
  198. +0 −129 chimney/src/test/scala/io/scalaland/chimney/LiftedTransformerValueTypeSpec.scala
  199. +0 −213 chimney/src/test/scala/io/scalaland/chimney/PBTransformationSpec.scala
  200. +608 −616 chimney/src/test/scala/io/scalaland/chimney/PartialResultSpec.scala
  201. +194 −193 chimney/src/test/scala/io/scalaland/chimney/PartialTransformerErrorPathSpec.scala
  202. +66 −70 chimney/src/test/scala/io/scalaland/chimney/PartialTransformerImplicitResolutionSpec.scala
  203. +235 −210 chimney/src/test/scala/io/scalaland/chimney/PartialTransformerJavaBeanSpec.scala
  204. +934 −770 chimney/src/test/scala/io/scalaland/chimney/PartialTransformerProductSpec.scala
  205. +337 −0 chimney/src/test/scala/io/scalaland/chimney/PartialTransformerSealedHierarchySpec.scala
  206. +40 −35 chimney/src/test/scala/io/scalaland/chimney/PartialTransformerSpec.scala
  207. +401 −457 chimney/src/test/scala/io/scalaland/chimney/PartialTransformerStdLibTypesSpec.scala
  208. +0 −311 chimney/src/test/scala/io/scalaland/chimney/PartialTransformerSumTypeSpec.scala
  209. +56 −42 chimney/src/test/scala/io/scalaland/chimney/PartialTransformerValueTypeSpec.scala
  210. +105 −109 chimney/src/test/scala/io/scalaland/chimney/PatcherSpec.scala
  211. +18 −22 chimney/src/test/scala/io/scalaland/chimney/TotalTransformerImplicitResolutionSpec.scala
  212. +216 −195 chimney/src/test/scala/io/scalaland/chimney/TotalTransformerJavaBeansSpec.scala
  213. +546 −486 chimney/src/test/scala/io/scalaland/chimney/TotalTransformerProductSpec.scala
  214. +199 −0 chimney/src/test/scala/io/scalaland/chimney/TotalTransformerSealedHierarchySpec.scala
  215. +153 −190 chimney/src/test/scala/io/scalaland/chimney/TotalTransformerStdLibTypesSpec.scala
  216. +0 −176 chimney/src/test/scala/io/scalaland/chimney/TotalTransformerSumTypeSpec.scala
  217. +54 −43 chimney/src/test/scala/io/scalaland/chimney/TotalTransformerValueTypeSpec.scala
  218. +0 −17 chimney/src/test/scala/io/scalaland/chimney/examples/Issues.scala
  219. +0 −92 chimney/src/test/scala/io/scalaland/chimney/examples/Numbers.scala
  220. +3 −3 chimney/src/test/scala/io/scalaland/chimney/{examples → fixtures}/Colors.scala
  221. +172 −0 chimney/src/test/scala/io/scalaland/chimney/fixtures/Issues.scala
  222. +19 −0 chimney/src/test/scala/io/scalaland/chimney/fixtures/Misc.scala
  223. +55 −0 chimney/src/test/scala/io/scalaland/chimney/fixtures/Numbers.scala
  224. +14 −1 chimney/src/test/scala/io/scalaland/chimney/{examples → fixtures}/Shapes.scala
  225. +1 −1 chimney/src/test/scala/io/scalaland/chimney/{examples → fixtures}/Trip.scala
  226. +7 −1 chimney/src/test/scala/io/scalaland/chimney/{examples → fixtures}/addressbook/AddressBook.scala
  227. +34 −16 chimney/src/test/scala/io/scalaland/chimney/{examples → fixtures}/javabeans/javabeans.scala
  228. +1 −1 ...ney/src/test/scala/io/scalaland/chimney/{examples/order/Order.scala → fixtures/order/order.scala}
  229. +13 −3 chimney/src/test/scala/io/scalaland/chimney/{examples → fixtures}/products/products.scala
  230. +5 −1 chimney/src/test/scala/io/scalaland/chimney/{examples → fixtures}/valuetypes/valuetypes.scala
  231. +68 −71 chimney/src/test/scala/io/scalaland/chimney/internal/NonEmptyErrorsChainSpec.scala
  232. +2 −4 chimney/src/test/scala/io/scalaland/chimney/utils/EitherUtils.scala
  233. +0 −132 chimneyCats/src/main/scala/io/scalaland/chimney/cats/CatsTransformerFImplicits.scala
  234. +0 −4 chimneyCats/src/main/scala/io/scalaland/chimney/cats/package.scala
  235. +0 −128 ...src/test/scala/io/scalaland/chimney/cats/LiftedTransformerErrorPathValidatedNecInstanceSpec.scala
  236. +0 −128 ...src/test/scala/io/scalaland/chimney/cats/LiftedTransformerErrorPathValidatedNelInstanceSpec.scala
  237. +0 −453 chimneyCats/src/test/scala/io/scalaland/chimney/cats/LiftedTransformerIorNecInstanceSpec.scala
  238. +0 −453 chimneyCats/src/test/scala/io/scalaland/chimney/cats/LiftedTransformerIorNelInstanceSpec.scala
  239. +0 −453 chimneyCats/src/test/scala/io/scalaland/chimney/cats/LiftedTransformerIorNesInstanceSpec.scala
  240. +0 −433 chimneyCats/src/test/scala/io/scalaland/chimney/cats/LiftedTransformerValidatedNecInstanceSpec.scala
  241. +0 −433 chimneyCats/src/test/scala/io/scalaland/chimney/cats/LiftedTransformerValidatedNelInstanceSpec.scala
  242. +0 −19 ...neyCats/src/test/scala/io/scalaland/chimney/cats/PartialTransformerResultErrorSemigroupSpec.scala
  243. +0 −35 chimneyCats/src/test/scala/io/scalaland/chimney/cats/PartialTransformerResultSemigroupalSpec.scala
  244. +0 −132 ...neyCats/src/test/scala/io/scalaland/chimney/cats/PartialTransformerToCatsDataConversionSpec.scala
  245. +2 −2 docs/source/conf.py
  246. +175 −0 docs/source/cookbook/libraries-with-smart-constructors.rst
  247. +352 −0 docs/source/cookbook/protocol-buffers.rst
  248. +1 −2 docs/source/getting-started/community.rst
  249. +5 −5 docs/source/getting-started/quickstart.rst
  250. +20 −9 docs/source/index.rst
  251. +0 −261 docs/source/lifted-transformers/cats-integration.rst
  252. +0 −491 docs/source/lifted-transformers/lifted-transformers.rst
  253. +100 −0 docs/source/migration/migration-to-0.8.rst
  254. +1 −3 docs/source/partial-transformers/cats-integration.rst
  255. +1 −1 docs/source/partial-transformers/migrating-from-lifted.rst
  256. +2 −2 docs/source/transformers/customizing-transformers.rst
  257. +1 −1 docs/source/transformers/default-values.rst
  258. +0 −89 docs/source/transformers/unsafe-options.rst
  259. +170 −0 docs/source/troubleshooting/debugging-macros.rst
  260. +51 −0 docs/source/troubleshooting/known-issues-and-limitations.rst
  261. +0 −3 docs/watch.sh
  262. +1 −1 project/build.properties
  263. +11 −8 project/plugins.sbt
  264. +42 −0 protobufs/src/main/protobuf/addressbook.proto
  265. 0 .../src/test/scala/io.scalaland.chimney.examples.pb.order → protobufs/src/main/protobuf}/order.proto
  266. +233 −0 protobufs/src/test/scala/io/scalaland/chimney/PBTransformationSpec.scala
  267. +0 −12 protos/src/test/scala/io.scalaland.chimney.examples.pb.addressbook/AddressBook.scala
  268. +0 −18 protos/src/test/scala/io.scalaland.chimney.examples.pb.addressbook/Person.scala
  269. +0 −13 protos/src/test/scala/io.scalaland.chimney.examples.pb.addressbook/PhoneNumber.scala
  270. +0 −51 protos/src/test/scala/io.scalaland.chimney.examples.pb.addressbook/PhoneType.scala
  271. +0 −13 protos/src/test/scala/io.scalaland.chimney.examples.pb.order/Address.scala
  272. +0 −14 protos/src/test/scala/io.scalaland.chimney.examples.pb.order/Customer.scala
  273. +0 −22 protos/src/test/scala/io.scalaland.chimney.examples.pb.order/CustomerStatus.scala
  274. +0 −12 protos/src/test/scala/io.scalaland.chimney.examples.pb.order/Item.scala
  275. +0 −12 protos/src/test/scala/io.scalaland.chimney.examples.pb.order/Order.scala
  276. +0 −12 protos/src/test/scala/io.scalaland.chimney.examples.pb.order/OrderLine.scala
  277. +0 −25 protos/src/test/scala/io.scalaland.chimney.examples.pb.order/PaymentStatus.scala
  278. +3 −3 try-chimney.sh
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ assignees: ''
---

**Checklist**
- [ ] I read the documentation at https://scalalandio.github.io/chimney/ and checked that the functionality exists
- [ ] I read the documentation at https://chimney.readthedocs.io/ and checked that the functionality exists
- [ ] I verified that the behavior for my use case doesn't match the documentation
- [ ] I checked the https://github.com/scalalandio/chimney/issues and haven't found the issue reported
- [ ] I confirmed that the bug is not related to functionality that was deprecated: lifted transformers (`TransformerF`s) or `unsafeOption` flags
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ assignees: ''
---

**Checklist**
- [ ] I read the documentation at https://scalalandio.github.io/chimney/ and checked that the functionality doesn't exists
- [ ] I read the documentation at https://chimney.readthedocs.io/ and checked that the functionality doesn't exists
- [ ] I checked the https://github.com/scalalandio/chimney/issues and haven't found the feature already requested reported
- [ ] I confirmed that the request is not related to functionality that was deprecated: lifted transformers (`TransformerF`s) or `unsafeOption` flags

6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ jobs:

strategy:
matrix:
scala: ["2_12", "2_13"]
scala: ["2_12", "2_13", "3"]
platform: ["jvm", "js", "native"]
jvm: ['adopt:1.8.0-292', 'temurin:1.19.0.2']
fail-fast: false
@@ -58,8 +58,8 @@ jobs:
jvm: 'temurin:1.19.0.2' # TODO LB java version from matrix
apps: sbt

- name: Run benchmarks
run: sbt "++2.13.10 benchmarks/Jmh/run -rf json -rff $(pwd)/$(git describe --tags --always).json" # TODO LB scala version from matrix
- name: Run Scala 2 benchmarks # TODO: run for Scala 3 too
run: sbt "benchmarks/Jmh/run -rf json -rff $(pwd)/$(git describe --tags --always).json"

- name: Fetch benchmarks metadata
run: curl https://raw.githubusercontent.com/scalalandio/chimney-benchmark-results/main/meta.json -o meta.json
19 changes: 0 additions & 19 deletions .github/workflows/docs.yml

This file was deleted.

19 changes: 12 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
*.class
*.log
.idea
target
# sbt build
project/project
project/target
target
*.class
# Sphinx documentation
docs/build
# Scala Metals and BSP
.bloop
.bsp
.metals
.vscode
project/metals.sbt
docs/build
.bsp
# IDEs
.idea
.vscode
# other
*.log
1 change: 1 addition & 0 deletions .jvmopts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
-XX:-OmitStackTraceInFastThrow
-XX:+UseG1GC
-Xmx2g
16 changes: 16 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.11"

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/source/conf.py

12 changes: 9 additions & 3 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
version = 3.5.9
version = 3.7.10
project.git = true
maxColumn = 120
runner.dialect = Scala213Source3
fileOverride {
"glob:**/src/main/scala-3/**" { runner.dialect = scala3 }
"glob:**/src/test/scala-3/**" { runner.dialect = scala3 }
}

align.preset = some

rewrite.rules = [Imports, SortModifiers]
rewrite.rules = [Imports, RedundantBraces, SortModifiers]
rewrite.imports.sort = scalastyle
rewrite.redundantBraces.stringInterpolation = true

rewrite.scala3.convertToNewSyntax = true
rewrite.scala3.removeOptionalBraces = false

docstrings.style = keep
docstrings.blankFirstLine = no
docstrings.style = SpaceAsterisk
docstrings.wrap = no

newlines.sometimesBeforeColonInMethodReturnType = true
5 changes: 4 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ Additionally, we would like to:
* for any new feature we need a documentation:
* Scaladoc documenting: what is does, what are its type parameters, what are its value parameters
* Sphinx documentation describing new functionality
* linking Scaladoc entries to corresponding Sphinx documentation (https://scalalandio.github.io/chimney/ subpage)
* linking Scaladoc entries to corresponding Sphinx documentation (https://chimney.readthedocs.io/ subpage)
* it might be good to discuss whether put this information into a new page or as a section of an existing page

### How to start working on Chimney
@@ -62,3 +62,6 @@ to sbt-projectmatrix.

Some details of this setup along with useful commands you would be able to see in the welcome prompt when you start sbt
shell.

Very basic introduction can be found in [design doc](DESIGN.md). From then on we suggest looking at tests, and using
`.enableMacrosLogging` to see how some branches are triggered. If still at doubt, you can ask us on GH discussions.
201 changes: 201 additions & 0 deletions DESIGN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
# Design

Before one starts looking around the codebase, there might be a few things that are useful to understand first:

* certain things are computed only by the compiler and don't exist in runtime
* some things has to be instantiated in runtime
* how DSL enable passing information to macros
* what derivation code needs to take into consideration and how it affects the infrastructure

## Runtime vs compile time

The first thing we need to understand is which part of Chimney are performed by compiler and which are executed in
the runtime. Let's look at some examples.

### Configured transformation

Let's take:

```scala
case class Foo(a: Int, b: String)
case class Bar(a: Int, b: String, c: Double)
```

```scala
Foo(1, "test").into[Bar].withFieldConst(_.c, 3.0).transform
```

The simplified version of how the code above works:

1. `.into[Bar]` wraps `Foo(1, "test")` value. The wrapper (here: `TransformerInto`) would store
**both the transformed value and possible field/coproduct value overrides**
2. these overrides are stored in `RuntimeDataStore` (currently implemented as `Vector[Any]`) -
`.withFieldConst(_.c, 3.0)` adds `3.0` as a value to this vector.
**Both wrapping and override appending would happen during runtime**, so this DLS imposes some overhead
3. the final `.transform` would generate a code similar to:
```scala
{
val transformerInto = ...
new Bar(
transformerInto.source.a,
transformerInto.source.b,
transformerInto.td.runtimDataStore(0).asInstanceOf[Double]
)
}
```
4. since there might be many overrides in `td.runtimDataStore(0)` and the macro needs to know which field override is on
which position, **DSL needs to remember somehow what each index in the vector overrides**. For that purpose there
exist `TransformerCfg`, a phantom type (a type used only in compile time) which acts as a type-level list where each
such information could be prepended. (You can think of it as of a tuple, which never get instantiated and only exist as expandable list of types). Each time user adds some override code is generated which would append a value in runtime, but also modify the type of the wrapper. Then when the macro is called it can read configuration from the type and compute which override is stored under which index.

> Types computed by `.withField*`, `.withCoproduct*`, `.enable*` and `.disable*` are intended to be inferred, not shown
> to the user and not used by the user manually. For that reason all `*Cfg` and `*Flags` are defined in `internal`
> subpackage.
Very similar thing happen when calling

```scala
Transformer.define[Foo, Bar].withFieldConst(_.c, 3.0).buildTransformer
```

1. main difference is that there is no `Foo(1, "test")` which will be wrapped, so DSL wrapper (here:
`TransformerDefinition`) passes around only `RuntimeDataStore`
2. similarly to the previous example `.with*` methods put overrides into `RuntimeDataStore` and refine the config type
by prepending type level information
3. the final result returned by `.buildTransformer` is something similar to:
```scala
{
val transformerDefinition = ...
new Transformer[Foo, Bar] {
def transform(src: Foo): Bar = new Bar(
src.a,
src.b,
transformerDefinition.runtimDataStore(0).asInstanceOf[Double]
)
}
}
```

### Automatic transformation

When calling

```scala
Bar(1, "test").transformInto[Foo]
```

**no override or flag needs to be stored in wrapper**, and the method itself summons implicit
`Transformer.AutoDerived[Bar, Foo]`. If users didn't provide their own `Transformer[Bar, Foo]` and instance will be
created by calling `Transformer.derive[Bar, Foo]`. This method doesn't require any wrapper for building something which
stores transformed value next to overrides container, so it can generate similar code:

```scala
// a.transformInto(implicit b) internally
// just calls b.transform(a)
Bar(1, "test").transformInto(
// created by implicit macro:
new Transformer.Autoderived[Bar, Foo] {
def transform(src: Bar): Foo = new Foo(
src.a,
src.b
)
}
)
```

### Partial transformation

Partial transformers works on the same principles, when it comes to what is represents in type level, what is stored in runtime, and how DSL is defined. **The true difference lies inside macros being called by the DSL**.

## DSL implementation

Macros make is relatively easy to access the value to which macro is attached. It might be very hard though to obtain the whole expression which built this value. Especially, if you consider that user could do:

```scala
val expr = Foo(1, "test").into[Bar]
if (condition)
expr.withFieldConst(_.c, 3.0).transform
else
expr.withFieldConst(_.c, 4.0).transform
```

That's why it is simpy easier to treat each modifier method as a checkpoint which would store all the added information
in the value's type.

There are actually 2 sets of configuration options that are stored by DSL in type level:

* `TransformerCfg` stores information about field and coproduct overrides, most of them is accompanied by a runtime
value (either some constant or a function)
* `TransformerFlags` store information about options which aren't tied to a particular field od subtype, so they can be
considered global - indeed there is a way for sharing these flags by all derivations in the same scope
(`TransformerConfiguration`).

In Scala 2 overrides are implemented with [whitebox macros](https://docs.scala-lang.org/overviews/macros/blackbox-whitebox.html)
which allow read which field was selected with `_.fieldName` syntax, turning it into a `String` singleton type (e.g.
`"fieldName"` type) and prepending type level information to the type (e.g.
`TransformerCfg.FieldConst["fieldName", TransformerCfg.Empty]` prepends information that 0-index in `RuntimeDataStore`
contains override for `"fieldName"` to and empty config).

In Scala 3 the mechanism is similar except whitebox macros are replaced by
[`transparent inline`](https://docs.scala-lang.org/scala3/guides/macros/inline.html#transparent-inline-methods) macros.

> DSL has a separate macro implementation for Scala 2 and 3 since there was a negligible amount of logic shared between them.
Flags, since they don't need to extract any data to generate type information, are just "normal" Scala code which
prepends flags to flag type representation.

## Derivation implementation

To understand abstractions in derivation macros some assertions need to be clarified:

* code will be cross compiled for 2.12/2.13/3 (and for JVM, Scala.js and Scala Native)
* each bugfix would have to be shared by all codebases
* the logic between all Scala versions needs to stay as similar as possible unless there are some good non-accidental
reasons to make behavior different
* the logic is already pretty complex
* DSL should not differ so that Chimney would not be a blocker for migration from one version of Scala to another
* the maintenance of this project is planned for years so one-time solution is off the table

For that reasons maintaining 2 completely distinct implementations would not be sustainable: despite an extensive test
suite there would be a lot of subtle differences in the behavior that the tests didn't catch. Instead, the decision was
made to share as much of Chimney logic between Scala 2 and Scala 3 as possible.

It has several consequences:

* the code of macros uses traits with path-dependent types and abstract methods to design shared logic - it is similar
to how Endpoints4s or Endless4s libraries are defined (the technique was described e.g. in
[C. Hofer et al. **Polymorphic Embedding of DSLs**, GPCE, 2008](https://www.informatik.uni-marburg.de/~rendel/hofer08polymorphic.pdf))
(it is much easier to understand just by looking around e.g. `Types` and `TypesPlatform` and seeing how they are used)
* most common types used are `type Type[A]` and `type Expr[A]`, defined as abstract in shared code, and specified to
concrete implementation in platform-specific code
* Scala 3 quotes depends on implicit `scala.quoted.Type` _a lot_, so shared code has to pass around types everywhere
* since only a few types can be known upfront and named: source value-type, target-type, types based one them, a lot of
types are virtually existential: types of each constructor parameter, types returned by getters, subtypes. This
requires us to express some types as existential types with values of types using these existential types. Often it's
`Type[something]` or `Expr[something]` (of both at once with the same existential type used), so certain abstractions
needed bo be designed (see `Existentials`)

Additionally, there are several implications of how code is generated:

* partial transformers attempts to avoid/delay boxing, so as many expressions as possible would try to wrap in
`partial.Result` only when absolutely unavoidable. This means that code derived for some part of partial transformer
expression doesn't have to be partial - there is a need for something modeling the same idea as `Either[Expr[A], Expr[partial.Result[A]]]` -
this resulted in `TransformationExpr[A]`
* code is derived recursively, and:
* source and target type
* location of overrides
* source value
* configurations

has to be passed around, so some `TransformationContext` of the derivation is useful to pass everything with a single
value
* macros should not fail fast, but rather aggregate all the errors making derivation impossible, so that error message
for a single macro could display all known errors at once. Instead of manually combining some `Either[List[TransformerError], TransformationExpr[A]]`
a dedicated monad comes handy - `DerivationResult` monad.
* this monad can be also used as a `Writer` monad for gathering logs, because both in Scala 2 as well in Scala 3 for
each macro only the first logging call (for each logging level: info/warn/error) would print, all the following would
be no-op. With this monad logs could be aggregated in some list and then the final message could be printed at once
(additionally, such logs can be structured).

> All of the above, are simplified explanations for why certain decisions were made and why certain utilities exists.
> Exact implementation for these utilities will change over time.
Loading