Skip to content

Commit

Permalink
support run method without extension syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
fwbrasil committed Jun 2, 2023
1 parent 4868054 commit 73b2493
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
24 changes: 24 additions & 0 deletions zio-direct-test/src/test/scala-3.x/zio/direct/RunSpec.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package zio.direct

import zio.direct.{run => runBlock}
import zio.test._
import zio.test.Assertion._
import zio._
import ZIO.{unsafe => _, _}
import zio.direct.core.util.Messages
import scala.annotation.nowarn

@nowarn
object RunSpec extends DeferRunSpec {

val spec = suite("RunSpec")(
test("supports run method without extension syntax") {
@directRunCall
def await[T](v: Task[T]): T = ???
class Blah(val value: Int)
runLiftTest(1) {
await(ZIO.succeed(1))
}
}
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ object Extractors {
tree match
case DottyExtensionCall.OneArg(invocation @ DirectRunCallAnnotated.Term(), effect) =>
Some(effect.asExpr)
case quotes.reflect.Apply(quotes.reflect.TypeApply(invocation @ DirectRunCallAnnotated.Term(), _), effect :: Nil) =>
Some(effect.asExpr)
case _ =>
None
}
Expand Down

0 comments on commit 73b2493

Please sign in to comment.