From 8918100e3c496ec56bb012922ccd1332988de9ce Mon Sep 17 00:00:00 2001 From: Mark Rudolph Date: Thu, 27 Jul 2023 00:24:15 -0400 Subject: [PATCH] fix regression (#8) --- opinions/src/main/scala/opinions/ZIO.scala | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/opinions/src/main/scala/opinions/ZIO.scala b/opinions/src/main/scala/opinions/ZIO.scala index 5acb1ba..d8593bf 100644 --- a/opinions/src/main/scala/opinions/ZIO.scala +++ b/opinions/src/main/scala/opinions/ZIO.scala @@ -80,8 +80,18 @@ object AutoLayer: l.flatMap(_l => z.map(_z => _l :+ _z)), ) - val a: ZIO[IAnyType[p.MirroredElemTypes], Nothing, A] = - flattened.map(deps => p.fromProduct(Tuple.fromArray(deps.toArray))) + // Cast deps to List[Object], since toArray needs ClassTag. + // This fix works against Scala 3.3.2-RC1-bin-20230720-98b452d-NIGHTLY + // See: + // https://github.com/alterationx10/opinionated-zio/issues/7 + // https://github.com/lampepfl/dotty/issues/18277 + val a: ZIO[IAnyType[p.MirroredElemTypes], Nothing, A] = { + flattened.map { deps => + p.fromProduct { + Tuple.fromArray(deps.asInstanceOf[List[Object]].toArray) + } + } + } new AutoLayer[A]: override def zlayer(using