Skip to content

Commit

Permalink
improve compilation error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
fwbrasil committed Oct 9, 2023
1 parent 0df4d3d commit 22b75a6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
10 changes: 4 additions & 6 deletions kyo-core/shared/src/main/scala/kyo/concurrent/fibers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,8 @@ object fibers {

def run[T](v: T > Fibers)(implicit
@implicitNotFound(
"Computation can have only `Fibers` pending. Found: `${T}`"
) ng: kyo.NotGiven[(
Nothing > Any
) => T]
"'Fibers.run' only accepts the 'Fibers' effects pending. Found: '${T}'"
) ng: kyo.NotGiven[(Nothing > Any) => T]
): Fiber[T] > IOs = {
implicit val handler: DeepHandler[Fiber, Fibers] =
new DeepHandler[Fiber, Fibers] {
Expand Down Expand Up @@ -255,8 +253,8 @@ object fibers {
private val IOTask = kyo.concurrent.scheduler.IOTask

private val invalidEffects
: "Forked computations allow only `Fibers` and `IOs`. Plase handle other effects before forking. Found: `${T}`" =
"Forked computations allow only `Fibers` and `IOs`. Plase handle other effects before forking. Found: `${T}`"
: "Forked computations support only the `Fibers` and `IOs` effects pending. Please handle other effects before forking. Found: '${T}'" =
"Forked computations support only the `Fibers` and `IOs` effects pending. Please handle other effects before forking. Found: '${T}'"

/*inline*/
def forkFiber[T]( /*inline*/ v: => T > (IOs with Fibers))(implicit
Expand Down
6 changes: 2 additions & 4 deletions kyo-core/shared/src/main/scala/kyo/ios.scala
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,8 @@ object ios {
/*inline*/
def run[T](v: T > IOs)(implicit
@implicitNotFound(
"Computation can have only `IOs` pending. Found: `${T}`"
) ng: kyo.NotGiven[(
Nothing > Any
) => T]
"'IOs.run' only accepts the 'IOs' effect pending. Found: '${T}'"
) ng: kyo.NotGiven[(Nothing > Any) => T]
): T = {
val safepoint = Safepoint.noop[IO, IOs]
@tailrec def runLoop(v: T > IOs): T =
Expand Down

0 comments on commit 22b75a6

Please sign in to comment.