Skip to content

Commit

Permalink
Ignore implicit summoning when overrides are not empty
Browse files Browse the repository at this point in the history
  • Loading branch information
MateuszKubuszok committed Sep 15, 2023
1 parent 2af6c99 commit 16d1f88
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ private[compiletime] trait Configurations { this: Derivation =>
// }}}
copy(
preventResolutionForTypes = None,
fieldOverrides = Map.empty
fieldOverrides = Map.empty,
coproductOverrides = Map.empty
)

def addFieldOverride(fieldName: String, fieldOverride: RuntimeFieldOverride): TransformerConfig =
Expand All @@ -108,6 +109,9 @@ private[compiletime] trait Configurations { this: Derivation =>
): TransformerConfig =
copy(coproductOverrides = coproductOverrides + ((instanceType, targetType) -> coproductOverride))

def areOverridesEmpty: Boolean =
fieldOverrides.isEmpty && coproductOverrides.isEmpty

def withDefinitionScope(defScope: (??, ??)): TransformerConfig =
copy(preventResolutionForTypes = Some(defScope))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ private[compiletime] trait TransformImplicitRuleModule { this: Derivation =>

def expand[From, To](implicit ctx: TransformationContext[From, To]): DerivationResult[Rule.ExpansionResult[To]] =
ctx match {
case _ if !ctx.config.areOverridesEmpty =>
DerivationResult.log(
"Configuration has defined overrides - implicit summoning is skipped"
) >> DerivationResult.attemptNextRule
case TransformationContext.ForTotal(src) =>
summonTransformerSafe[From, To].fold(DerivationResult.attemptNextRule[To]) { totalTransformer =>
// We're constructing:
Expand Down

0 comments on commit 16d1f88

Please sign in to comment.