Skip to content

Commit a234eee

Browse files
authored
Swap ? placeholder and _ wildcard using kind-projector 0.13.0 & scalac 2.13.6 (#1479)
* Use custom scala version * Use `-Xsource:3` * Use kind-projector `underscore-placeholders` * Swap ? and _ with new kind-projector & `-Xsource:3` * Workaround `scala.reflect.internal.FatalError:[error] NoSymbol.clone()` error that happens on `Universe with Singleton` matches on 2.13.6-SNAPSHOT * regenerate build * `-Xsource:3` fixes * Add 2.12 support * Update to Scala 2.13.6 * Return older implementations without FatalError * Add `nowarn`s for scala/bug#12398 * Update to Scala 2.12.14 * fix build * fix build * regenerate build * Fix regression introduced in `Return older implementations without FatalError` * Fix unintended `?`->`_` replacements * remove remaining `*` placeholders * Disable `-Xsource:3` in docs due to mdoc failures: ``` error: basics.md:97 (mdoc generated code) could not find implicit value for parameter t: pprint.TPrint[zio.ZIO[zio.Has[zio.console.Console.Service],Throwable,β$0$]] val injector: Injector[RIO[Console, _]] = Injector[RIO[Console, _]](); $doc.binder(injector, 2, 4, 2, 12) ^ error: basics.md:109 (mdoc generated code) could not find implicit value for parameter t: pprint.TPrint[zio.ZIO[zio.Has[zio.console.Console.Service],Throwable,β$0$]] val resource = injector.produce(plan); $doc.binder(resource, 4, 4, 4, 12) ^ error: basics.md:1359 (mdoc generated code) could not find implicit value for parameter t: pprint.TPrint[zio.ZIO[zio.Has[zio.console.Console.Service],Throwable,β$9$]] val res51 = chooseInterpreters(true); $doc.binder(res51, 26, 0, 26, 24) ``` * Enable -Xsource:3 in unidoc after disabling in mdoc
1 parent d6c0075 commit a234eee

File tree

137 files changed

+901
-737
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+901
-737
lines changed

build.sbt

Lines changed: 360 additions & 228 deletions
Large diffs are not rendered by default.

distage/distage-core-api/.js/src/main/scala/izumi/distage/model/effect/QuasiIORunner.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ object QuasiIORunner {
99

1010
def fromCats[F[_]: Effect]: QuasiIORunner[F] = forAny[F]
1111

12-
class BIOImpl[F[_, _]] extends QuasiIORunner[F[Throwable, ?]]
12+
class BIOImpl[F[_, _]] extends QuasiIORunner[F[Throwable, _]]
1313

1414
implicit def forAny[F[_]]: QuasiIORunner[F] = new QuasiIORunner[F] {}
1515
}

distage/distage-core-api/.js/src/main/scala/izumi/distage/model/reflection/MirrorProvider.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ package izumi.distage.model.reflection
33
import izumi.fundamentals.reflection.TypeUtil
44

55
trait MirrorProvider {
6-
def runtimeClass(tpe: SafeType): Option[Class[_]]
6+
def runtimeClass(tpe: SafeType): Option[Class[?]]
77
def runtimeClassCompatible(tpe: SafeType, value: Any): Boolean
88
def canBeProxied(tpe: SafeType): Boolean
99
}
1010

1111
object MirrorProvider {
1212
object Impl extends MirrorProvider {
13-
override def runtimeClass(tpe: SafeType): Option[Class[_]] = {
13+
override def runtimeClass(tpe: SafeType): Option[Class[?]] = {
1414
if (tpe.hasPreciseClass) Some(tpe.cls) else None
1515
}
1616
override def canBeProxied(tpe: SafeType): Boolean = {

distage/distage-core-api/.jvm/src/main/scala/izumi/distage/model/effect/QuasiIORunner.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ object QuasiIORunner extends LowPriorityQuasiIORunnerInstances {
2525
override def run[A](f: => A): A = f
2626
}
2727

28-
implicit def fromBIO[F[_, _]: UnsafeRun2]: QuasiIORunner[F[Throwable, ?]] = new BIOImpl[F]
28+
implicit def fromBIO[F[_, _]: UnsafeRun2]: QuasiIORunner[F[Throwable, _]] = new BIOImpl[F]
2929

30-
final class BIOImpl[F[_, _]: UnsafeRun2] extends QuasiIORunner[F[Throwable, ?]] {
30+
final class BIOImpl[F[_, _]: UnsafeRun2] extends QuasiIORunner[F[Throwable, _]] {
3131
override def run[A](f: => F[Throwable, A]): A = UnsafeRun2[F].unsafeRun(f)
3232
}
3333

distage/distage-core-api/.jvm/src/main/scala/izumi/distage/model/reflection/MirrorProvider.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ import java.lang.reflect.Modifier
55
import izumi.fundamentals.reflection.TypeUtil
66

77
trait MirrorProvider {
8-
def runtimeClass(tpe: SafeType): Option[Class[_]]
8+
def runtimeClass(tpe: SafeType): Option[Class[?]]
99
def runtimeClassCompatible(tpe: SafeType, value: Any): Boolean
1010
def canBeProxied(tpe: SafeType): Boolean
1111
}
1212

1313
object MirrorProvider {
1414
object Impl extends MirrorProvider {
15-
override def runtimeClass(tpe: SafeType): Option[Class[_]] = {
15+
override def runtimeClass(tpe: SafeType): Option[Class[?]] = {
1616
if (tpe.hasPreciseClass) Some(tpe.cls) else None
1717
}
1818
override def canBeProxied(tpe: SafeType): Boolean = {

distage/distage-core-api/src/main/scala/izumi/distage/constructors/macros/AnyConstructorMacro.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ object AnyConstructorMacro {
3333
assert(enclosingClass.exists(_.pos == positionOfMakeCall), "enclosingClass must contain macro call position")
3434

3535
def findExprContainingMake(tree: Tree): Option[Tree] = {
36+
@nowarn("msg=outer reference")
3637
val afterLastBlock = Option {
3738
tree
3839
.filter(_.exists(_.pos == positionOfMakeCall))

distage/distage-core-api/src/main/scala/izumi/distage/constructors/macros/ClassConstructorMacro.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import izumi.distage.model.reflection.universe.StaticDIUniverse
66
import izumi.distage.reflection.ReflectionProviderDefaultImpl
77
import izumi.fundamentals.reflection.{ReflectionUtil, TrivialMacroLogger}
88

9+
import scala.annotation.nowarn
910
import scala.reflect.macros.blackbox
1011

1112
object ClassConstructorMacro {
@@ -16,7 +17,7 @@ object ClassConstructorMacro {
1617
val targetType = ReflectionUtil.norm(c.universe: c.universe.type)(weakTypeOf[T].dealias)
1718
requireConcreteTypeConstructor(c)("ClassConstructor", targetType)
1819

19-
targetType match {
20+
(targetType match {
2021
case t: SingletonTypeApi =>
2122
val functoid = symbolOf[Functoid.type].asClass.module
2223
val term = t match {
@@ -49,7 +50,7 @@ object ClassConstructorMacro {
4950
val res = c.Expr[ClassConstructor[T]](q"{ new ${weakTypeOf[ClassConstructor[T]]}($provider) }")
5051
logger.log(s"Final syntax tree of class for $targetType:\n$res")
5152
res
52-
}
53+
}): @nowarn("msg=outer reference")
5354
}
5455

5556
}

distage/distage-core-api/src/main/scala/izumi/distage/constructors/macros/ConstructorMacros.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import izumi.distage.model.reflection.universe.StaticDIUniverse
77
import izumi.distage.model.reflection.{Provider, ReflectionProvider}
88
import izumi.fundamentals.reflection.ReflectionUtil
99

10-
import scala.annotation.tailrec
10+
import scala.annotation.{nowarn, tailrec}
1111
import scala.reflect.macros.blackbox
1212

1313
abstract class ClassConstructorMacros extends ConstructorMacrosBase {
@@ -115,6 +115,7 @@ abstract class FactoryConstructorMacros extends ConstructorMacrosBase {
115115
val u.Wiring.Factory.FactoryMethod(factoryMethod, productConstructor, _) = factoryMethod0
116116

117117
val (methodArgListDecls, methodArgList) = {
118+
@nowarn("msg=outer reference")
118119
@tailrec def instantiatedMethod(tpe: Type): MethodTypeApi = {
119120
tpe match {
120121
case m: MethodTypeApi => m

distage/distage-core-api/src/main/scala/izumi/distage/model/PlannerInput.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ object PlannerInput {
3333
*
3434
* Effectively, this selects and creates a *sub-graph* of the largest possible object graph that can be described by `bindings`
3535
*/
36-
def apply(bindings: ModuleBase, activation: Activation, roots: NonEmptySet[_ <: DIKey]): PlannerInput = PlannerInput(bindings, activation, Roots(roots))
36+
def apply(bindings: ModuleBase, activation: Activation, roots: NonEmptySet[? <: DIKey]): PlannerInput = PlannerInput(bindings, activation, Roots(roots))
3737

3838
/**
3939
* Instantiate `roots` and the dependencies of `roots`, discarding bindings that are unrelated.
4040
*
4141
* Effectively, this selects and creates a *sub-graph* of the largest possible object graph that can be described by `bindings`
4242
*/
43-
def apply(bindings: ModuleBase, activation: Activation, roots: Set[_ <: DIKey])(implicit d: DummyImplicit): PlannerInput =
43+
def apply(bindings: ModuleBase, activation: Activation, roots: Set[? <: DIKey])(implicit d: DummyImplicit): PlannerInput =
4444
PlannerInput(bindings, activation, Roots(roots))
4545

4646
/** Instantiate `root`, `roots` and their dependencies, discarding bindings that are unrelated.

distage/distage-core-api/src/main/scala/izumi/distage/model/definition/Lifecycle.scala

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -332,12 +332,12 @@ object Lifecycle extends LifecycleCatsInstances {
332332
*
333333
* @return The [[izumi.functional.bio.Fiber2 fiber]] running `f` action
334334
*/
335-
def fork[F[+_, +_]: Fork2, E, A](f: F[E, A]): Lifecycle[F[Nothing, ?], Fiber2[F, E, A]] = {
335+
def fork[F[+_, +_]: Fork2, E, A](f: F[E, A]): Lifecycle[F[Nothing, _], Fiber2[F, E, A]] = {
336336
Lifecycle.make(f.fork)(_.interrupt)
337337
}
338338

339339
/** @see [[fork]] */
340-
def fork_[F[+_, +_]: Fork2: Functor2, E, A](f: F[E, A]): Lifecycle[F[Nothing, ?], Unit] = {
340+
def fork_[F[+_, +_]: Fork2: Functor2, E, A](f: F[E, A]): Lifecycle[F[Nothing, _], Unit] = {
341341
Lifecycle.fork(f).void
342342
}
343343

@@ -440,8 +440,8 @@ object Lifecycle extends LifecycleCatsInstances {
440440
}
441441
}
442442

443-
implicit final class SyntaxWidenError[F[+_, +_], +E, +A](private val resource: Lifecycle[F[E, ?], A]) extends AnyVal {
444-
def widenError[E1 >: E]: Lifecycle[F[E1, ?], A] = resource
443+
implicit final class SyntaxWidenError[F[+_, +_], +E, +A](private val resource: Lifecycle[F[E, _], A]) extends AnyVal {
444+
def widenError[E1 >: E]: Lifecycle[F[E1, _], A] = resource
445445
}
446446

447447
/** Convert [[cats.effect.Resource]] to [[Lifecycle]] */
@@ -539,7 +539,7 @@ object Lifecycle extends LifecycleCatsInstances {
539539
}
540540
}
541541

542-
implicit final class SyntaxLifecycleZIO[-R, +E, +A](private val resource: Lifecycle[ZIO[R, E, ?], A]) extends AnyVal {
542+
implicit final class SyntaxLifecycleZIO[-R, +E, +A](private val resource: Lifecycle[ZIO[R, E, _], A]) extends AnyVal {
543543
/** Convert [[Lifecycle]] to [[zio.ZManaged]] */
544544
def toZIO: ZManaged[R, E, A] = {
545545
ZManaged.makeReserve(
@@ -558,12 +558,12 @@ object Lifecycle extends LifecycleCatsInstances {
558558
}
559559
}
560560

561-
implicit final def functor2ForLifecycle[F[+_, +_]: Functor2]: Functor2[Lifecycle2[F, +?, +?]] = new Functor2[Lifecycle2[F, +?, +?]] {
562-
override def map[R, E, A, B](r: Lifecycle[F[E, ?], A])(f: A => B): Lifecycle[F[E, ?], B] = r.map(f)
561+
implicit final def functor2ForLifecycle[F[+_, +_]: Functor2]: Functor2[Lifecycle2[F, +_, +_]] = new Functor2[Lifecycle2[F, +_, +_]] {
562+
override def map[R, E, A, B](r: Lifecycle[F[E, _], A])(f: A => B): Lifecycle[F[E, _], B] = r.map(f)
563563
}
564564

565-
implicit final def functor3ForLifecycle[F[-_, +_, +_]: Functor3]: Functor3[Lifecycle3[F, -?, +?, +?]] = new Functor3[Lifecycle3[F, -?, +?, +?]] {
566-
override def map[R, E, A, B](r: Lifecycle[F[R, E, ?], A])(f: A => B): Lifecycle[F[R, E, ?], B] = r.map(f)
565+
implicit final def functor3ForLifecycle[F[-_, +_, +_]: Functor3]: Functor3[Lifecycle3[F, -_, +_, +_]] = new Functor3[Lifecycle3[F, -_, +_, +_]] {
566+
override def map[R, E, A, B](r: Lifecycle[F[R, E, _], A])(f: A => B): Lifecycle[F[R, E, _], B] = r.map(f)
567567
}
568568

569569
/**
@@ -623,7 +623,7 @@ object Lifecycle extends LifecycleCatsInstances {
623623
* }
624624
* }}}
625625
*/
626-
@open class OfZIO[-R, +E, +A](inner: => ZManaged[R, E, A]) extends Lifecycle.Of[ZIO[R, E, ?], A](fromZIO(inner))
626+
@open class OfZIO[-R, +E, +A](inner: => ZManaged[R, E, A]) extends Lifecycle.Of[ZIO[R, E, _], A](fromZIO(inner))
627627

628628
/**
629629
* Class-based variant of [[make]]:
@@ -803,7 +803,7 @@ object Lifecycle extends LifecycleCatsInstances {
803803
override final type InnerResource = concurrent.Ref[F, List[ExitCase[Throwable] => F[Unit]]]
804804
}
805805

806-
trait FromZIO[R, E, A] extends Lifecycle[ZIO[R, E, ?], A] {
806+
trait FromZIO[R, E, A] extends Lifecycle[ZIO[R, E, _], A] {
807807
override final type InnerResource = ReleaseMap
808808
override final def acquire: ZIO[R, E, ReleaseMap] = ReleaseMap.make
809809
override final def release(releaseMap: ReleaseMap): ZIO[R, Nothing, Unit] = releaseMap.releaseAll(zio.Exit.succeed(()), zio.ExecutionStrategy.Sequential).unit
@@ -1062,11 +1062,11 @@ object Lifecycle extends LifecycleCatsInstances {
10621062
private[definition] sealed trait LifecycleCatsInstances extends LifecycleCatsInstancesLowPriority {
10631063
implicit final def catsMonadForLifecycle[Monad[_[_]]: `cats.Monad`, F[_]](
10641064
implicit F: QuasiIO[F]
1065-
): Monad[Lifecycle[F, ?]] = {
1066-
new cats.StackSafeMonad[Lifecycle[F, ?]] {
1065+
): Monad[Lifecycle[F, _]] = {
1066+
new cats.StackSafeMonad[Lifecycle[F, _]] {
10671067
override def pure[A](x: A): Lifecycle[F, A] = Lifecycle.pure[F](x)
10681068
override def flatMap[A, B](fa: Lifecycle[F, A])(f: A => Lifecycle[F, B]): Lifecycle[F, B] = fa.flatMap(f)
1069-
}.asInstanceOf[Monad[Lifecycle[F, ?]]]
1069+
}.asInstanceOf[Monad[Lifecycle[F, _]]]
10701070
}
10711071

10721072
implicit final def catsMonoidForLifecycle[Monoid[_]: `cats.kernel.Monoid`, F[_], A](
@@ -1090,10 +1090,10 @@ private[definition] sealed trait LifecycleCatsInstances extends LifecycleCatsIns
10901090
private[definition] sealed trait LifecycleCatsInstancesLowPriority {
10911091
implicit final def catsFunctorForLifecycle[F[_], Functor[_[_]]: `cats.Functor`](
10921092
implicit F: QuasiFunctor[F]
1093-
): Functor[Lifecycle[F, ?]] = {
1094-
new cats.Functor[Lifecycle[F, ?]] {
1093+
): Functor[Lifecycle[F, _]] = {
1094+
new cats.Functor[Lifecycle[F, _]] {
10951095
override def map[A, B](fa: Lifecycle[F, A])(f: A => B): Lifecycle[F, B] = fa.map(f)
1096-
}.asInstanceOf[Functor[Lifecycle[F, ?]]]
1096+
}.asInstanceOf[Functor[Lifecycle[F, _]]]
10971097
}
10981098
}
10991099

@@ -1228,22 +1228,22 @@ private[definition] trait TrifunctorHasLifecycleTagImpl[R0, T] {
12281228
type E
12291229
type A <: T
12301230
implicit def tagLocal3: Tag[Local3[F]]
1231-
implicit def tagFull: Tag[Lifecycle[F[Any, E, ?], A]]
1231+
implicit def tagFull: Tag[Lifecycle[F[Any, E, _], A]]
12321232
implicit def ctorR: HasConstructor[R]
1233-
implicit def ev: R0 <:< Lifecycle[F[R, E, ?], A]
1234-
implicit def resourceTag: LifecycleTagImpl[Lifecycle[F[Any, E, ?], A]]
1233+
implicit def ev: R0 <:< Lifecycle[F[R, E, _], A]
1234+
implicit def resourceTag: LifecycleTagImpl[Lifecycle[F[Any, E, _], A]]
12351235
}
12361236
private[definition] object TrifunctorHasLifecycleTagImpl extends TrifunctorHasLifecycleTagLowPriority {
12371237
import scala.annotation.unchecked.{uncheckedVariance => v}
12381238

12391239
implicit def trifunctorResourceTag[
1240-
R1 <: Lifecycle[F0[R0, E0, ?], A0],
1240+
R1 <: Lifecycle[F0[R0, E0, _], A0],
12411241
F0[_, _, _]: TagK3,
12421242
R0: HasConstructor,
12431243
E0: Tag,
12441244
A0 <: A1: Tag,
12451245
A1,
1246-
]: TrifunctorHasLifecycleTagImpl[R1 with Lifecycle[F0[R0, E0, ?], A0], A1] {
1246+
]: TrifunctorHasLifecycleTagImpl[R1 with Lifecycle[F0[R0, E0, _], A0], A1] {
12471247
type R = R0
12481248
type E = E0
12491249
type A = A0
@@ -1255,13 +1255,13 @@ private[definition] object TrifunctorHasLifecycleTagImpl extends TrifunctorHasLi
12551255
type A = A0
12561256
val tagLocal3: Tag[Local3[F]] = implicitly
12571257
val ctorR: HasConstructor[R0] = implicitly
1258-
val tagFull: Tag[Lifecycle[F0[Any, E0, ?], A0]] = implicitly
1259-
val ev: R1 <:< Lifecycle[F0[R0, E0, ?], A0] = implicitly
1260-
val resourceTag: LifecycleTagImpl[Lifecycle[F0[Any, E0, ?], A0]] = new LifecycleTagImpl[Lifecycle[F0[Any, E0, ?], A0]] {
1258+
val tagFull: Tag[Lifecycle[F0[Any, E0, _], A0]] = implicitly
1259+
val ev: R1 <:< Lifecycle[F0[R0, E0, _], A0] = implicitly
1260+
val resourceTag: LifecycleTagImpl[Lifecycle[F0[Any, E0, _], A0]] = new LifecycleTagImpl[Lifecycle[F0[Any, E0, _], A0]] {
12611261
type F[AA] = F0[Any, E0, AA]
12621262
type A = A0
1263-
val tagFull: Tag[Lifecycle[F0[Any, E0, ?], A0]] = self.tagFull
1264-
val tagK: TagK[F0[Any, E0, ?]] = TagK[F0[Any, E0, ?]]
1263+
val tagFull: Tag[Lifecycle[F0[Any, E0, _], A0]] = self.tagFull
1264+
val tagK: TagK[F0[Any, E0, _]] = TagK[F0[Any, E0, _]]
12651265
val tagA: Tag[A0] = implicitly
12661266
}
12671267
}
@@ -1270,12 +1270,12 @@ sealed trait TrifunctorHasLifecycleTagLowPriority extends TrifunctorHasLifecycle
12701270
import scala.annotation.unchecked.{uncheckedVariance => v}
12711271

12721272
implicit def trifunctorResourceTagNothing[
1273-
R1 <: Lifecycle[F0[R0, Nothing, ?], A0],
1273+
R1 <: Lifecycle[F0[R0, Nothing, _], A0],
12741274
F0[_, _, _]: TagK3,
12751275
R0: HasConstructor,
12761276
A0 <: A1: Tag,
12771277
A1,
1278-
]: TrifunctorHasLifecycleTagImpl[R1 with Lifecycle[F0[R0, Nothing, ?], A0], A1] {
1278+
]: TrifunctorHasLifecycleTagImpl[R1 with Lifecycle[F0[R0, Nothing, _], A0], A1] {
12791279
type R = R0
12801280
type E = Nothing
12811281
type A = A0

0 commit comments

Comments
 (0)