From 09b58b8da373145a862f8389255568229402c7ce Mon Sep 17 00:00:00 2001 From: Flavio Brasil Date: Thu, 22 Feb 2024 16:02:57 -0800 Subject: [PATCH] remove unused imports --- build.sbt | 4 +++- kyo-bench/src/main/scala/kyo/bench/Bench.scala | 2 +- .../main/scala/kyo/bench/ForkManyBench.scala | 1 - .../main/scala/kyo/bench/ForkSpawnBench.scala | 1 - .../main/scala/kyo/bench/LoggingBench.scala | 1 - .../main/scala/kyo/bench/RendezvousBench.scala | 1 - .../js/src/main/scala/kyo/queuesStubs.scala | 2 -- .../src/main/scala/kyo/scheduler/Threads.scala | 2 +- .../kyo/stats/internal/ServiceLoader.scala | 3 --- .../main/scala/kyo/scheduler/Coordinator.scala | 12 +++--------- .../scala/kyo/scheduler/MovingStdDev.scala | 4 ++-- .../main/scala/kyo/scheduler/Scheduler.scala | 9 --------- .../src/main/scala/kyo/scheduler/Worker.scala | 6 ------ .../src/test/scala/kyoTest/MonadLawsTest.scala | 2 -- .../shared/src/main/scala/kyo/KyoApp.scala | 17 +++++++++++++---- .../shared/src/main/scala/kyo/channels.scala | 3 +-- .../scala/kyo/internal/FlatImplicits.scala | 16 ++++++++++------ .../shared/src/main/scala/kyo/randoms.scala | 2 -- .../main/scala/kyo/scheduler/IOPromise.scala | 3 --- .../src/main/scala/kyo/scheduler/IOTask.scala | 3 +-- kyo-core/shared/src/main/scala/kyo/seqs.scala | 1 - .../src/test/scala/kyoTest/FlatTest.scala | 2 ++ .../src/test/scala/kyoTest/KyoTest.scala | 5 ----- .../src/test/scala/kyoTest/abortsTest.scala | 5 ----- .../src/test/scala/kyoTest/clocksTest.scala | 1 - .../src/test/scala/kyoTest/envsTest.scala | 18 ++---------------- .../src/test/scala/kyoTest/fibersTest.scala | 4 ---- .../src/test/scala/kyoTest/hubsTest.scala | 1 - .../src/test/scala/kyoTest/iosTest.scala | 2 -- .../src/test/scala/kyoTest/optionsTest.scala | 5 +---- .../src/test/scala/kyoTest/resourcesTest.scala | 1 - .../src/test/scala/kyoTest/retriesTest.scala | 7 +------ .../src/test/scala/kyoTest/sumsTest.scala | 2 -- kyo-direct/src/main/scala/kyo/direct.scala | 3 --- .../src/test/scala/kyoTest/hygieneTest.scala | 6 ++++-- .../shared/src/main/scala/kyo/llm/ais.scala | 4 ---- .../src/main/scala/kyo/llm/completions.scala | 2 -- .../src/main/scala/kyo/llm/contexts.scala | 1 - .../src/main/scala/kyo/llm/index/tokens.scala | 1 - .../main/scala/kyo/llm/json/JsonDerive.scala | 2 -- .../main/scala/kyo/llm/json/JsonSchema.scala | 1 - .../src/main/scala/kyo/llm/listeners.scala | 1 - .../src/main/scala/kyo/llm/thoughts.scala | 2 -- .../scala/kyo/llm/thoughts/Invariant.scala | 2 -- .../shared/src/main/scala/kyo/llm/tools.scala | 6 ------ .../main/scala/kyo/llm/tools/BraveSearch.scala | 2 -- .../src/main/scala/kyo/llm/tools/Curl.scala | 2 -- .../scala/kyo/stats/otel/OTelAttributes.scala | 1 - .../kyoTest/stats/otel/OTelReceiverTest.scala | 12 ------------ .../sttp/client3/HttpClientKyoBackend.scala | 1 - .../scala/sttp/client3/KyoSimpleQueue.scala | 3 --- .../test/scala/kyoTest/requestsLiveTest.scala | 3 +-- .../main/scala/kyo/internal/KyoSttpMonad.scala | 4 ---- .../src/test/scala/kyoTest/requestsTest.scala | 1 - .../kyo/server/NettyKyoServerInterpreter.scala | 4 ---- .../server/internal/NettyKyoRequestBody.scala | 4 ++-- .../internal/NettyKyoToResponseBody.scala | 7 ------- 57 files changed, 48 insertions(+), 175 deletions(-) diff --git a/build.sbt b/build.sbt index 086038557..aea03e2d2 100644 --- a/build.sbt +++ b/build.sbt @@ -7,7 +7,9 @@ val compilerOptions = Seq( "-unchecked", "-deprecation", "-language:implicitConversions", - "-Wvalue-discard" + "-Wvalue-discard", + "-Wunused:all" + // "-Xfatal-warnings" // "-explain" // "-Vprofile", ) diff --git a/kyo-bench/src/main/scala/kyo/bench/Bench.scala b/kyo-bench/src/main/scala/kyo/bench/Bench.scala index 206522f0a..1b72fc314 100644 --- a/kyo-bench/src/main/scala/kyo/bench/Bench.scala +++ b/kyo-bench/src/main/scala/kyo/bench/Bench.scala @@ -30,7 +30,7 @@ import zio.UIO // jvm = "/Users/flavio.brasil/Downloads/graalvm-ce-java17-22.3.0/Contents/Home/bin/java" ) @BenchmarkMode(Array(Mode.Throughput)) -sealed abstract class Bench[T](using f: Flat[T]): +sealed abstract class Bench[T]: def zioBench(): UIO[T] def kyoBenchFiber(): T < Fibers = kyoBench() def kyoBench(): T < IOs diff --git a/kyo-bench/src/main/scala/kyo/bench/ForkManyBench.scala b/kyo-bench/src/main/scala/kyo/bench/ForkManyBench.scala index 967e007a9..af11453eb 100644 --- a/kyo-bench/src/main/scala/kyo/bench/ForkManyBench.scala +++ b/kyo-bench/src/main/scala/kyo/bench/ForkManyBench.scala @@ -69,7 +69,6 @@ class ForkManyBench extends Bench.ForkOnly[Int]: @Benchmark def forkOx() = import ox.* - import ox.channels.* import java.util.concurrent.CompletableFuture import java.util.concurrent.atomic.AtomicInteger diff --git a/kyo-bench/src/main/scala/kyo/bench/ForkSpawnBench.scala b/kyo-bench/src/main/scala/kyo/bench/ForkSpawnBench.scala index feb4aa040..520506905 100644 --- a/kyo-bench/src/main/scala/kyo/bench/ForkSpawnBench.scala +++ b/kyo-bench/src/main/scala/kyo/bench/ForkSpawnBench.scala @@ -10,7 +10,6 @@ class ForkSpawnBench extends Bench.ForkOnly[Unit]: def catsBench() = import cats.effect.IO - import cats.effect.std.Semaphore import cats.effect.std.CountDownLatch def repeat[A](n: Int)(io: IO[A]): IO[A] = diff --git a/kyo-bench/src/main/scala/kyo/bench/LoggingBench.scala b/kyo-bench/src/main/scala/kyo/bench/LoggingBench.scala index addf45ce5..9959e78e5 100644 --- a/kyo-bench/src/main/scala/kyo/bench/LoggingBench.scala +++ b/kyo-bench/src/main/scala/kyo/bench/LoggingBench.scala @@ -36,7 +36,6 @@ class LoggingBench extends Bench.SyncAndFork[Unit]: def zioBench() = import zio.* - import zio.logging.backend.SLF4J def loop(i: Int): UIO[Unit] = if i > depth then diff --git a/kyo-bench/src/main/scala/kyo/bench/RendezvousBench.scala b/kyo-bench/src/main/scala/kyo/bench/RendezvousBench.scala index ca24920e5..75faf0d3a 100644 --- a/kyo-bench/src/main/scala/kyo/bench/RendezvousBench.scala +++ b/kyo-bench/src/main/scala/kyo/bench/RendezvousBench.scala @@ -62,7 +62,6 @@ class RendezvousBench extends Bench.ForkOnly[Int]: override def kyoBenchFiber() = import kyo.* - import kyo.* def produce(waiting: AtomicRef[Any], n: Int = 0): Unit < Fibers = if n <= depth then diff --git a/kyo-core/js/src/main/scala/kyo/queuesStubs.scala b/kyo-core/js/src/main/scala/kyo/queuesStubs.scala index b43e5befa..2aaa36625 100644 --- a/kyo-core/js/src/main/scala/kyo/queuesStubs.scala +++ b/kyo-core/js/src/main/scala/kyo/queuesStubs.scala @@ -1,8 +1,6 @@ package org.jctools.queues import java.util.ArrayDeque -import java.util.concurrent.BlockingQueue -import java.util.concurrent.LinkedBlockingDeque class StubQueue[T](capacity: Int) extends ArrayDeque[T]: def isFull = size() >= capacity diff --git a/kyo-core/js/src/main/scala/kyo/scheduler/Threads.scala b/kyo-core/js/src/main/scala/kyo/scheduler/Threads.scala index 1341f58ef..88601c92f 100644 --- a/kyo-core/js/src/main/scala/kyo/scheduler/Threads.scala +++ b/kyo-core/js/src/main/scala/kyo/scheduler/Threads.scala @@ -1,7 +1,6 @@ package kyo.scheduler import java.util.concurrent.ThreadFactory -import java.util.concurrent.atomic.AtomicInteger object Threads: @@ -11,3 +10,4 @@ object Threads: def apply(name: String, create: Runnable => Thread): ThreadFactory = new ThreadFactory end Threads + \ No newline at end of file diff --git a/kyo-core/js/src/main/scala/kyo/stats/internal/ServiceLoader.scala b/kyo-core/js/src/main/scala/kyo/stats/internal/ServiceLoader.scala index 35749cc99..add0f025c 100644 --- a/kyo-core/js/src/main/scala/kyo/stats/internal/ServiceLoader.scala +++ b/kyo-core/js/src/main/scala/kyo/stats/internal/ServiceLoader.scala @@ -1,8 +1,5 @@ package java.util -import java.util.ArrayList -import java.util.Iterator - class ServiceLoader[T]: def iterator(): Iterator[T] = (new ArrayList[T](0)).iterator() diff --git a/kyo-core/jvm/src/main/scala/kyo/scheduler/Coordinator.scala b/kyo-core/jvm/src/main/scala/kyo/scheduler/Coordinator.scala index f65c830ee..11eebe7c5 100644 --- a/kyo-core/jvm/src/main/scala/kyo/scheduler/Coordinator.scala +++ b/kyo-core/jvm/src/main/scala/kyo/scheduler/Coordinator.scala @@ -1,9 +1,8 @@ package kyo.scheduler import java.util.concurrent.Executors -import scala.util.Random +import jdk.internal.vm.annotation.Contended import scala.util.control.NonFatal -import scala.util.control.NonFatal.apply private object Coordinator: @@ -15,13 +14,8 @@ private object Coordinator: private val cycleTicks = Math.pow(2, cycleExp).intValue() private val cycleMask = cycleTicks - 1 - @volatile private[this] var ticks: Long = 0L - - private val a1, a2, a3, a4, a5, a6, a7 = 0L // paddding - - @volatile private[this] var cycles = 0L - - private val b1, b2, b3, b4, b5, b6, b7 = 0L // paddding + @Contended @volatile private[this] var ticks: Long = 0L + @Contended @volatile private[this] var cycles = 0L private var startNs = 0L private val delayNs = new MovingStdDev(cycleExp) diff --git a/kyo-core/jvm/src/main/scala/kyo/scheduler/MovingStdDev.scala b/kyo-core/jvm/src/main/scala/kyo/scheduler/MovingStdDev.scala index c43d4dbc7..c205e3ca9 100644 --- a/kyo-core/jvm/src/main/scala/kyo/scheduler/MovingStdDev.scala +++ b/kyo-core/jvm/src/main/scala/kyo/scheduler/MovingStdDev.scala @@ -4,8 +4,8 @@ final private class MovingStdDev(exp: Int): private val window = 1 << exp private val mask = window - 1 - private var values = new Array[Long](window) - private var devs = new Array[Long](window) + private val values = new Array[Long](window) + private val devs = new Array[Long](window) private var idx = 0 private var sum = 0L private var sumDev = 0L diff --git a/kyo-core/jvm/src/main/scala/kyo/scheduler/Scheduler.scala b/kyo-core/jvm/src/main/scala/kyo/scheduler/Scheduler.scala index ae71cf185..50e2b76b2 100644 --- a/kyo-core/jvm/src/main/scala/kyo/scheduler/Scheduler.scala +++ b/kyo-core/jvm/src/main/scala/kyo/scheduler/Scheduler.scala @@ -2,16 +2,7 @@ package kyo.scheduler import java.util.concurrent.Executors import java.util.concurrent.atomic.AtomicInteger -import java.util.concurrent.atomic.AtomicReference -import java.util.concurrent.atomic.LongAdder -import java.util.concurrent.locks.LockSupport import kyo.* -import kyo.scheduler.Coordinator -import kyo.scheduler.Flag -import kyo.scheduler.IOTask -import kyo.scheduler.Threads -import kyo.scheduler.Worker -import kyo.scheduler.XSRandom import org.jctools.queues.MpmcUnboundedXaddArrayQueue import scala.annotation.tailrec diff --git a/kyo-core/jvm/src/main/scala/kyo/scheduler/Worker.scala b/kyo-core/jvm/src/main/scala/kyo/scheduler/Worker.scala index 07adcd34b..177c2c614 100644 --- a/kyo-core/jvm/src/main/scala/kyo/scheduler/Worker.scala +++ b/kyo-core/jvm/src/main/scala/kyo/scheduler/Worker.scala @@ -1,14 +1,8 @@ package kyo.scheduler -import java.util.Comparator -import java.util.PriorityQueue import java.util.concurrent.CopyOnWriteArrayList -import java.util.concurrent.Semaphore import java.util.concurrent.locks.LockSupport import kyo.iosInternal.* -import kyo.scheduler.IOTask -import kyo.scheduler.Queue -import kyo.scheduler.Scheduler final private class Worker(r: Runnable) extends Thread(r): diff --git a/kyo-core/jvm/src/test/scala/kyoTest/MonadLawsTest.scala b/kyo-core/jvm/src/test/scala/kyoTest/MonadLawsTest.scala index 77af9837a..1101bf4df 100644 --- a/kyo-core/jvm/src/test/scala/kyoTest/MonadLawsTest.scala +++ b/kyo-core/jvm/src/test/scala/kyoTest/MonadLawsTest.scala @@ -2,8 +2,6 @@ package kyoTest import kyo.* import kyo.Flat.unsafe.bypass -import scala.concurrent.ExecutionContext.Implicits.global -import scala.concurrent.duration.Duration import zio.Trace import zio.prelude.Equal import zio.prelude.coherent.CovariantDeriveEqual diff --git a/kyo-core/shared/src/main/scala/kyo/KyoApp.scala b/kyo-core/shared/src/main/scala/kyo/KyoApp.scala index 015eae36f..e900742a5 100644 --- a/kyo-core/shared/src/main/scala/kyo/KyoApp.scala +++ b/kyo-core/shared/src/main/scala/kyo/KyoApp.scala @@ -1,6 +1,6 @@ package kyo -import scala.annotation.nowarn +import scala.collection.mutable.ListBuffer import scala.concurrent.duration.Duration import scala.util.Try @@ -14,15 +14,24 @@ end KyoApp object KyoApp: - abstract class Base[S] extends App: + abstract class Base[S]: protected def handle[T](v: T < S)(using f: Flat[T < S]): Unit - @nowarn + final protected def args: Array[String] = _args + + private[this] var _args: Array[String] = _ + + private[this] val initCode = new ListBuffer[() => Unit] + + final def main(args: Array[String]) = + this._args = args + for proc <- initCode do proc() + protected def run[T](v: => T < S)( using f: Flat[T < S] ): Unit = - delayedInit(handle(v)) + initCode += (() => handle(v)) end Base type Effects = Fibers & Resources diff --git a/kyo-core/shared/src/main/scala/kyo/channels.scala b/kyo-core/shared/src/main/scala/kyo/channels.scala index 396790aa2..c1030d125 100644 --- a/kyo-core/shared/src/main/scala/kyo/channels.scala +++ b/kyo-core/shared/src/main/scala/kyo/channels.scala @@ -35,8 +35,7 @@ end Channel object Channels: - private val placeholder = Fibers.unsafeInitPromise[Unit] - private val closed = IOs.fail("Channel closed!") + private val closed = IOs.fail("Channel closed!") def init[T: Flat]( capacity: Int, diff --git a/kyo-core/shared/src/main/scala/kyo/internal/FlatImplicits.scala b/kyo-core/shared/src/main/scala/kyo/internal/FlatImplicits.scala index 62cda1263..697da6b31 100644 --- a/kyo-core/shared/src/main/scala/kyo/internal/FlatImplicits.scala +++ b/kyo-core/shared/src/main/scala/kyo/internal/FlatImplicits.scala @@ -43,10 +43,10 @@ object FlatImplicits: def fail(msg: String) = report.errorAndAbort(s"Method doesn't accept nested Kyo computations.\n$msg") - def canDerive(t: TypeRepr) = + def derive(t: TypeRepr) = t.asType match case '[nt] => - Expr.summon[Flat[nt]].isDefined + Expr.summon[Flat[nt]] def isAny(t: TypeRepr) = t.typeSymbol == TypeRepr.of[Any].typeSymbol @@ -55,10 +55,14 @@ object FlatImplicits: t.typeSymbol.isClassDef def check(t: TypeRepr): Expr[Flat[T]] = - if isAny(t) || (!isConcrete(t.dealias) && !canDerive(t)) then - fail( - s"Cannot prove ${code(print(t))} isn't nested. Provide an implicit evidence ${code(s"kyo.Flat[${print(t)}]")}." - ) + if isAny(t) || !isConcrete(t.dealias) then + derive(t) match + case Some(d) => + '{ $d.asInstanceOf[Flat[T]] } + case None => + fail( + s"Cannot prove ${code(print(t))} isn't nested. Provide an implicit evidence ${code(s"kyo.Flat[${print(t)}]")}." + ) else '{ Flat.unsafe.bypass[T] } diff --git a/kyo-core/shared/src/main/scala/kyo/randoms.scala b/kyo-core/shared/src/main/scala/kyo/randoms.scala index 7e3c001a2..c3b4ca135 100644 --- a/kyo-core/shared/src/main/scala/kyo/randoms.scala +++ b/kyo-core/shared/src/main/scala/kyo/randoms.scala @@ -1,7 +1,5 @@ package kyo -import scala.Console - abstract class Random: def nextInt: Int < IOs def nextInt(n: Int): Int < IOs diff --git a/kyo-core/shared/src/main/scala/kyo/scheduler/IOPromise.scala b/kyo-core/shared/src/main/scala/kyo/scheduler/IOPromise.scala index bcb0a3c1d..66a8acf67 100644 --- a/kyo-core/shared/src/main/scala/kyo/scheduler/IOPromise.scala +++ b/kyo-core/shared/src/main/scala/kyo/scheduler/IOPromise.scala @@ -2,11 +2,8 @@ package kyo.scheduler import IOPromise.* import java.util.concurrent.atomic.AtomicReference -import java.util.concurrent.locks.AbstractQueuedSynchronizer -import java.util.concurrent.locks.Lock import java.util.concurrent.locks.LockSupport import kyo.* -import kyo.scheduler.Scheduler import scala.annotation.tailrec import scala.util.control.NonFatal diff --git a/kyo-core/shared/src/main/scala/kyo/scheduler/IOTask.scala b/kyo-core/shared/src/main/scala/kyo/scheduler/IOTask.scala index 40557533c..018b6cd3d 100644 --- a/kyo-core/shared/src/main/scala/kyo/scheduler/IOTask.scala +++ b/kyo-core/shared/src/main/scala/kyo/scheduler/IOTask.scala @@ -2,7 +2,6 @@ package kyo.scheduler import java.util.ArrayDeque import java.util.Arrays -import java.util.IdentityHashMap import kyo.* import kyo.Locals.State import kyo.core.* @@ -177,6 +176,6 @@ private[kyo] class IOTask[T]( s"[$f]" case arr: ArrayDeque[() => Unit] @unchecked => Arrays.toString(arr.toArray) - s"IOTask(id=${hashCode},preempting=${check()},curr=$curr,ensures=$ensures,runtime=${runtime()},state=${get()})" + s"IOTask(id=${hashCode},preempting=${check()},curr=$curr,ensures=$e,runtime=${runtime()},state=${get()})" end toString end IOTask diff --git a/kyo-core/shared/src/main/scala/kyo/seqs.scala b/kyo-core/shared/src/main/scala/kyo/seqs.scala index 10d2d6b95..01e5b3dcb 100644 --- a/kyo-core/shared/src/main/scala/kyo/seqs.scala +++ b/kyo-core/shared/src/main/scala/kyo/seqs.scala @@ -1,7 +1,6 @@ package kyo import kyo.core.* -import scala.collection.mutable.ListBuffer sealed abstract class Seqs private[kyo] () extends Effect[Seq, Seqs]: diff --git a/kyo-core/shared/src/test/scala/kyoTest/FlatTest.scala b/kyo-core/shared/src/test/scala/kyoTest/FlatTest.scala index bde37abc8..ded0a51d7 100644 --- a/kyo-core/shared/src/test/scala/kyoTest/FlatTest.scala +++ b/kyo-core/shared/src/test/scala/kyoTest/FlatTest.scala @@ -22,6 +22,7 @@ class FlatTest extends KyoTest: implicitly[Flat[T < Options]] implicitly[Flat[T < Any]] end test1 + test1[Int] succeed } "derived" in { @@ -30,6 +31,7 @@ class FlatTest extends KyoTest: implicitly[Flat[T < Options]] implicitly[Flat[T < Any]] end test2 + test2[Int] succeed } } diff --git a/kyo-core/shared/src/test/scala/kyoTest/KyoTest.scala b/kyo-core/shared/src/test/scala/kyoTest/KyoTest.scala index b5fb52857..ffbd9bce0 100644 --- a/kyo-core/shared/src/test/scala/kyoTest/KyoTest.scala +++ b/kyo-core/shared/src/test/scala/kyoTest/KyoTest.scala @@ -1,17 +1,12 @@ package kyoTest -import izumi.reflect.* import kyo.* import org.scalatest.Assertions import org.scalatest.compatible.Assertion import org.scalatest.concurrent.ScalaFutures.* -import org.scalatest.freespec.AnyFreeSpec import org.scalatest.freespec.AsyncFreeSpec -import org.scalatest.time.Seconds -import org.scalatest.time.Span import scala.concurrent.ExecutionContext import scala.concurrent.Future -import scala.concurrent.Promise import scala.concurrent.duration.* import scala.util.Try diff --git a/kyo-core/shared/src/test/scala/kyoTest/abortsTest.scala b/kyo-core/shared/src/test/scala/kyoTest/abortsTest.scala index 0770be3c0..94fb3284a 100644 --- a/kyo-core/shared/src/test/scala/kyoTest/abortsTest.scala +++ b/kyo-core/shared/src/test/scala/kyoTest/abortsTest.scala @@ -1,11 +1,6 @@ package kyoTest import kyo.* -import org.scalatest.Args -import org.scalatest.Status -import scala.util.Failure -import scala.util.Success -import scala.util.Try class abortsTest extends KyoTest: diff --git a/kyo-core/shared/src/test/scala/kyoTest/clocksTest.scala b/kyo-core/shared/src/test/scala/kyoTest/clocksTest.scala index 37dca3626..62a48d2d7 100644 --- a/kyo-core/shared/src/test/scala/kyoTest/clocksTest.scala +++ b/kyo-core/shared/src/test/scala/kyoTest/clocksTest.scala @@ -1,7 +1,6 @@ package kyoTest import java.time.Instant -import java.time.ZoneId import kyo.* class clocksTest extends KyoTest: diff --git a/kyo-core/shared/src/test/scala/kyoTest/envsTest.scala b/kyo-core/shared/src/test/scala/kyoTest/envsTest.scala index c1085c414..5c473f5bf 100644 --- a/kyo-core/shared/src/test/scala/kyoTest/envsTest.scala +++ b/kyo-core/shared/src/test/scala/kyoTest/envsTest.scala @@ -29,7 +29,6 @@ class envsTest extends KyoTest: "one service" in { val a = Envs[Service1].get.map(_(1)) - val b: Int < Envs[Service1] = a assert( Envs[Service1].run(service1)(a) == 2 @@ -54,16 +53,10 @@ class envsTest extends KyoTest: ) } "dependent services" in { - val s1 = Envs[Service2].get.map(service2 => - new Service1: - def apply(i: Int) = service2(i * 10) - ) - val v1: Service1 < Envs[Service2] = s1 - val v2 = + val v1 = Envs[Service1].run[Int, Envs[Service2]](service1)(v) - val v3: Int < Envs[Service2] = v2 assert( - Envs[Service2].run(service2)(v3) == + Envs[Service2].run(service2)(v1) == 4 ) } @@ -90,7 +83,6 @@ class envsTest extends KyoTest: "continue" in { val a = Envs[Service1].get.map(_(1)) - val b: Int < (Envs[Service1] & Options) = a assert( Options.run(Envs[Service1].run(service1)(a)) == Some(2) @@ -99,7 +91,6 @@ class envsTest extends KyoTest: "short circuit" in { val a = Envs[Service1].get.map(_(0)) - val b: Int < (Envs[Service1] & Options) = a assert( Options.run(Envs[Service1].run(service1)(a)) == None @@ -130,11 +121,6 @@ class envsTest extends KyoTest: ) } "dependent services" in { - val s1 = Envs[Service2].get.map(service2 => - new Service1: - def apply(i: Int) = service2(i * 10) - ) - val v1: Service1 < Envs[Service2] = s1 val v2: Int < (Envs[Service2] & Options) = Envs[Service1].run(service1)(v) assert( Options.run(Envs[Service2].run(service2)(v2)) == diff --git a/kyo-core/shared/src/test/scala/kyoTest/fibersTest.scala b/kyo-core/shared/src/test/scala/kyoTest/fibersTest.scala index 8eb464078..969536d53 100644 --- a/kyo-core/shared/src/test/scala/kyoTest/fibersTest.scala +++ b/kyo-core/shared/src/test/scala/kyoTest/fibersTest.scala @@ -1,9 +1,7 @@ package kyoTest import java.io.Closeable -import java.util.concurrent.atomic.AtomicBoolean import java.util.concurrent.atomic.AtomicInteger as JAtomicInteger -import java.util.concurrent.atomic.AtomicReference as JAtomicReference import kyo.* import org.scalatest.compatible.Assertion import scala.concurrent.duration.* @@ -291,7 +289,6 @@ class fibersTest extends KyoTest: set(-1) "outer" in run { val resource1 = new Resource - val resource2 = new Resource val io1: (JAtomicInteger & Closeable, Set[Int]) < (Resources & Fibers) = for r <- Resources.acquire(resource1) @@ -306,7 +303,6 @@ class fibersTest extends KyoTest: } "inner" in run { val resource1 = new Resource - val resource2 = new Resource Fibers.init(Resources.run(Resources.acquire(resource1).map(_.incrementAndGet()))) .map(_.get).map { r => assert(r == 1) diff --git a/kyo-core/shared/src/test/scala/kyoTest/hubsTest.scala b/kyo-core/shared/src/test/scala/kyoTest/hubsTest.scala index 828441580..70ea46cde 100644 --- a/kyo-core/shared/src/test/scala/kyoTest/hubsTest.scala +++ b/kyo-core/shared/src/test/scala/kyoTest/hubsTest.scala @@ -1,7 +1,6 @@ package kyoTest import kyo.* -import scala.concurrent.duration.* class hubsTest extends KyoTest: diff --git a/kyo-core/shared/src/test/scala/kyoTest/iosTest.scala b/kyo-core/shared/src/test/scala/kyoTest/iosTest.scala index 4e133d13d..56be73cfa 100644 --- a/kyo-core/shared/src/test/scala/kyoTest/iosTest.scala +++ b/kyo-core/shared/src/test/scala/kyoTest/iosTest.scala @@ -1,10 +1,8 @@ package kyo -import java.io.Closeable import kyo.* import kyoTest.KyoTest import org.scalatest.compatible.Assertion -import scala.concurrent.duration.* import scala.util.Failure import scala.util.Success import scala.util.Try diff --git a/kyo-core/shared/src/test/scala/kyoTest/optionsTest.scala b/kyo-core/shared/src/test/scala/kyoTest/optionsTest.scala index a3b556bf8..9b6d27813 100644 --- a/kyo-core/shared/src/test/scala/kyoTest/optionsTest.scala +++ b/kyo-core/shared/src/test/scala/kyoTest/optionsTest.scala @@ -1,8 +1,6 @@ package kyoTest import kyo.* -import org.scalatest.Args -import org.scalatest.Status import scala.util.Failure import scala.util.Success import scala.util.Try @@ -199,8 +197,7 @@ class optionsTest extends KyoTest: ) } "or fail" in { - val e = new Exception() - val a: Int < IOs = Options.getOrElse(Option.empty[Int], IOs.fail("fail")) + val e = new Exception() assert( IOs.run(IOs.attempt(Options.getOrElse(Option.empty[Int], IOs.fail(e)))) == Failure(e) diff --git a/kyo-core/shared/src/test/scala/kyoTest/resourcesTest.scala b/kyo-core/shared/src/test/scala/kyoTest/resourcesTest.scala index 825bc339b..ac99d7270 100644 --- a/kyo-core/shared/src/test/scala/kyoTest/resourcesTest.scala +++ b/kyo-core/shared/src/test/scala/kyoTest/resourcesTest.scala @@ -120,7 +120,6 @@ class resourcesTest extends KyoTest: "nested" in run { val r1 = Resource(1) - val r2 = Resource(2) val r = IOs.run(Resources.run(Resources.run(Resources.acquire(r1())))) assert(r == r1) assert(r1.acquires == 1) diff --git a/kyo-core/shared/src/test/scala/kyoTest/retriesTest.scala b/kyo-core/shared/src/test/scala/kyoTest/retriesTest.scala index 9a3d27714..e0ef58aee 100644 --- a/kyo-core/shared/src/test/scala/kyoTest/retriesTest.scala +++ b/kyo-core/shared/src/test/scala/kyoTest/retriesTest.scala @@ -1,12 +1,7 @@ package kyoTest import kyo.* -import org.scalatest.Args -import org.scalatest.Status import scala.concurrent.duration.* -import scala.util.Failure -import scala.util.Success -import scala.util.Try class retriesTest extends KyoTest: @@ -60,7 +55,7 @@ class retriesTest extends KyoTest: "backoff" in run { var calls = 0 - var start = System.currentTimeMillis() + val start = System.currentTimeMillis() IOs.attempt { Retries(_.limit(4).exponential(10.millis)) { calls += 1 diff --git a/kyo-core/shared/src/test/scala/kyoTest/sumsTest.scala b/kyo-core/shared/src/test/scala/kyoTest/sumsTest.scala index 9dc33147c..6b394b185 100644 --- a/kyo-core/shared/src/test/scala/kyoTest/sumsTest.scala +++ b/kyo-core/shared/src/test/scala/kyoTest/sumsTest.scala @@ -1,8 +1,6 @@ package kyoTest import kyo.* -import scala.util.Success -import scala.util.Try class sumsTest extends KyoTest: "int" in { diff --git a/kyo-direct/src/main/scala/kyo/direct.scala b/kyo-direct/src/main/scala/kyo/direct.scala index f41d1a723..9550a8f02 100644 --- a/kyo-direct/src/main/scala/kyo/direct.scala +++ b/kyo-direct/src/main/scala/kyo/direct.scala @@ -2,10 +2,8 @@ package kyo import cps.CpsMonad import cps.CpsMonadContext -import cps.CpsMonadInstanceContext import cps.async import cps.await -import scala.annotation.targetName import scala.quoted.* object direct: @@ -21,7 +19,6 @@ object direct: private def impl[T: Type](f: Expr[T])(using Quotes): Expr[Any] = import quotes.reflect.* - import quotes.reflect.report.* Validate(f) diff --git a/kyo-direct/src/test/scala/kyoTest/hygieneTest.scala b/kyo-direct/src/test/scala/kyoTest/hygieneTest.scala index cd0eabe0f..0f1cbf7da 100644 --- a/kyo-direct/src/test/scala/kyoTest/hygieneTest.scala +++ b/kyo-direct/src/test/scala/kyoTest/hygieneTest.scala @@ -1,13 +1,15 @@ package kyoTest import kyo.* -import kyo.TestSupport.* -import kyo.direct.* import org.scalatest.Assertions import org.scalatest.freespec.AnyFreeSpec class hygieneTest extends AnyFreeSpec with Assertions: + "ok" in { + assert(IOs.run(IOs(1)) == 1) + } + "use of var" in { assertDoesNotCompile(""" defer { diff --git a/kyo-llm/shared/src/main/scala/kyo/llm/ais.scala b/kyo-llm/shared/src/main/scala/kyo/llm/ais.scala index 657aab39f..a6b1e7336 100644 --- a/kyo-llm/shared/src/main/scala/kyo/llm/ais.scala +++ b/kyo-llm/shared/src/main/scala/kyo/llm/ais.scala @@ -8,11 +8,7 @@ import kyo.* import kyo.llm.completions.* import kyo.llm.contexts.* import scala.reflect.ClassTag -import scala.util.Failure -import scala.util.Success import scala.util.control.NoStackTrace -import zio.schema.Schema as ZSchema -import zio.schema.codec.JsonCodec type doc = kyo.llm.json.doc val doc = kyo.llm.json.doc diff --git a/kyo-llm/shared/src/main/scala/kyo/llm/completions.scala b/kyo-llm/shared/src/main/scala/kyo/llm/completions.scala index 69a5ecc47..451071313 100644 --- a/kyo-llm/shared/src/main/scala/kyo/llm/completions.scala +++ b/kyo-llm/shared/src/main/scala/kyo/llm/completions.scala @@ -3,8 +3,6 @@ package kyo.llm import kyo.* import kyo.llm.contexts.* import kyo.llm.json.Schema -import kyo.llm.tools.* -import scala.concurrent.duration.Duration import sttp.client3.{Request as _, Response as _, *} import sttp.client3.ziojson.* import zio.json.* diff --git a/kyo-llm/shared/src/main/scala/kyo/llm/contexts.scala b/kyo-llm/shared/src/main/scala/kyo/llm/contexts.scala index 67aae05fa..eb1897251 100644 --- a/kyo-llm/shared/src/main/scala/kyo/llm/contexts.scala +++ b/kyo-llm/shared/src/main/scala/kyo/llm/contexts.scala @@ -1,7 +1,6 @@ package kyo.llm import kyo.* -import zio.schema.Schema as ZSchema object contexts: diff --git a/kyo-llm/shared/src/main/scala/kyo/llm/index/tokens.scala b/kyo-llm/shared/src/main/scala/kyo/llm/index/tokens.scala index 9edda88c4..25fb80b9a 100644 --- a/kyo-llm/shared/src/main/scala/kyo/llm/index/tokens.scala +++ b/kyo-llm/shared/src/main/scala/kyo/llm/index/tokens.scala @@ -3,7 +3,6 @@ package kyo.llm.index import com.knuddels.jtokkit.* import com.knuddels.jtokkit.api.* import java.nio.ByteBuffer -import java.util.ArrayList import java.util.Arrays object tokens: diff --git a/kyo-llm/shared/src/main/scala/kyo/llm/json/JsonDerive.scala b/kyo-llm/shared/src/main/scala/kyo/llm/json/JsonDerive.scala index 21540b48d..1312207e9 100644 --- a/kyo-llm/shared/src/main/scala/kyo/llm/json/JsonDerive.scala +++ b/kyo-llm/shared/src/main/scala/kyo/llm/json/JsonDerive.scala @@ -4,12 +4,10 @@ import kyo.* import scala.compiletime.* import zio.Chunk import zio.schema.{Schema as ZSchema, *} -import zio.schema.codec.JsonCodec trait JsonDerive: inline given deriveJson[T]: Json[T] = - import JsonDerive.* Json.fromZio(DeriveSchema.gen) end JsonDerive diff --git a/kyo-llm/shared/src/main/scala/kyo/llm/json/JsonSchema.scala b/kyo-llm/shared/src/main/scala/kyo/llm/json/JsonSchema.scala index 0cf2a228d..e2b7c4a48 100644 --- a/kyo-llm/shared/src/main/scala/kyo/llm/json/JsonSchema.scala +++ b/kyo-llm/shared/src/main/scala/kyo/llm/json/JsonSchema.scala @@ -1,6 +1,5 @@ package kyo.llm.json -import scala.annotation.StaticAnnotation import zio.Chunk import zio.json.* import zio.json.ast.* diff --git a/kyo-llm/shared/src/main/scala/kyo/llm/listeners.scala b/kyo-llm/shared/src/main/scala/kyo/llm/listeners.scala index 46e0c8f1c..2ece30461 100644 --- a/kyo-llm/shared/src/main/scala/kyo/llm/listeners.scala +++ b/kyo-llm/shared/src/main/scala/kyo/llm/listeners.scala @@ -5,7 +5,6 @@ import kyo.* import scala.concurrent.duration.* import scala.util.Failure import scala.util.Success -import scala.util.hashing.MurmurHash3 object Listeners: diff --git a/kyo-llm/shared/src/main/scala/kyo/llm/thoughts.scala b/kyo-llm/shared/src/main/scala/kyo/llm/thoughts.scala index 226a2cc04..94f81920a 100644 --- a/kyo-llm/shared/src/main/scala/kyo/llm/thoughts.scala +++ b/kyo-llm/shared/src/main/scala/kyo/llm/thoughts.scala @@ -4,8 +4,6 @@ import Thoughts.* import json.Json import kyo.* import kyo.Stats -import kyo.llm.json.Schema -import kyo.llm.thoughts.* import scala.collection.immutable.ListMap import scala.reflect.ClassTag import zio.Chunk diff --git a/kyo-llm/shared/src/main/scala/kyo/llm/thoughts/Invariant.scala b/kyo-llm/shared/src/main/scala/kyo/llm/thoughts/Invariant.scala index 9432d156e..a40a35037 100644 --- a/kyo-llm/shared/src/main/scala/kyo/llm/thoughts/Invariant.scala +++ b/kyo-llm/shared/src/main/scala/kyo/llm/thoughts/Invariant.scala @@ -1,11 +1,9 @@ package kyo.llm.thoughts import kyo.* -import kyo.Stats import kyo.llm.* import kyo.llm.contexts.* import kyo.stats.Attributes -import zio.schema.Schema as ZSchema object Invariant: diff --git a/kyo-llm/shared/src/main/scala/kyo/llm/tools.scala b/kyo-llm/shared/src/main/scala/kyo/llm/tools.scala index 818c4bbaf..45823432e 100644 --- a/kyo-llm/shared/src/main/scala/kyo/llm/tools.scala +++ b/kyo-llm/shared/src/main/scala/kyo/llm/tools.scala @@ -2,18 +2,13 @@ package kyo.llm import kyo.* import kyo.llm.contexts.* -import kyo.llm.json.Schema import kyo.llm.thoughts.* -import scala.annotation.implicitNotFound -import scala.collection.immutable.ListMap import scala.util.* import thoughts.Repair import zio.Chunk -import zio.schema.FieldSet import zio.schema.Schema.Field import zio.schema.Schema as ZSchema import zio.schema.TypeId -import zio.schema.codec.JsonCodec import zio.schema.validation.Validation abstract class Tool: @@ -55,7 +50,6 @@ abstract class Tool: private[kyo] def handle(ai: AI, call: Call): Boolean < AIs = Tools.disable { - given s: ZSchema[In] = info.input.zSchema IOs.attempt(json.decode(call.arguments)).map { case Failure(ex) => ai.toolMessage(call.id, "Invalid 'toolInput': " + ex).andThen(false) diff --git a/kyo-llm/shared/src/main/scala/kyo/llm/tools/BraveSearch.scala b/kyo-llm/shared/src/main/scala/kyo/llm/tools/BraveSearch.scala index c77fb8e3f..5c1da7463 100644 --- a/kyo-llm/shared/src/main/scala/kyo/llm/tools/BraveSearch.scala +++ b/kyo-llm/shared/src/main/scala/kyo/llm/tools/BraveSearch.scala @@ -2,8 +2,6 @@ package kyo.llm.tools import kyo.* import kyo.llm.* -import scala.util.Failure -import scala.util.Success import sttp.client3.* import sttp.client3.ziojson.* import zio.json.* diff --git a/kyo-llm/shared/src/main/scala/kyo/llm/tools/Curl.scala b/kyo-llm/shared/src/main/scala/kyo/llm/tools/Curl.scala index c64cb5183..057cb29b6 100644 --- a/kyo-llm/shared/src/main/scala/kyo/llm/tools/Curl.scala +++ b/kyo-llm/shared/src/main/scala/kyo/llm/tools/Curl.scala @@ -4,7 +4,6 @@ import kyo.* import kyo.llm.* import scala.concurrent.duration.* import sttp.client3.* -import sttp.client3.ziojson.* import sttp.model.* import zio.json.* @@ -32,7 +31,6 @@ class Curl(methods: Curl.Methods) extends Tool: if !allow.contains(input.method) then IOs.fail(s"Method not allowed: ${input.method}. Allowed: ${allow.mkString(", ")}") else - given inputDecoder: JsonDecoder[In] = DeriveJsonDecoder.gen[In] given inputEncoder: JsonEncoder[In] = DeriveJsonEncoder.gen[In] for _ <- Logs.debug(input.toJsonPretty) diff --git a/kyo-stats-otel/src/main/scala/kyo/stats/otel/OTelAttributes.scala b/kyo-stats-otel/src/main/scala/kyo/stats/otel/OTelAttributes.scala index 3a348cea1..7aed331ee 100644 --- a/kyo-stats-otel/src/main/scala/kyo/stats/otel/OTelAttributes.scala +++ b/kyo-stats-otel/src/main/scala/kyo/stats/otel/OTelAttributes.scala @@ -5,7 +5,6 @@ import io.opentelemetry.api.common.AttributesBuilder import kyo.stats.Attributes import kyo.stats.Attributes.Attribute import kyo.stats.Attributes.Attribute.* -import scala.jdk.CollectionConverters.* object OTelAttributes: diff --git a/kyo-stats-otel/src/test/scala/kyoTest/stats/otel/OTelReceiverTest.scala b/kyo-stats-otel/src/test/scala/kyoTest/stats/otel/OTelReceiverTest.scala index 452f68455..c03e2ba86 100644 --- a/kyo-stats-otel/src/test/scala/kyoTest/stats/otel/OTelReceiverTest.scala +++ b/kyo-stats-otel/src/test/scala/kyoTest/stats/otel/OTelReceiverTest.scala @@ -1,19 +1,7 @@ package kyoTest.stats.otel -import io.opentelemetry.api.* -import io.opentelemetry.api.metrics.* -import io.opentelemetry.api.trace.Span as OSpan -import io.opentelemetry.context.Context -import io.opentelemetry.exporters.inmemory.* -import io.opentelemetry.sdk.OpenTelemetrySdk -import io.opentelemetry.sdk.OpenTelemetrySdkBuilder -import io.opentelemetry.sdk.metrics.* -import io.opentelemetry.sdk.metrics.`export`.* -import io.opentelemetry.sdk.trace.* -import io.opentelemetry.sdk.trace.`export`.* import kyo.* import kyo.stats.* -import kyo.stats.otel.* import kyoTest.* class OTelReceiverTest extends KyoTest: diff --git a/kyo-sttp/jvm/src/main/scala/sttp/client3/HttpClientKyoBackend.scala b/kyo-sttp/jvm/src/main/scala/sttp/client3/HttpClientKyoBackend.scala index 4d44f41aa..ba10b9f11 100644 --- a/kyo-sttp/jvm/src/main/scala/sttp/client3/HttpClientKyoBackend.scala +++ b/kyo-sttp/jvm/src/main/scala/sttp/client3/HttpClientKyoBackend.scala @@ -4,7 +4,6 @@ import java.io.InputStream import java.io.UnsupportedEncodingException import java.net.http.HttpClient import java.net.http.HttpRequest -import java.net.http.HttpRequest.BodyPublisher import java.net.http.HttpResponse import java.net.http.HttpResponse.BodyHandlers import java.util.zip.GZIPInputStream diff --git a/kyo-sttp/jvm/src/main/scala/sttp/client3/KyoSimpleQueue.scala b/kyo-sttp/jvm/src/main/scala/sttp/client3/KyoSimpleQueue.scala index e70d4a9be..2cd967de3 100644 --- a/kyo-sttp/jvm/src/main/scala/sttp/client3/KyoSimpleQueue.scala +++ b/kyo-sttp/jvm/src/main/scala/sttp/client3/KyoSimpleQueue.scala @@ -1,8 +1,5 @@ package sttp.client3 -import java.util.concurrent.ArrayBlockingQueue -import java.util.concurrent.BlockingQueue -import java.util.concurrent.LinkedBlockingQueue import kyo.* import kyo.internal.KyoSttpMonad import sttp.client3.internal.ws.SimpleQueue diff --git a/kyo-sttp/jvm/src/test/scala/kyoTest/requestsLiveTest.scala b/kyo-sttp/jvm/src/test/scala/kyoTest/requestsLiveTest.scala index 77292d582..ead5339ec 100644 --- a/kyo-sttp/jvm/src/test/scala/kyoTest/requestsLiveTest.scala +++ b/kyo-sttp/jvm/src/test/scala/kyoTest/requestsLiveTest.scala @@ -3,7 +3,6 @@ package kyoTest import kyo.* import scala.util.* import sttp.client3.* -import sttp.model.StatusCode class requestsLiveTest extends KyoTest: @@ -34,7 +33,7 @@ class requestsLiveTest extends KyoTest: import com.sun.net.httpserver.{HttpExchange, HttpHandler, HttpServer} import java.io.OutputStream import java.net.InetSocketAddress - import scala.util.{Try, Success, Failure} + import scala.util.{Success, Failure} val server = HttpServer.create(new InetSocketAddress(port), 0) server.createContext( diff --git a/kyo-sttp/shared/src/main/scala/kyo/internal/KyoSttpMonad.scala b/kyo-sttp/shared/src/main/scala/kyo/internal/KyoSttpMonad.scala index a628ac7c6..540021894 100644 --- a/kyo-sttp/shared/src/main/scala/kyo/internal/KyoSttpMonad.scala +++ b/kyo-sttp/shared/src/main/scala/kyo/internal/KyoSttpMonad.scala @@ -1,10 +1,6 @@ package kyo.internal -import KyoSttpMonad.M import kyo.* -import scala.util.Failure -import scala.util.Success -import scala.util.Try import sttp.monad.Canceler import sttp.monad.MonadAsyncError diff --git a/kyo-sttp/shared/src/test/scala/kyoTest/requestsTest.scala b/kyo-sttp/shared/src/test/scala/kyoTest/requestsTest.scala index 21ddddb67..ac00c1f16 100644 --- a/kyo-sttp/shared/src/test/scala/kyoTest/requestsTest.scala +++ b/kyo-sttp/shared/src/test/scala/kyoTest/requestsTest.scala @@ -3,7 +3,6 @@ package kyoTest import kyo.* import scala.util.* import sttp.client3.* -import sttp.model.StatusCode class requestsTest extends KyoTest: diff --git a/kyo-tapir/src/main/scala/kyo/server/NettyKyoServerInterpreter.scala b/kyo-tapir/src/main/scala/kyo/server/NettyKyoServerInterpreter.scala index 87d40993b..bc3dc0515 100644 --- a/kyo-tapir/src/main/scala/kyo/server/NettyKyoServerInterpreter.scala +++ b/kyo-tapir/src/main/scala/kyo/server/NettyKyoServerInterpreter.scala @@ -3,10 +3,7 @@ package kyo.server import kyo.* import kyo.internal.KyoSttpMonad import kyo.internal.KyoSttpMonad.instance -import kyo.routes.* import kyo.server.internal.* -import sttp.monad.MonadError -import sttp.monad.syntax.* import sttp.tapir.server.ServerEndpoint import sttp.tapir.server.interceptor.RequestResult import sttp.tapir.server.interceptor.reject.RejectInterceptor @@ -18,7 +15,6 @@ import sttp.tapir.server.netty.NettyServerRequest import sttp.tapir.server.netty.Route import sttp.tapir.server.netty.internal.* import sttp.tapir.server.netty.internal.NettyBodyListener -import sttp.tapir.server.netty.internal.RunAsync trait NettyKyoServerInterpreter: def nettyServerOptions: NettyKyoServerOptions diff --git a/kyo-tapir/src/main/scala/kyo/server/internal/NettyKyoRequestBody.scala b/kyo-tapir/src/main/scala/kyo/server/internal/NettyKyoRequestBody.scala index f18a2ec94..f6513cc08 100644 --- a/kyo-tapir/src/main/scala/kyo/server/internal/NettyKyoRequestBody.scala +++ b/kyo-tapir/src/main/scala/kyo/server/internal/NettyKyoRequestBody.scala @@ -2,15 +2,14 @@ package kyo.server.internal import io.netty.buffer.ByteBufUtil import io.netty.handler.codec.http.FullHttpRequest -import io.netty.handler.codec.http.HttpContent import java.io.ByteArrayInputStream import java.nio.ByteBuffer import kyo.* import kyo.internal.KyoSttpMonad import kyo.internal.KyoSttpMonad.* import kyo.routes.* +import scala.annotation.nowarn import sttp.capabilities.Streams -import sttp.tapir.FileRange import sttp.tapir.InputStreamRange import sttp.tapir.RawBodyType import sttp.tapir.TapirFile @@ -18,6 +17,7 @@ import sttp.tapir.model.ServerRequest import sttp.tapir.server.interpreter.RawValue import sttp.tapir.server.interpreter.RequestBody +@nowarn private[kyo] class NettyKyoRequestBody(createFile: ServerRequest => TapirFile < Routes) extends RequestBody[KyoSttpMonad.M, Any]: diff --git a/kyo-tapir/src/main/scala/kyo/server/internal/NettyKyoToResponseBody.scala b/kyo-tapir/src/main/scala/kyo/server/internal/NettyKyoToResponseBody.scala index 66d2fda19..d1e466cf7 100644 --- a/kyo-tapir/src/main/scala/kyo/server/internal/NettyKyoToResponseBody.scala +++ b/kyo-tapir/src/main/scala/kyo/server/internal/NettyKyoToResponseBody.scala @@ -1,12 +1,6 @@ package kyo.server.internal -import io.netty.buffer.Unpooled -import io.netty.channel.ChannelHandlerContext -import io.netty.handler.codec.http.DefaultHttpContent -import io.netty.handler.codec.http.HttpContent -import java.io.InputStream import java.nio.charset.Charset -import org.reactivestreams.Publisher import sttp.capabilities.Streams import sttp.model.HasHeaders import sttp.tapir.CodecFormat @@ -14,7 +8,6 @@ import sttp.tapir.RawBodyType import sttp.tapir.WebSocketBodyOutput import sttp.tapir.server.interpreter.ToResponseBody import sttp.tapir.server.netty.NettyResponse -import sttp.tapir.server.netty.NettyResponseContent.* import sttp.tapir.server.netty.internal.NettyToResponseBody class NettyKyoToResponseBody(delegate: NettyToResponseBody)