Skip to content

Commit

Permalink
upgrade to rc3 (#322)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamgfraser authored Mar 20, 2022
1 parent a9fbb68 commit f953556
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 21 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ inThisBuild(
addCommandAlias("fmt", "all scalafmtSbt scalafmt test:scalafmt")
addCommandAlias("check", "all scalafmtSbtCheck scalafmtCheck test:scalafmtCheck")

val zioVersion = "2.0.0-RC2"
val zioVersion = "2.0.0-RC3"

lazy val root = project
.in(file("."))
Expand Down
10 changes: 5 additions & 5 deletions zio-query/shared/src/main/scala/zio/query/DataSource.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package zio.query

import zio.{ Chunk, NeedsEnv, ZEnvironment, ZIO, ZTraceElement }
import zio.{ Chunk, ZEnvironment, ZIO, ZTraceElement }
import zio.stacktracer.TracingImplicits.disableAutoTrace

/**
Expand Down Expand Up @@ -117,13 +117,13 @@ trait DataSource[-R, -A] { self =>
* Provides this data source with its required environment.
*/
@deprecated("use provideEnvironment", "2.0.0")
final def provide(r: Described[ZEnvironment[R]])(implicit ev: NeedsEnv[R]): DataSource[Any, A] =
final def provide(r: Described[ZEnvironment[R]]): DataSource[Any, A] =
provideEnvironment(r)

/**
* Provides this data source with its required environment.
*/
final def provideEnvironment(r: Described[ZEnvironment[R]])(implicit ev: NeedsEnv[R]): DataSource[Any, A] =
final def provideEnvironment(r: Described[ZEnvironment[R]]): DataSource[Any, A] =
provideSomeEnvironment(Described(_ => r.value, s"_ => ${r.description}"))

/**
Expand All @@ -132,15 +132,15 @@ trait DataSource[-R, -A] { self =>
@deprecated("use provideSomeEnvironment", "2.0.0")
final def provideSome[R0](
f: Described[ZEnvironment[R0] => ZEnvironment[R]]
)(implicit ev: NeedsEnv[R]): DataSource[R0, A] =
): DataSource[R0, A] =
provideSomeEnvironment(f)

/**
* Provides this data source with part of its required environment.
*/
final def provideSomeEnvironment[R0](
f: Described[ZEnvironment[R0] => ZEnvironment[R]]
)(implicit ev: NeedsEnv[R]): DataSource[R0, A] =
): DataSource[R0, A] =
new DataSource[R0, A] {
val identifier = s"${self.identifier}.provideSomeEnvironment(${f.description})"
def runAll(requests: Chunk[Chunk[A]])(implicit trace: ZTraceElement): ZIO[R0, Nothing, CompletedRequestMap] =
Expand Down
16 changes: 9 additions & 7 deletions zio-query/shared/src/main/scala/zio/query/ZQuery.scala
Original file line number Diff line number Diff line change
Expand Up @@ -377,11 +377,13 @@ final class ZQuery[-R, +E, +A] private (private val step: ZIO[R, Nothing, Result
*/
final def provideLayer[E1 >: E, R0](
layer: => Described[ZLayer[R0, E1, R]]
)(implicit ev: NeedsEnv[R], trace: ZTraceElement): ZQuery[R0, E1, A] =
)(implicit trace: ZTraceElement): ZQuery[R0, E1, A] =
ZQuery {
layer.value.build.exit.use {
case Exit.Failure(e) => ZIO.succeedNow(Result.fail(e))
case Exit.Success(r) => self.provideEnvironment(Described(r, layer.description)).step
ZIO.scoped[R0] {
layer.value.build.exit.flatMap {
case Exit.Failure(e) => ZIO.succeedNow(Result.fail(e))
case Exit.Success(r) => self.provideEnvironment(Described(r, layer.description)).step
}
}
}

Expand All @@ -399,7 +401,7 @@ final class ZQuery[-R, +E, +A] private (private val step: ZIO[R, Nothing, Result
*/
final def provideEnvironment(
r: => Described[ZEnvironment[R]]
)(implicit ev: NeedsEnv[R], trace: ZTraceElement): ZQuery[Any, E, A] =
)(implicit trace: ZTraceElement): ZQuery[Any, E, A] =
provideSomeEnvironment(Described(_ => r.value, s"_ => ${r.description}"))

/**
Expand All @@ -414,7 +416,7 @@ final class ZQuery[-R, +E, +A] private (private val step: ZIO[R, Nothing, Result
*/
final def provideSomeEnvironment[R0](
f: => Described[ZEnvironment[R0] => ZEnvironment[R]]
)(implicit ev: NeedsEnv[R], trace: ZTraceElement): ZQuery[R0, E, A] =
)(implicit trace: ZTraceElement): ZQuery[R0, E, A] =
ZQuery(step.map(_.provideSomeEnvironment(f)).provideSomeEnvironment((r => (f.value(r)))))

/**
Expand Down Expand Up @@ -1502,7 +1504,7 @@ object ZQuery {
final class ProvideSomeLayer[R0, -R, +E, +A](private val self: ZQuery[R, E, A]) extends AnyVal {
def apply[E1 >: E, R1](
layer: => Described[ZLayer[R0, E1, R1]]
)(implicit ev1: R0 with R1 <:< R, ev2: NeedsEnv[R], tag: Tag[R1], trace: ZTraceElement): ZQuery[R0, E1, A] =
)(implicit ev: R0 with R1 <:< R, tag: Tag[R1], trace: ZTraceElement): ZQuery[R0, E1, A] =
self
.asInstanceOf[ZQuery[R0 with R1, E, A]]
.provideLayer(Described(ZLayer.environment[R0] ++ layer.value, layer.description))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package zio.query.internal
import zio.query._
import zio.query.internal.Continue._
import zio.stacktracer.TracingImplicits.disableAutoTrace
import zio.{ CanFail, Cause, IO, NeedsEnv, Ref, ZEnvironment, ZIO, ZTraceElement }
import zio.{ CanFail, Cause, IO, Ref, ZEnvironment, ZIO, ZTraceElement }

/**
* A `Continue[R, E, A]` models a continuation of a blocked request that
Expand Down Expand Up @@ -93,15 +93,15 @@ private[query] sealed trait Continue[-R, +E, +A] { self =>
@deprecated("use provideSomeEnvironment", "2.0.0")
final def provideSome[R0](
f: Described[ZEnvironment[R0] => ZEnvironment[R]]
)(implicit ev: NeedsEnv[R], trace: ZTraceElement): Continue[R0, E, A] =
)(implicit trace: ZTraceElement): Continue[R0, E, A] =
provideSomeEnvironment(f)

/**
* Purely contramaps over the environment type of this continuation.
*/
final def provideSomeEnvironment[R0](
f: Described[ZEnvironment[R0] => ZEnvironment[R]]
)(implicit ev: NeedsEnv[R], trace: ZTraceElement): Continue[R0, E, A] =
)(implicit trace: ZTraceElement): Continue[R0, E, A] =
self match {
case Effect(query) => effect(query.provideSomeEnvironment(f))
case Get(io) => get(io)
Expand Down
10 changes: 5 additions & 5 deletions zio-query/shared/src/main/scala/zio/query/internal/Result.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package zio.query.internal
import zio.query.internal.Result._
import zio.query.{ DataSourceAspect, Described }
import zio.stacktracer.TracingImplicits.disableAutoTrace
import zio.{ CanFail, Cause, Exit, NeedsEnv, ZEnvironment, ZTraceElement }
import zio.{ CanFail, Cause, Exit, ZEnvironment, ZTraceElement }

/**
* A `Result[R, E, A]` is the result of running one step of a `ZQuery`. A
Expand Down Expand Up @@ -69,15 +69,15 @@ private[query] sealed trait Result[-R, +E, +A] { self =>
* Provides this result with its required environment.
*/
@deprecated("use provideEnvironment", "2.0.0")
final def provide(r: Described[ZEnvironment[R]])(implicit ev: NeedsEnv[R], trace: ZTraceElement): Result[Any, E, A] =
final def provide(r: Described[ZEnvironment[R]])(implicit trace: ZTraceElement): Result[Any, E, A] =
provideEnvironment(r)

/**
* Provides this result with its required environment.
*/
final def provideEnvironment(
r: Described[ZEnvironment[R]]
)(implicit ev: NeedsEnv[R], trace: ZTraceElement): Result[Any, E, A] =
)(implicit trace: ZTraceElement): Result[Any, E, A] =
provideSomeEnvironment(Described(_ => r.value, s"_ => ${r.description}"))

/**
Expand All @@ -86,15 +86,15 @@ private[query] sealed trait Result[-R, +E, +A] { self =>
@deprecated("use provideSomeEnvironment", "2.0.0")
final def provideSome[R0](
f: Described[ZEnvironment[R0] => ZEnvironment[R]]
)(implicit ev: NeedsEnv[R], trace: ZTraceElement): Result[R0, E, A] =
)(implicit trace: ZTraceElement): Result[R0, E, A] =
provideSomeEnvironment(f)

/**
* Provides this result with part of its required environment.
*/
final def provideSomeEnvironment[R0](
f: Described[ZEnvironment[R0] => ZEnvironment[R]]
)(implicit ev: NeedsEnv[R], trace: ZTraceElement): Result[R0, E, A] =
)(implicit trace: ZTraceElement): Result[R0, E, A] =
self match {
case Blocked(br, c) => blocked(br.provideSomeEnvironment(f), c.provideSomeEnvironment(f))
case Done(a) => done(a)
Expand Down

0 comments on commit f953556

Please sign in to comment.