Skip to content

Commit

Permalink
remove unused code (#607)
Browse files Browse the repository at this point in the history
  • Loading branch information
fwbrasil authored Aug 26, 2024
1 parent 65679bf commit 754e366
Show file tree
Hide file tree
Showing 64 changed files with 71 additions and 180 deletions.
2 changes: 0 additions & 2 deletions kyo-bench/src/main/scala/kyo/bench/StateBench.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package kyo.bench

import org.openjdk.jmh.annotations.Benchmark

class StateBench extends Bench.SyncAndFork(0):

val n = 1000
Expand Down
2 changes: 0 additions & 2 deletions kyo-bench/src/main/scala/kyo/bench/StateMapBench.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package kyo.bench

import org.openjdk.jmh.annotations.Benchmark

class StateMapBench extends Bench.SyncAndFork(1000):

val n = 1000
Expand Down
3 changes: 0 additions & 3 deletions kyo-cache/shared/src/main/scala/kyo/Cache.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import Cache.*
import com.github.benmanes.caffeine
import com.github.benmanes.caffeine.cache.Caffeine
import java.util.concurrent.TimeUnit
import scala.runtime.AbstractFunction1
import scala.util.Failure
import scala.util.Success

class Cache(private[kyo] val store: Store):
def memo[A, B: Flat, S](
Expand Down
3 changes: 0 additions & 3 deletions kyo-combinators/shared/src/main/scala/kyo/Combinators.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ package kyo
import kyo.debug.Debug
import kyo.kernel.Boundary
import kyo.kernel.Reducible
import scala.annotation.implicitNotFound
import scala.annotation.tailrec
import scala.annotation.targetName
import scala.concurrent.Future
import scala.reflect.ClassTag
import scala.util.NotGiven

extension [A, S](effect: A < S)

Expand Down
2 changes: 0 additions & 2 deletions kyo-combinators/shared/src/main/scala/kyo/Constructors.scala
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package kyo

import kyo.kernel.Reducible
import scala.annotation.implicitNotFound
import scala.annotation.tailrec
import scala.annotation.targetName
import scala.concurrent.Future
import scala.reflect.ClassTag
import scala.util.Failure
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package kyo.scheduler

import java.lang.invoke.MethodHandles

abstract class IOPromisePlatformSpecific:

class VarHandle:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package kyo.internal
import java.util.concurrent.CompletionStage
import kyo.*
import kyo.scheduler.IOPromise
import kyo.scheduler.IOTask

trait FiberPlatformSpecific:
def fromCompletionStage[A](cs: CompletionStage[A])(using Frame): A < Async =
Expand Down
4 changes: 0 additions & 4 deletions kyo-core/shared/src/main/scala/kyo/Async.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,16 @@ package kyo
export Async.Fiber
export Async.Promise
import java.util.concurrent.atomic.AtomicInteger
import java.util.concurrent.locks.LockSupport
import kyo.Maybe.Empty
import kyo.Result.Panic
import kyo.Tag
import kyo.internal.FiberPlatformSpecific
import kyo.kernel.*
import kyo.scheduler.*
import scala.annotation.implicitNotFound
import scala.annotation.tailrec
import scala.annotation.targetName
import scala.collection.immutable.ArraySeq
import scala.concurrent.ExecutionContext
import scala.concurrent.Future
import scala.reflect.ClassTag
import scala.util.NotGiven
import scala.util.control.NonFatal
import scala.util.control.NoStackTrace
Expand Down
1 change: 0 additions & 1 deletion kyo-core/shared/src/main/scala/kyo/Channel.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package kyo
import kyo.scheduler.IOPromise
import org.jctools.queues.MpmcUnboundedXaddArrayQueue
import scala.annotation.tailrec
import scala.util.control.NoStackTrace

abstract class Channel[A]:
self =>
Expand Down
5 changes: 0 additions & 5 deletions kyo-core/shared/src/main/scala/kyo/IO.scala
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
package kyo

import java.util.concurrent.atomic.AtomicReference
import kyo.Tag
import kyo.kernel.*
import scala.util.Failure
import scala.util.Success
import scala.util.Try
import scala.util.control.NonFatal

sealed trait IO extends Effect[Const[Unit], Const[Unit]]

Expand Down
1 change: 0 additions & 1 deletion kyo-core/shared/src/main/scala/kyo/KyoApp.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package kyo

import scala.collection.mutable.ListBuffer
import scala.util.Try

abstract class KyoApp extends KyoApp.Base[KyoApp.Effects]:
def log: Log.Unsafe = Log.unsafe
Expand Down
1 change: 0 additions & 1 deletion kyo-core/shared/src/main/scala/kyo/Queue.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import java.util.concurrent.atomic.AtomicBoolean
import java.util.concurrent.atomic.AtomicReference
import org.jctools.queues.*
import scala.annotation.tailrec
import scala.util.control.NoStackTrace

class Queue[A] private[kyo] (initFrame: Frame, private[kyo] val unsafe: Queue.Unsafe[A]):

Expand Down
9 changes: 0 additions & 9 deletions kyo-core/shared/src/main/scala/kyo/scheduler/IOPromise.scala
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
package kyo.scheduler

import IOPromise.*
import java.lang.invoke.MethodHandles
import java.lang.invoke.VarHandle
import java.util.concurrent.Executors
import java.util.concurrent.atomic.AtomicReference
import java.util.concurrent.locks.LockSupport
import kyo.*
import kyo.Result.Panic
import kyo.kernel.Platform
import kyo.kernel.Safepoint
import kyo.scheduler.Scheduler
import scala.annotation.tailrec
import scala.util.control.NonFatal
import scala.util.control.NoStackTrace
Expand Down Expand Up @@ -148,9 +142,6 @@ private[kyo] class IOPromise[E, A](init: State[E, A]) extends Safepoint.Intercep
discard(complete(v))

final def complete[E2 <: E, A2 <: A](v: Result[E2, A2]): Boolean =
val r =
if !isNull(v) then v
else Result.success(null)
@tailrec def completeLoop(): Boolean =
state match
case p: Pending[E, A] @unchecked =>
Expand Down
4 changes: 0 additions & 4 deletions kyo-core/shared/src/main/scala/kyo/scheduler/IOTask.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ import kyo.*
import kyo.Tag
import kyo.kernel.*
import kyo.kernel.Effect
import kyo.scheduler.InternalClock
import kyo.scheduler.IOTask.*
import kyo.scheduler.Scheduler
import kyo.scheduler.Task
import scala.annotation.tailrec
import scala.util.control.NonFatal

private[kyo] class IOTask[Ctx, E, A] private (
Expand Down
2 changes: 0 additions & 2 deletions kyo-core/shared/src/test/scala/kyo/AsyncTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package kyo
import java.io.Closeable
import java.util.concurrent.atomic.AtomicInteger as JAtomicInteger
import org.scalatest.compatible.Assertion
import scala.util.Failure
import scala.util.Try

class AsyncTest extends Test:

Expand Down
2 changes: 0 additions & 2 deletions kyo-core/shared/src/test/scala/kyo/IOTest.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package kyo

import org.scalatest.compatible.Assertion
import scala.util.Failure
import scala.util.Success
import scala.util.Try

class IOTest extends Test:
Expand Down
1 change: 0 additions & 1 deletion kyo-core/shared/src/test/scala/kyo/Test.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package kyo

import internal.BaseKyoTest
import kyo.internal.BaseKyoTest
import kyo.kernel.Platform
import org.scalatest.NonImplicitAssertions
Expand Down
2 changes: 0 additions & 2 deletions kyo-core/shared/src/test/scala/kyo/stats/AttributesTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package kyo.stats

import kyo.*
import kyo.stats.Attributes.*
import org.scalatest.NonImplicitAssertions
import org.scalatest.freespec.AnyFreeSpec

class AttributesTest extends Test:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package kyo.stats.internal

import kyo.*
import kyo.stats.*
import kyo.stats.internal.*

class SpanTest extends Test:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package kyo.stats.internal

import kyo.*
import kyo.stats.*
import kyo.stats.internal.*

class TraceReceiverTest extends Test:

Expand Down
26 changes: 13 additions & 13 deletions kyo-data/shared/src/test/scala/kyo/MaybeTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -432,25 +432,25 @@ class MaybeTest extends Test:
"should return Empty if any are Empty" in {
val result1 =
for
x <- Defined(1)
y <- Empty
z <- Defined(3)
_ <- Defined(1)
_ <- Empty
_ <- Defined(3)
yield ()
assert(result1 == Empty)

val result2 =
for
x <- Empty
y <- Defined(2)
z <- Defined(3)
_ <- Empty
_ <- Defined(2)
_ <- Defined(3)
yield ()
assert(result2 == Empty)

val result3 =
for
x <- Defined(1)
y <- Defined(2)
z <- Empty
_ <- Defined(1)
_ <- Defined(2)
_ <- Empty
yield ()
assert(result3 == Empty)
}
Expand Down Expand Up @@ -493,11 +493,11 @@ class MaybeTest extends Test:
"should return Empty if any inner comprehension is Empty" in {
val result =
for
x <- Defined(1)
y <-
_ <- Defined(1)
_ <-
for
a <- Empty
b <- Defined(3)
_ <- Empty
_ <- Defined(3)
yield ()
yield ()
assert(result == Empty)
Expand Down
6 changes: 4 additions & 2 deletions kyo-data/shared/src/test/scala/kyo/ResultTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ class ResultTest extends Test:
"filter" - {
"adds NoSuchElementException" in {
val x = Result.success(2).filter(_ % 2 == 0)
discard(x)
assertCompiles("val _: Result[NoSuchElementException, Int] = x")
}
"returns itself if the predicate holds for Success" in {
Expand Down Expand Up @@ -345,6 +346,7 @@ class ResultTest extends Test:
}
"fails to compile for non-Throwable error" in {
val failure: Result[String, Int] = Fail("Something went wrong")
val _ = failure
assertDoesNotCompile("failure.toTry")
}
}
Expand Down Expand Up @@ -657,8 +659,8 @@ class ResultTest extends Test:
"handle exceptions in the yield" in {
val result =
for
x <- Result.success(1)
y <- Result.success(2)
_ <- Result.success(1)
_ <- Result.success(2)
yield throw new Exception("error")

assert(result.isPanic)
Expand Down
2 changes: 0 additions & 2 deletions kyo-data/shared/src/test/scala/kyo/Test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package kyo

import org.scalatest.NonImplicitAssertions
import org.scalatest.freespec.AsyncFreeSpec
import scala.concurrent.ExecutionContext
import scala.concurrent.Future
import scala.util.Try

abstract class Test extends AsyncFreeSpec with NonImplicitAssertions:
Expand Down
1 change: 0 additions & 1 deletion kyo-direct/shared/src/main/scala/kyo/direct.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package kyo
import cps.CpsMonad
import cps.CpsMonadContext
import cps.async
import cps.await
import directInternal.*
import scala.annotation.tailrec
import scala.quoted.*
Expand Down
2 changes: 0 additions & 2 deletions kyo-direct/shared/src/test/scala/kyo/DirectTest.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package kyo

import scala.util.Try

class DirectTest extends Test:

// "match" in {
Expand Down
5 changes: 0 additions & 5 deletions kyo-prelude/js/src/main/scala/kyo/kernel/TracePool.scala
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
package kyo.kernel

import internal.*
import java.util.Arrays
import java.util.concurrent.atomic.AtomicInteger
import org.jctools.queues.MessagePassingQueue.Consumer
import org.jctools.queues.MpmcArrayQueue
import scala.annotation.tailrec

private[kernel] object TracePool:
inline def globalCapacity: Int = 0
Expand Down
2 changes: 0 additions & 2 deletions kyo-prelude/jvm/src/main/scala/kyo/kernel/TracePool.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ package kyo.kernel

import internal.*
import java.util.Arrays
import java.util.concurrent.atomic.AtomicInteger
import org.jctools.queues.MessagePassingQueue.Consumer
import org.jctools.queues.MpmcArrayQueue
import scala.annotation.tailrec

private[kernel] object TracePool:
inline def globalCapacity: Int = 10240
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ package kyo.kernel
import kyo.*
import kyo.Tag
import kyo.Tagged.*
import kyo.bug.KyoBugException
import scala.collection.mutable.Queue
import scala.collection.mutable.Stack
import scala.concurrent.Await
import scala.concurrent.Future

Expand Down Expand Up @@ -374,7 +371,7 @@ class SafepointTest extends Test:

"ensure" - {
sealed trait TestEffect1 extends Effect[Const[Int], Const[Int]]
sealed trait TestEffect2 extends Effect[Const[String], Const[String]]

"executes cleanup after successful completion" in {
var cleaned = false
val result = Safepoint.ensure { cleaned = true } {
Expand Down
2 changes: 0 additions & 2 deletions kyo-prelude/shared/src/main/scala/kyo/Layer.scala
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package kyo

import Layer.internal.*
import java.util.concurrent.ConcurrentHashMap as JConcurrentHashMap
import kyo.Tag
import kyo.kernel.Reducible
import scala.annotation.targetName

abstract class Layer[+Out, -S]:
self =>
Expand Down
2 changes: 0 additions & 2 deletions kyo-prelude/shared/src/main/scala/kyo/kernel/Boundary.scala
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package kyo.kernel

import internal.*
import kyo.Tag
import scala.annotation.nowarn
import scala.annotation.tailrec
import scala.quoted.*

final class Boundary[Ctx, +S] private (dummy: Unit) extends AnyVal:
Expand Down
Loading

0 comments on commit 754e366

Please sign in to comment.