Skip to content

Commit

Permalink
better compile errors
Browse files Browse the repository at this point in the history
  • Loading branch information
fwbrasil committed Sep 24, 2023
1 parent ecc3cf6 commit 230986d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion kyo-core/shared/src/main/scala/kyo/concurrent/fibers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import scala.util.control.NonFatal

import scheduler._
import timers._
import scala.annotation.implicitNotFound

object fibers {

Expand Down Expand Up @@ -191,7 +192,11 @@ object fibers {
private[kyo] val interrupted = IOs.fail(Interrupted)

/*inline*/
def run[T](v: T > Fibers)(implicit ng: kyo.NotGiven[(Nothing > Any) => T]): Fiber[T] > IOs = {
def run[T](v: T > Fibers)(implicit
@implicitNotFound("Computation can have only `Fibers` pending") ng: kyo.NotGiven[(
Nothing > Any
) => T]
): Fiber[T] > IOs = {
implicit val handler: DeepHandler[Fiber, Fibers] =
new DeepHandler[Fiber, Fibers] {
def pure[T](v: T) = Fiber.done(v)
Expand Down
7 changes: 6 additions & 1 deletion kyo-core/shared/src/main/scala/kyo/ios.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import core.internal._
import tries._
import options._
import locals._
import scala.annotation.implicitNotFound

object ios {

Expand Down Expand Up @@ -65,7 +66,11 @@ object ios {
}

/*inline*/
def run[T](v: T > IOs)(implicit ng: kyo.NotGiven[(Nothing > Any) => T]): T = {
def run[T](v: T > IOs)(implicit
@implicitNotFound("Computation can have only `IOs` pending") ng: kyo.NotGiven[(
Nothing > Any
) => T]
): T = {
val safepoint = Safepoint.noop[IO, IOs]
@tailrec def runLoop(v: T > IOs): T =
v match {
Expand Down

0 comments on commit 230986d

Please sign in to comment.