Skip to content

Commit

Permalink
Do not treat macros logging as override
Browse files Browse the repository at this point in the history
  • Loading branch information
MateuszKubuszok committed Jan 29, 2025
1 parent 926ec66 commit 3e7a40f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ private[compiletime] trait Configurations { this: Derivation =>
val implicitScopeFlags = extractTransformerFlags[ImplicitScopeFlags](PatcherFlags.global)
val allFlags = extractTransformerFlags[InstanceFlags](implicitScopeFlags)
val cfg = extractPatcherConfig[Tail](runtimeDataIdx = 0, runtimeDataStore).copy(flags = allFlags)
if (Type[InstanceFlags] =:= ChimneyType.PatcherFlags.Default) cfg else cfg.setLocalFlagsOverriden
if (wereLocalFlagsOverriden[InstanceFlags]) cfg.setLocalFlagsOverriden else cfg
}

import TransformerConfigurations.extractPath
Expand All @@ -198,6 +198,17 @@ private[compiletime] trait Configurations { this: Derivation =>
// $COVERAGE-ON$
}

@scala.annotation.tailrec
private def wereLocalFlagsOverriden[Flags <: runtime.PatcherFlags: Type]: Boolean = Type[Flags] match {
case default if default =:= ChimneyType.PatcherFlags.Default => false
case ChimneyType.PatcherFlags.Enable(flag, flags) =>
import flag.Underlying as Flag, flags.Underlying as Flags2
// Whether or not we're logging macros should not affect the result of the derivation
if (Flag =:= ChimneyType.PatcherFlags.Flags.MacrosLogging) wereLocalFlagsOverriden[Flags2]
else true
case _ => true
}

private def extractPatcherConfig[Tail <: runtime.PatcherOverrides: Type](
runtimeDataIdx: Int,
runtimeDataStore: Expr[TransformerDefinitionCommons.RuntimeDataStore]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,8 @@ private[compiletime] trait Configurations { this: Derivation =>
// to use with instance flags.
if (Flag =:= ChimneyType.TransformerFlags.Flags.ImplicitConversions) wereLocalFlagsOverriden[Flags2]
else if (Flag =:= ChimneyType.TransformerFlags.Flags.TypeConstraintEvidence) wereLocalFlagsOverriden[Flags2]
// Whether or not we're logging macros should not affect the result of the derivation
else if (Flag =:= ChimneyType.TransformerFlags.Flags.MacrosLogging) wereLocalFlagsOverriden[Flags2]
else true
case _ => true
}
Expand Down

0 comments on commit 3e7a40f

Please sign in to comment.