diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3559519..1deda73 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,7 +48,7 @@ jobs: fail-fast: false matrix: java: ['adopt@1.8', 'adopt@1.11'] - scala: ['2.12.15', '2.13.8', '3.1.1'] + scala: ['2.12.15', '2.13.8', '3.1.3'] platform: ['JVM', 'JS', 'Native'] steps: - name: Checkout current branch diff --git a/build.sbt b/build.sbt index 9a3e3e4..006f95e 100644 --- a/build.sbt +++ b/build.sbt @@ -42,7 +42,7 @@ addCommandAlias( ";zioParserNative/test" ) -val zioVersion = "2.0.0-RC6" +val zioVersion = "2.0.0" lazy val root = (project in file(".")) .aggregate( @@ -74,11 +74,10 @@ lazy val zioParser = crossProject(JSPlatform, JVMPlatform, NativePlatform) ) }), libraryDependencies ++= Seq( - "dev.zio" %% "zio" % zioVersion, - "dev.zio" %% "zio-streams" % zioVersion, - "com.github.ghostdogpr" %% "caliban" % "1.4.1", - "dev.zio" %% "zio-test" % zioVersion % Test, - "dev.zio" %% "zio-test-sbt" % zioVersion % Test + "dev.zio" %% "zio" % zioVersion, + "dev.zio" %% "zio-streams" % zioVersion, + "dev.zio" %% "zio-test" % zioVersion % Test, + "dev.zio" %% "zio-test-sbt" % zioVersion % Test ), testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework") ) diff --git a/zio-parser/shared/src/main/scala/zio/parser/target/ZStreamTarget.scala b/zio-parser/shared/src/main/scala/zio/parser/target/ZStreamTarget.scala index 6c28570..b201926 100644 --- a/zio-parser/shared/src/main/scala/zio/parser/target/ZStreamTarget.scala +++ b/zio-parser/shared/src/main/scala/zio/parser/target/ZStreamTarget.scala @@ -2,10 +2,12 @@ package zio.parser.target import zio.parser.internal.Stack import zio.stream.ZStream -import zio.{ChunkBuilder, Queue, Runtime, UIO, ZIO} +import zio.{ChunkBuilder, Queue, Runtime, UIO, Unsafe, ZIO} class ZStreamTarget[R, Output](runtime: Runtime[R]) extends Target[Output] { - private val queue: Queue[Output] = runtime.unsafeRun(Queue.unbounded[Output]) + private val queue: Queue[Output] = Unsafe.unsafeCompat { implicit u => + runtime.unsafe.run(Queue.unbounded[Output]).getOrThrowFiberFailure() + } val stream: ZStream[Any, Nothing, Output] = ZStream.fromQueue(queue) @@ -16,7 +18,9 @@ class ZStreamTarget[R, Output](runtime: Runtime[R]) extends Target[Output] { override def write(value: Output): Unit = if (currentBuilder == null) { - runtime.unsafeRun(queue.offer(value).unit) + Unsafe.unsafeCompat { implicit u => + runtime.unsafe.run(queue.offer(value).unit).getOrThrowFiberFailure() + } } else { currentBuilder += value () @@ -40,7 +44,9 @@ class ZStreamTarget[R, Output](runtime: Runtime[R]) extends Target[Output] { () } else { currentBuilder = null - runtime.unsafeRun(queue.offerAll(capture.subBuilder.result()).unit) + Unsafe.unsafeCompat { implicit u => + runtime.unsafe.run(queue.offerAll(capture.subBuilder.result()).unit).getOrThrowFiberFailure() + } } }