Repository: 7mind/izumi
Pull request #1263 (2020-10-03 18:47:04)

 Turns out there's no such word as "overriden". Rename `overridenBy` to `overriddenBy` (double D)


Patch:
diff --git a/distage/distage-core-api/src/main/scala/izumi/distage/model/definition/ModuleBase.scala b/distage/distage-core-api/src/main/scala/izumi/distage/model/definition/ModuleBase.scala
index 7bcbd8a72..4593ab931 100644
--- a/distage/distage-core-api/src/main/scala/izumi/distage/model/definition/ModuleBase.scala
+++ b/distage/distage-core-api/src/main/scala/izumi/distage/model/definition/ModuleBase.scala
@@ -37,11 +37,11 @@ object ModuleBase {
 
   implicit final class ModuleDefSeqExt[S <: ModuleBase](private val defs: Iterable[S]) extends AnyVal {
     def merge[T <: ModuleBase](implicit T: ModuleMake.Aux[S, T]): T = {
-      defs.foldLeft[T](T.empty)(_ ++ _)
+      defs.foldLeft[T](T.empty)(_.++[T](_))
     }
 
     def overrideLeft[T <: ModuleBase](implicit T: ModuleMake.Aux[S, T]): T = {
-      defs.foldLeft[T](T.empty)(_ overridenBy _)
+      defs.foldLeft[T](T.empty)(_.overriddenBy[T](_))
     }
   }
 
@@ -113,7 +113,7 @@ object ModuleBase {
       T.make(module.bindings.filterNot(ignored contains _.key))
     }
 
-    def overridenBy[T <: ModuleBase](that: ModuleBase)(implicit T: ModuleMake.Aux[S, T]): T = {
+    def overriddenBy[T <: ModuleBase](that: ModuleBase)(implicit T: ModuleMake.Aux[S, T]): T = {
       T.make(overrideImpl(module.iterator, that.iterator).toSet)
     }
 
@@ -128,6 +128,9 @@ object ModuleBase {
     def untagged[T <: ModuleBase](implicit T: ModuleMake.Aux[S, T]): T = {
       T.make(module.bindings.map(_.withTags(Set.empty)))
     }
+
+    @deprecated("Bad grammar. Use `overriddenBy`", "0.11")
+    def overridenBy[T <: ModuleBase](that: ModuleBase)(implicit T: ModuleMake.Aux[S, T]): T = overriddenBy(that)
   }
 
   private[distage] def overrideImpl(existingIterator: Iterator[Binding], overridingIterator: Iterator[Binding]): Iterator[Binding] = {
diff --git a/distage/distage-core/src/main/scala/distage/Injector.scala b/distage/distage-core/src/main/scala/distage/Injector.scala
index f1c9c64bf..0e6f08398 100644
--- a/distage/distage-core/src/main/scala/distage/Injector.scala
+++ b/distage/distage-core/src/main/scala/distage/Injector.scala
@@ -144,7 +144,7 @@ object Injector extends InjectorFactory {
     activation: Activation,
     overrides: BootstrapModule,
   ): Injector[F] = {
-    val bootstrapLocator = new BootstrapLocator(bootstrapBase.overridenBy(overrides), activation)
+    val bootstrapLocator = new BootstrapLocator(bootstrapBase overriddenBy overrides, activation)
     val defaultModules = DefaultModule[F] ++ IdentitySupportModule // Identity support always on
     new InjectorDefaultImpl(bootstrapLocator, this, defaultModules)
   }
diff --git a/distage/distage-extension-plugins/src/main/scala/izumi/distage/plugins/PluginConfig.scala b/distage/distage-extension-plugins/src/main/scala/izumi/distage/plugins/PluginConfig.scala
index ea0a6293c..9ac1a0d88 100644
--- a/distage/distage-extension-plugins/src/main/scala/izumi/distage/plugins/PluginConfig.scala
+++ b/distage/distage-extension-plugins/src/main/scala/izumi/distage/plugins/PluginConfig.scala
@@ -21,11 +21,16 @@ final case class PluginConfig(
   def ++(plugins: Seq[PluginBase]): PluginConfig = copy(merges = merges ++ plugins)
   def ++(plugin: PluginBase): PluginConfig = copy(merges = merges ++ Seq(plugin))
 
-  def overridenBy(plugins: Seq[PluginBase]): PluginConfig = copy(overrides = overrides ++ plugins)
-  def overridenBy(plugin: PluginBase): PluginConfig = copy(overrides = overrides ++ Seq(plugin))
+  def overriddenBy(plugins: Seq[PluginBase]): PluginConfig = copy(overrides = overrides ++ plugins)
+  def overriddenBy(plugin: PluginBase): PluginConfig = copy(overrides = overrides ++ Seq(plugin))
 
   def cachePackages(cachePackages: Boolean): PluginConfig = copy(cachePackages = cachePackages)
   def debug(debug: Boolean): PluginConfig = copy(debug = debug)
+
+  @deprecated("Bad grammar. Use `overriddenBy`", "0.11")
+  def overridenBy(plugins: Seq[PluginBase]): PluginConfig = overriddenBy(plugins)
+  @deprecated("Bad grammar. Use `overriddenBy`", "0.11")
+  def overridenBy(plugin: PluginBase): PluginConfig = overriddenBy(plugin)
 }
 
 object PluginConfig {
diff --git a/distage/distage-framework/src/main/scala/izumi/distage/framework/services/RoleAppPlanner.scala b/distage/distage-framework/src/main/scala/izumi/distage/framework/services/RoleAppPlanner.scala
index d4ee780f0..1a4c2b3a3 100644
--- a/distage/distage-framework/src/main/scala/izumi/distage/framework/services/RoleAppPlanner.scala
+++ b/distage/distage-framework/src/main/scala/izumi/distage/framework/services/RoleAppPlanner.scala
@@ -40,7 +40,7 @@ object RoleAppPlanner {
     )
 
     override def reboot(bsOverride: BootstrapModule): RoleAppPlanner[F] = {
-      new RoleAppPlanner.Impl[F](options, bsModule overridenBy bsOverride, bootloader, logger)
+      new RoleAppPlanner.Impl[F](options, bsModule overriddenBy bsOverride, bootloader, logger)
     }
 
     override def makePlan(appMainRoots: Set[DIKey]): AppStartupPlans = {
@@ -51,7 +51,7 @@ object RoleAppPlanner {
       val bootstrappedApp = bootloader.boot(
         BootConfig(
           bootstrap = _ => bsModule,
-          appModule = _ overridenBy selfReflectionModule,
+          appModule = _ overriddenBy selfReflectionModule,
           roots = _ => Roots(runtimeGcRoots),
         )
       )
diff --git a/distage/distage-framework/src/main/scala/izumi/distage/roles/MainAppModule.scala b/distage/distage-framework/src/main/scala/izumi/distage/roles/MainAppModule.scala
index 829174d35..1261649a8 100644
--- a/distage/distage-framework/src/main/scala/izumi/distage/roles/MainAppModule.scala
+++ b/distage/distage-framework/src/main/scala/izumi/distage/roles/MainAppModule.scala
@@ -194,12 +194,12 @@ class MainAppModule[F[_]: TagK: DefaultModule](
 
   make[BootstrapModule].named("roleapp").from {
     (provider: ModuleProvider, bsModule: ModuleBase @Id("bootstrap")) =>
-      provider.bootstrapModules().merge overridenBy bsModule
+      provider.bootstrapModules().merge overriddenBy bsModule
   }
 
   make[Module].named("roleapp").from {
     (provider: ModuleProvider, appModule: ModuleBase @Id("main")) =>
-      provider.appModules().merge overridenBy appModule
+      provider.appModules().merge overriddenBy appModule
   }
 
   make[Bootloader].named("roleapp").from {
diff --git a/distage/distage-framework/src/main/scala/izumi/distage/roles/RoleAppMain.scala b/distage/distage-framework/src/main/scala/izumi/distage/roles/RoleAppMain.scala
index 187b057e3..dc830eff4 100644
--- a/distage/distage-framework/src/main/scala/izumi/distage/roles/RoleAppMain.scala
+++ b/distage/distage-framework/src/main/scala/izumi/distage/roles/RoleAppMain.scala
@@ -24,7 +24,7 @@ abstract class RoleAppMain[F[_]: TagK: DefaultModule](implicit artifact: IzArtif
     try {
       val appModule = makeAppModule(argv)
       val overrideModule = makeAppModuleOverride(argv)
-      Injector.NoProxies[Identity]().produceRun(appModule.overridenBy(overrideModule)) {
+      Injector.NoProxies[Identity]().produceRun(appModule overriddenBy overrideModule) {
         appResource: Lifecycle[Identity, PreparedApp[F]] =>
           appResource.use(_.run())
       }
diff --git a/distage/distage-framework/src/main/scala/izumi/distage/staticinjector/plugins/macros/StaticPluginCheckerMacro.scala b/distage/distage-framework/src/main/scala/izumi/distage/staticinjector/plugins/macros/StaticPluginCheckerMacro.scala
index c9afc8c14..d0b75d475 100644
--- a/distage/distage-framework/src/main/scala/izumi/distage/staticinjector/plugins/macros/StaticPluginCheckerMacro.scala
+++ b/distage/distage-framework/src/main/scala/izumi/distage/staticinjector/plugins/macros/StaticPluginCheckerMacro.scala
@@ -163,7 +163,7 @@ object StaticPluginCheckerMacro {
       make[AppConfig].from(AppConfig(ConfigFactory.empty()))
     })
 
-    val module = config overridenBy SimplePluginMergeStrategy.merge(loadedPlugins :+ additional.morph[PluginBase] :+ rootModule.toList.merge.morph[PluginBase])
+    val module = config overriddenBy SimplePluginMergeStrategy.merge(loadedPlugins :+ additional.morph[PluginBase] :+ rootModule.toList.merge.morph[PluginBase])
 
     val logger = IzLogger.NullLogger
 
diff --git a/doc/microsite/src/main/tut/distage/basics.md b/doc/microsite/src/main/tut/distage/basics.md
index b51b6a1f9..6d4b99c28 100644
--- a/doc/microsite/src/main/tut/distage/basics.md
+++ b/doc/microsite/src/main/tut/distage/basics.md
@@ -145,7 +145,7 @@ val TwoImplsModule = new ModuleDef {
 // Combine previous `HelloByeModule` with our new module
 // While overriding `make[Greeter]` bindings from the first module 
 
-val CombinedModule = HelloByeModule overridenBy TwoImplsModule
+val CombinedModule = HelloByeModule overriddenBy TwoImplsModule
 
 // Choose component configuration when making an Injector:
 Injector()
@@ -948,7 +948,7 @@ object RealInteractionZIO extends Interaction[RIO[Console, ?]] {
 }
 
 val RealInterpretersZIO = {
-  SyncInterpreters[RIO[Console, ?]] overridenBy new ModuleDef {
+  SyncInterpreters[RIO[Console, ?]] overriddenBy new ModuleDef {
     make[Interaction[RIO[Console, ?]]].from(RealInteractionZIO)
   }
 }
diff --git a/doc/microsite/src/main/tut/distage/distage-framework-docker.md b/doc/microsite/src/main/tut/distage/distage-framework-docker.md
index 4b795f431..d1c9affd1 100644
--- a/doc/microsite/src/main/tut/distage/distage-framework-docker.md
+++ b/doc/microsite/src/main/tut/distage/distage-framework-docker.md
@@ -488,14 +488,14 @@ docker {
 }
 ```
 
-2. Override the `DockerSupportModule` using `overridenBy`:
+2. Override the `DockerSupportModule` using `overriddenBy`:
 
 ```scala mdoc:to-string
 import izumi.distage.docker.Docker
 import izumi.distage.docker.Docker.DockerReusePolicy
 
 class CustomDockerConfigExampleModule[F[_]: TagK] extends ModuleDef {
-  include(DockerSupportModule[F] overridenBy new ModuleDef {
+  include(DockerSupportModule[F] overriddenBy new ModuleDef {
     make[Docker.ClientConfig].from {
       Docker.ClientConfig(
         readTimeoutMs    = 10000,


Test patch:
diff --git a/distage/distage-core/src/test/scala/izumi/distage/dsl/DSLTest.scala b/distage/distage-core/src/test/scala/izumi/distage/dsl/DSLTest.scala
index 2cf126132..7c632e5ea 100644
--- a/distage/distage-core/src/test/scala/izumi/distage/dsl/DSLTest.scala
+++ b/distage/distage-core/src/test/scala/izumi/distage/dsl/DSLTest.scala
@@ -332,7 +332,7 @@ class DSLTest extends AnyWordSpec with MkInjector {
         make[TestDependency0].tagged("x").tagged("y")
       }
 
-      val definition = def1 overridenBy def2
+      val definition = def1 overriddenBy def2
 
       assert(definition.bindings.count(_.tags.strings == Set("a", "b", "1", "2")) == 0)
       assert(definition.bindings.count(_.tags.strings == Set("x", "y", "2", "3")) == 1)
@@ -351,7 +351,7 @@ class DSLTest extends AnyWordSpec with MkInjector {
         make[TestDependency1]
       }
 
-      assert((def1 overridenBy Module.empty) == def1)
+      assert((def1 overriddenBy Module.empty) == def1)
       assert(def1 == def2)
       assert(def1 != def3)
     }
@@ -642,7 +642,7 @@ class DSLTest extends AnyWordSpec with MkInjector {
         make[X].tagged(Repo.Dummy, Mode.Prod)
         make[X].tagged(Mode.Test)
       }
-      val bindings = (module ++ module).overridenBy(module).bindings
+      val bindings = (module ++ module).overriddenBy(module).bindings
       assert(bindings.size == 3)
       assert(bindings.map(_.tags) == Set(Set[BindingTag](Repo.Prod, Mode.Prod), Set[BindingTag](Repo.Dummy, Mode.Prod), Set[BindingTag](Mode.Test)))
     }
diff --git a/distage/distage-framework/src/test/scala/izumi/distage/roles/test/RoleAppTest.scala b/distage/distage-framework/src/test/scala/izumi/distage/roles/test/RoleAppTest.scala
index 615fe132d..3b6810a03 100644
--- a/distage/distage-framework/src/test/scala/izumi/distage/roles/test/RoleAppTest.scala
+++ b/distage/distage-framework/src/test/scala/izumi/distage/roles/test/RoleAppTest.scala
@@ -55,7 +55,7 @@ class RoleAppTest extends AnyWordSpec with WithProperties {
       val probe = new XXX_TestWhiteboxProbe()
 
       new TestEntrypointBase {
-        override protected def pluginConfig: PluginConfig = super.pluginConfig overridenBy probe
+        override protected def pluginConfig: PluginConfig = super.pluginConfig overriddenBy probe
       }.main(
         Array(
           "-ll",
diff --git a/distage/distage-testkit-core/src/main/scala/izumi/distage/testkit/services/dstest/DistageTestEnv.scala b/distage/distage-testkit-core/src/main/scala/izumi/distage/testkit/services/dstest/DistageTestEnv.scala
index 8388be235..30cc4de32 100644
--- a/distage/distage-testkit-core/src/main/scala/izumi/distage/testkit/services/dstest/DistageTestEnv.scala
+++ b/distage/distage-testkit-core/src/main/scala/izumi/distage/testkit/services/dstest/DistageTestEnv.scala
@@ -34,11 +34,11 @@ trait DistageTestEnv {
   ): TestEnvironment = {
     val appPlugins = pluginLoader.load(testConfig.pluginConfig)
     val bsPlugins = pluginLoader.load(testConfig.bootstrapPluginConfig)
-    val appModule = mergeStrategy.merge(appPlugins) overridenBy testConfig.moduleOverrides
-    val bootstrapModule = mergeStrategy.merge(bsPlugins) overridenBy testConfig.bootstrapOverrides
+    val appModule = mergeStrategy.merge(appPlugins) overriddenBy testConfig.moduleOverrides
+    val bootstrapModule = mergeStrategy.merge(bsPlugins) overriddenBy testConfig.bootstrapOverrides
     val availableActivations = new ActivationChoicesExtractor.ActivationChoicesExtractorImpl().findAvailableChoices(appModule)
 
-    val bsModule = bootstrapModule overridenBy new BootstrapModuleDef {
+    val bsModule = bootstrapModule overriddenBy new BootstrapModuleDef {
       make[ActivationInfo].fromValue(availableActivations)
     }
 
diff --git a/distage/distage-testkit-core/src/main/scala/izumi/distage/testkit/services/dstest/DistageTestRunner.scala b/distage/distage-testkit-core/src/main/scala/izumi/distage/testkit/services/dstest/DistageTestRunner.scala
index 3b2e1d02b..d56b1610b 100644
--- a/distage/distage-testkit-core/src/main/scala/izumi/distage/testkit/services/dstest/DistageTestRunner.scala
+++ b/distage/distage-testkit-core/src/main/scala/izumi/distage/testkit/services/dstest/DistageTestRunner.scala
@@ -120,11 +120,11 @@ class DistageTestRunner[F[_]: TagK: DefaultModule](
     val provider = env.bootstrapFactory.makeModuleProvider[F](envExec.planningOptions, config, lateLogger.router, env.roles, env.activationInfo, env.activation)
 
     val finalBsModule = {
-      val bsModule = provider.bootstrapModules().merge overridenBy env.bsModule
-      BootstrapLocator.defaultBootstrap overridenBy bsModule
+      val bsModule = provider.bootstrapModules().merge overriddenBy env.bsModule
+      BootstrapLocator.defaultBootstrap overriddenBy bsModule
     }
 
-    val appModule = IdentitySupportModule ++ DefaultModule[F] overridenBy provider.appModules().merge overridenBy env.appModule
+    val appModule = IdentitySupportModule ++ DefaultModule[F] overriddenBy provider.appModules().merge overriddenBy env.appModule
 
     val (bsPlanMinusUnstable, bsModuleMinusUnstable, injector, planner) = {
       // FIXME: Including both bootstrap Plan & bootstrap Module into merge criteria to prevent `Bootloader`
diff --git a/distage/distage-testkit-scalatest/src/test/scala/izumi/distage/testkit/distagesuite/memoized/DistageMemoizationEnvsTest.scala b/distage/distage-testkit-scalatest/src/test/scala/izumi/distage/testkit/distagesuite/memoized/DistageMemoizationEnvsTest.scala
index c13097b13..26dc6f0ab 100644
--- a/distage/distage-testkit-scalatest/src/test/scala/izumi/distage/testkit/distagesuite/memoized/DistageMemoizationEnvsTest.scala
+++ b/distage/distage-testkit-scalatest/src/test/scala/izumi/distage/testkit/distagesuite/memoized/DistageMemoizationEnvsTest.scala
@@ -60,7 +60,7 @@ class SameEnvWithModuleOverride extends DistageMemoizationEnvsTest {
   override protected def config: TestConfig = {
     super
       .config.copy(
-        pluginConfig = super.config.pluginConfig overridenBy new PluginDef {
+        pluginConfig = super.config.pluginConfig overriddenBy new PluginDef {
           make[TestInstance].from(MemoizationEnv.anotherTestInstance)
         }
       )
@@ -83,7 +83,7 @@ class DifferentEnvWithMemoizedRootOverride extends DistageMemoizationEnvsTest {
   override protected def config: TestConfig = {
     super
       .config.copy(
-        pluginConfig = super.config.pluginConfig overridenBy new PluginDef {
+        pluginConfig = super.config.pluginConfig overriddenBy new PluginDef {
           make[MemoizedInstance].from(MemoizedInstance(UUID.randomUUID()))
         }
       )
diff --git a/fundamentals/fundamentals-bio/.jvm/src/test/scala/izumi/functional/bio/test/CatsLawsTestBase.scala b/fundamentals/fundamentals-bio/.jvm/src/test/scala/izumi/functional/bio/test/CatsLawsTestBase.scala
index 418654fea..aa1a858de 100644
--- a/fundamentals/fundamentals-bio/.jvm/src/test/scala/izumi/functional/bio/test/CatsLawsTestBase.scala
+++ b/fundamentals/fundamentals-bio/.jvm/src/test/scala/izumi/functional/bio/test/CatsLawsTestBase.scala
@@ -14,11 +14,9 @@ trait CatsLawsTestBase extends AnyFunSuite with FunSuiteDiscipline with TestInst
 object CatsLawsTestBase {
   implicit def equalityTry[A: Eq]: Eq[Try[A]] =
     new Eq[Try[A]] {
-      import TestInstances.eqThrowable
-      val optA = implicitly[Eq[Option[A]]]
-      val optT = implicitly[Eq[Option[Throwable]]]
+      val optA: Eq[Option[A]] = implicitly[Eq[Option[A]]]
 
-      def eqv(x: Try[A], y: Try[A]): Boolean =
+      override def eqv(x: Try[A], y: Try[A]): Boolean =
         if (x.isSuccess) optA.eqv(x.toOption, y.toOption)
         else y.isFailure
     }