aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/scala/async/FutureSystem.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala/scala/async/FutureSystem.scala')
-rw-r--r--src/main/scala/scala/async/FutureSystem.scala9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main/scala/scala/async/FutureSystem.scala b/src/main/scala/scala/async/FutureSystem.scala
index 20bbea3..e9373b3 100644
--- a/src/main/scala/scala/async/FutureSystem.scala
+++ b/src/main/scala/scala/async/FutureSystem.scala
@@ -33,6 +33,9 @@ trait FutureSystem {
/** Lookup the execution context, typically with an implicit search */
def execContext: Expr[ExecContext]
+ def promType[A: WeakTypeTag]: Type
+ def execContextType: Type
+
/** Create an empty promise */
def createProm[A: WeakTypeTag]: Expr[Prom[A]]
@@ -71,6 +74,9 @@ object ScalaConcurrentFutureSystem extends FutureSystem {
case context => context
})
+ def promType[A: WeakTypeTag]: Type = c.weakTypeOf[Promise[A]]
+ def execContextType: Type = c.weakTypeOf[ExecutionContext]
+
def createProm[A: WeakTypeTag]: Expr[Prom[A]] = reify {
Promise[A]()
}
@@ -113,6 +119,9 @@ object IdentityFutureSystem extends FutureSystem {
def execContext: Expr[ExecContext] = c.literalUnit
+ def promType[A: WeakTypeTag]: Type = c.weakTypeOf[Prom[A]]
+ def execContextType: Type = c.weakTypeOf[Unit]
+
def createProm[A: WeakTypeTag]: Expr[Prom[A]] = reify {
new Prom(null.asInstanceOf[A])
}