Skip to content

Commit a6afac3

Browse files
committed
Function parentheses & warnings for Scala 3
1 parent e6ed56d commit a6afac3

File tree

18 files changed

+42
-40
lines changed

18 files changed

+42
-40
lines changed

distage/distage-core/.jvm/src/test/scala/izumi/distage/compat/ZIOResourcesTestJvm.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ final class ZIOResourcesTestJvm extends AnyWordSpec with GivenWhenThen {
6262
make[Res].named("instance").fromResource(resResource)
6363

6464
make[Res].named("provider").fromResource {
65-
_: Res @Id("instance") =>
65+
(_: Res @Id("instance")) =>
6666
resResource
6767
}
6868
}
@@ -169,7 +169,7 @@ final class ZIOResourcesTestJvm extends AnyWordSpec with GivenWhenThen {
169169
make[Res].named("instance").fromResource(resResource)
170170

171171
make[Res].named("provider").fromResource {
172-
_: Res @Id("instance") =>
172+
(_: Res @Id("instance")) =>
173173
resResource
174174
}
175175
}

distage/distage-core/.jvm/src/test/scala/izumi/distage/injector/CglibProxiesTestJvm.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ class CglibProxiesTestJvm extends AnyWordSpec with MkInjector {
5555

5656
val definition = PlannerInput.everything(new ModuleDef {
5757
make[Circular2].from {
58-
c: Circular1 => new Circular2(c)
58+
(c: Circular1) => new Circular2(c)
5959
}
6060
make[Circular1].from {
61-
c: Circular2 =>
61+
(c: Circular2) =>
6262
val a = new Circular1 {
6363
override val arg: Circular2 = c
6464
}
@@ -96,7 +96,7 @@ class CglibProxiesTestJvm extends AnyWordSpec with MkInjector {
9696

9797
val definition = PlannerInput.everything(new ModuleDef {
9898
make[SelfReference].from {
99-
self: SelfReference =>
99+
(self: SelfReference) =>
100100
new SelfReference(self)
101101
}
102102
})

distage/distage-core/src/test/scala/izumi/distage/dsl/DSLTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ class DSLTest extends AnyWordSpec with MkInjector {
678678
assert(definition.bindings.size == 4)
679679
}
680680
Injector().produceRun(definition) {
681-
s: Set[Int] =>
681+
(s: Set[Int]) =>
682682
intercept[TestFailedException] {
683683
assert(s == Set(1, 2, 3))
684684
}

distage/distage-core/src/test/scala/izumi/distage/dsl/LocatorDefTest.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ class LocatorDefTest extends AnyWordSpec {
102102
}
103103

104104
assert(ctx.run {
105-
i: Int => i + 5
105+
(i: Int) => i + 5
106106
} == 10)
107107
assert(ctx.runOption {
108-
i: Int => i + 5
108+
(i: Int) => i + 5
109109
} == Some(10))
110110
assert(ctx.runOption {
111-
i: Int @Id("special") => i
111+
(i: Int @Id("special")) => i
112112
}.isEmpty)
113113
}
114114

distage/distage-core/src/test/scala/izumi/distage/fixtures/BasicCases.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ Forest fire, climbin' higher, real life, it can wait""")
120120
object ConfigModule extends ModuleDef {
121121
make[scala.Predef.String].named("a").from("applicationId")
122122
make[Predef.String].named("b").from {
123-
a: String @Id("a") => a
123+
(a: String @Id("a")) => a
124124
}
125125
}
126126
}

distage/distage-core/src/test/scala/izumi/distage/fixtures/ProviderCases.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ object ProviderCases {
2323
val testVal: (String @Id("valsigtypeann1"), Int @Id("valsigtypeann2")) => String = (x, _) => x
2424

2525
val testVal2: Boolean => String = {
26-
x: Boolean @Id("valbodytypeann") => x.toString
26+
(x: Boolean @Id("valbodytypeann")) => x.toString
2727
}
2828

2929
val testVal3: Long @Id("valsbtypeann1") => String @Id("valsbtypeann2") => Long = {
30-
x: Long @Id("valsbtypeann3") => _ => x
30+
(x: Long @Id("valsbtypeann3")) => _ => x
3131
}
3232

3333
val testValByName: (=> Any) => Unit = _ => ()

distage/distage-core/src/test/scala/izumi/distage/impl/FunctoidTest.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ class FunctoidTest extends AnyWordSpec {
3232

3333
"produce correct DI keys for anonymous inline lambda" in {
3434
val fn = Functoid {
35-
x: Int @Id("inlinetypeann") => x
35+
(x: Int @Id("inlinetypeann")) => x
3636
}.get
3737

3838
assert(fn.diKeys contains DIKey.get[Int].named("inlinetypeann"))
3939
}
4040

4141
"produce correct DI keys for anonymous inline lambda with annotation parameter passed by name" in {
4242
val fn = Functoid {
43-
x: Int @Id(name = "inlinetypeann") => x
43+
(x: Int @Id(name = "inlinetypeann")) => x
4444
}.get
4545

4646
assert(fn.diKeys contains DIKey.get[Int].named("inlinetypeann"))
@@ -198,7 +198,7 @@ class FunctoidTest extends AnyWordSpec {
198198
def locgenfn[T](@Id("x") t: T): Option[T] = Option(t)
199199

200200
val fn = Functoid.apply {
201-
x: Int => locgenfn(x)
201+
(x: Int) => locgenfn(x)
202202
}.get
203203

204204
assert(fn.diKeys contains DIKey.get[Int].named("x"))

distage/distage-core/src/test/scala/izumi/distage/injector/BasicTest.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,10 +347,10 @@ class BasicTest extends AnyWordSpec with MkInjector {
347347
many[Int].add(5)
348348

349349
many[Int].add {
350-
i: Int => i - 1
350+
(i: Int) => i - 1
351351
} // 6
352352
many[Int].addSet { // 7, 8, 9
353-
i: Int =>
353+
(i: Int) =>
354354
Set(i, i + 1, i + 2)
355355
}
356356
})

distage/distage-core/src/test/scala/izumi/distage/injector/HigherKindsTest.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class HigherKindsTest extends AnyWordSpec with MkInjector {
1919
make[TestServiceTrait[F]]
2020
make[Int].named("TestService").from(getResult)
2121
make[F[String]].from {
22-
res: Int @Id("TestService") => Pointed[F].point(s"Hello $res!")
22+
(res: Int @Id("TestService")) => Pointed[F].point(s"Hello $res!")
2323
}
2424
make[Either[String, Boolean]].from(Right(true))
2525

@@ -29,7 +29,7 @@ class HigherKindsTest extends AnyWordSpec with MkInjector {
2929
make[F[Any]].from(Pointed[F].point(1: Any))
3030

3131
make[Either[String, F[Int]]].from {
32-
fAnyInt: F[Any] => Right[String, F[Int]](fAnyInt.asInstanceOf[F[Int]])
32+
(fAnyInt: F[Any]) => Right[String, F[Int]](fAnyInt.asInstanceOf[F[Int]])
3333
}
3434
make[F[Either[Int, F[String]]]].from(Pointed[F].point(Right[Int, F[String]](Pointed[F].point("hello")): Either[Int, F[String]]))
3535
}

distage/distage-core/src/test/scala/izumi/distage/injector/PlanVerifierTest.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,9 @@ class PlanVerifierTest extends AnyWordSpec with MkInjector {
321321

322322
val result = PlanVerifier().verify[Identity](definition, Roots.target[Fork1], Injector.providedKeys(), Set.empty)
323323
assert(
324-
result.issues.contains(NonEmptySet(DuplicateActivations(DIKey[Fork1], NonEmptyMap(Set.empty -> NonEmptySet.unsafeFrom(definition.bindings.map(UserBinding))))))
324+
result.issues.contains(
325+
NonEmptySet(DuplicateActivations(DIKey[Fork1], NonEmptyMap(Set.empty -> NonEmptySet.unsafeFrom(definition.bindings.map(UserBinding.apply)))))
326+
)
325327
)
326328
}
327329

distage/distage-core/src/test/scala/izumi/distage/injector/ProvidersTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class ProvidersTest extends AnyWordSpec with MkInjector {
4848
val definition = PlannerInput.everything(new ModuleDef {
4949
make[TestDependency].named("classdeftypeann1")
5050
make[TestClass].from {
51-
t: TestDependency @Id("classdeftypeann1") => new TestClass(t)
51+
(t: TestDependency @Id("classdeftypeann1")) => new TestClass(t)
5252
}
5353
})
5454

distage/distage-core/src/test/scala/izumi/distage/injector/ResourceEffectBindingsTest.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class ResourceEffectBindingsTest extends AnyWordSpec with MkInjector with GivenW
3131
new ModuleDef {
3232
make[Int].named("2").from(2)
3333
make[Int].fromEffect[Identity, Int] {
34-
i: Int @Id("2") => 10 + i
34+
(i: Int @Id("2")) => 10 + i
3535
}
3636
},
3737
Activation.empty,
@@ -50,7 +50,7 @@ class ResourceEffectBindingsTest extends AnyWordSpec with MkInjector with GivenW
5050
new ModuleDef {
5151
make[Int].named("2").from(2)
5252
make[Int].fromEffect {
53-
i: Int @Id("2") => Suspend2(10 + i)
53+
(i: Int @Id("2")) => Suspend2(10 + i)
5454
}
5555
},
5656
Activation.empty,
@@ -92,7 +92,7 @@ class ResourceEffectBindingsTest extends AnyWordSpec with MkInjector with GivenW
9292
new ModuleDef {
9393
make[Int].named("2").from(2)
9494
make[Int].fromEffect[Identity, Int] {
95-
i: Int @Id("2") => 10 + i
95+
(i: Int @Id("2")) => 10 + i
9696
}
9797
},
9898
Activation.empty,
@@ -119,7 +119,7 @@ class ResourceEffectBindingsTest extends AnyWordSpec with MkInjector with GivenW
119119
ref.update(_ ++ set).void
120120
}
121121
make[Unit].named("1").fromEffect {
122-
ref: Ref[Fn, Set[Char]] =>
122+
(ref: Ref[Fn, Set[Char]]) =>
123123
ref.update(_ + 'z').void
124124
}
125125
make[Unit].named("2").fromEffect {

distage/distage-core/src/test/scala/izumi/distage/injector/ZIOHasInjectionTest.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class ZIOHasInjectionTest extends AnyWordSpec with MkInjector {
5656
val definition = new ModuleDef {
5757
make[Dep].from[DepA]
5858
make[TestClass2[Dep]].fromHas {
59-
value: Dep => ZIO(TestClass2(value))
59+
(value: Dep) => ZIO(TestClass2(value))
6060
}
6161
make[TestClass2[Dep]].named("noargs").fromHas(ZIO(TestClass2(new DepA: Dep)))
6262
}
@@ -95,7 +95,7 @@ class ZIOHasInjectionTest extends AnyWordSpec with MkInjector {
9595
val definition = new ModuleDef {
9696
make[Dep].from[DepA]
9797
make[TestClass2[Dep]].fromHas(ZIO.accessM {
98-
value: Has[Dep] =>
98+
(value: Has[Dep]) =>
9999
ZIO(TestClass2(value.get))
100100
})
101101
}
@@ -114,10 +114,10 @@ class ZIOHasInjectionTest extends AnyWordSpec with MkInjector {
114114
import TypesCase1._
115115

116116
val ctorA = ZIO.accessM {
117-
value: Has[Dep @Id("A")] => ZIO(TestClass2(value.get))
117+
(value: Has[Dep @Id("A")]) => ZIO(TestClass2(value.get))
118118
}
119119
val ctorB = ZIO.accessM {
120-
value: Has[Dep @Id("B")] => ZIO(TestClass2(value.get))
120+
(value: Has[Dep @Id("B")]) => ZIO(TestClass2(value.get))
121121
}
122122

123123
val definition = PlannerInput.everything(new ModuleDef {
@@ -167,7 +167,7 @@ class ZIOHasInjectionTest extends AnyWordSpec with MkInjector {
167167
d2 <- ZManaged.access[Has[Dependency2]](_.get)
168168
} yield new Trait2 { val dep1 = d1; val dep2 = d2 })
169169
make[Trait1].fromHas {
170-
d1: Dependency1 =>
170+
(d1: Dependency1) =>
171171
ZLayer.succeed(new Trait1 { val dep1 = d1 })
172172
}
173173

distage/distage-framework/src/main/scala/izumi/distage/framework/services/ModuleProvider.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ object ModuleProvider {
110110

111111
object LogstageFailureHandlerModule extends ModuleDef {
112112
make[FailureHandler].from {
113-
logger: IzLogger =>
113+
(logger: IzLogger) =>
114114
FailureHandler.Custom {
115115
case Exit.Error(error, trace) =>
116116
logger.warn(s"Fiber errored out due to unhandled $error $trace")

distage/distage-framework/src/main/scala/izumi/distage/roles/RoleAppBootModule.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class RoleAppBootModule[F[_]: TagK: DefaultModule](
100100
make[ConfigLoader.ConfigLocation].from(ConfigLoader.ConfigLocation.Default)
101101
make[ConfigLoader.Args].from(ConfigLoader.Args.makeConfigLoaderArgs _)
102102
make[AppConfig].from {
103-
configLoader: ConfigLoader =>
103+
(configLoader: ConfigLoader) =>
104104
configLoader.loadConfig()
105105
}
106106

@@ -160,7 +160,7 @@ class RoleAppBootModule[F[_]: TagK: DefaultModule](
160160
provider.loadRoles[F](appModule)(tagK)
161161
}
162162
make[Set[DIKey]].named("distage.roles.roots").from {
163-
rolesInfo: RolesInfo =>
163+
(rolesInfo: RolesInfo) =>
164164
rolesInfo.requiredComponents
165165
}
166166

@@ -173,12 +173,12 @@ class RoleAppBootModule[F[_]: TagK: DefaultModule](
173173
make[RoleAppActivationParser].from[RoleAppActivationParser.Impl]
174174
make[ActivationParser].from[ActivationParser.Impl]
175175
make[Activation].named("roleapp").from {
176-
parser: ActivationParser =>
176+
(parser: ActivationParser) =>
177177
parser.parseActivation()
178178
}
179179

180180
make[PlanningOptions].from {
181-
parameters: RawAppArgs =>
181+
(parameters: RawAppArgs) =>
182182
PlanningOptions(
183183
addGraphVizDump = parameters.globalParameters.hasFlag(RoleAppMain.Options.dumpContext)
184184
)
@@ -223,7 +223,7 @@ class RoleAppBootModule[F[_]: TagK: DefaultModule](
223223
make[FinalizerFilters[F]].fromValue(FinalizerFilters.all[F])
224224
make[AppResourceProvider[F]].from[AppResourceProvider.Impl[F]]
225225
make[AppResource[F]].from {
226-
transformer: AppResourceProvider[F] =>
226+
(transformer: AppResourceProvider[F]) =>
227227
transformer.makeAppResource
228228
}
229229
}

distage/distage-framework/src/main/scala/izumi/distage/roles/RoleAppMain.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ abstract class RoleAppMain[F[_]](
7777
val argv = ArgV(args)
7878
try {
7979
Injector.NoProxies[Identity]().produceRun(roleAppBootModule(argv)) {
80-
appResource: AppResource[F] =>
80+
(appResource: AppResource[F]) =>
8181
appResource.runApp()
8282
}
8383
} catch {

distage/distage-testkit-core/src/main/scala/izumi/distage/testkit/TestConfig.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ object TestConfig {
183183
this ++ PriorAxisDIKeys(Map(MaxLevel -> that))
184184
}
185185
def ++[A](elem: (Int, A))(implicit toAxisDIKeys: A => AxisDIKeys): PriorAxisDIKeys = {
186-
addToLevel(elem._1, elem._2)
186+
addToLevel(elem._1, toAxisDIKeys(elem._2))
187187
}
188188

189189
def +(key: DIKey): PriorAxisDIKeys = addToLevel(MaxLevel, Set(key))
@@ -205,7 +205,7 @@ object TestConfig {
205205
PriorAxisDIKeys(map.map { case (i, v) => i -> AxisDIKeys.fromSet(v) })
206206

207207
@inline implicit def fromAxisDIKeys[A](set: A)(implicit toAxisDIKeys: A => AxisDIKeys): PriorAxisDIKeys =
208-
PriorAxisDIKeys(Map(MaxLevel -> set))
208+
PriorAxisDIKeys(Map(MaxLevel -> toAxisDIKeys(set)))
209209

210210
@nowarn("msg=Unused import")
211211
@inline implicit def fromPriorAxisDIKeys[A](map: Map[Int, A])(implicit toAxisDIKeys: A => AxisDIKeys): PriorAxisDIKeys = {

distage/distage-testkit-core/src/main/scala/izumi/distage/testkit/services/DISyntaxBase.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ trait DISyntaxBase[F[_]] {
1212

1313
protected final def takeAny(function: Functoid[Any], pos: SourceFilePosition): Unit = {
1414
val f: Functoid[F[Any]] = function.flatAp {
15-
F: QuasiIO[F] => (a: Any) =>
15+
(F: QuasiIO[F]) => (a: Any) =>
1616
F.pure(a)
1717
}
1818

0 commit comments

Comments
 (0)