diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-07-02 15:55:34 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-07-03 10:04:55 +0200 |
commit | 82232ec47effb4a6b67b3a0792e1c7600e2d31b7 (patch) | |
tree | ed9925418aa0a631d1d25fd1be30f5d508e81b24 /src/test/scala/scala/async/run/toughtype/ToughType.scala | |
parent | d63b63f536aafa494c70835526174be1987050de (diff) | |
download | scala-async-82232ec47effb4a6b67b3a0792e1c7600e2d31b7.tar.gz scala-async-82232ec47effb4a6b67b3a0792e1c7600e2d31b7.tar.bz2 scala-async-82232ec47effb4a6b67b3a0792e1c7600e2d31b7.zip |
An overdue overhaul of macro internals.
- Avoid reset + retypecheck, instead hang onto the original types/symbols
- Eliminated duplication between AsyncDefinitionUseAnalyzer and ExprBuilder
- Instead, decide what do lift *after* running ExprBuilder
- Account for transitive references local classes/objects and lift them
as needed.
- Make the execution context an regular implicit parameter of the macro
- Fixes interaction with existential skolems and singleton types
Fixes #6, #13, #16, #17, #19, #21.
Diffstat (limited to 'src/test/scala/scala/async/run/toughtype/ToughType.scala')
-rw-r--r-- | src/test/scala/scala/async/run/toughtype/ToughType.scala | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/test/scala/scala/async/run/toughtype/ToughType.scala b/src/test/scala/scala/async/run/toughtype/ToughType.scala index 83f5a2d..6fcd966 100644 --- a/src/test/scala/scala/async/run/toughtype/ToughType.scala +++ b/src/test/scala/scala/async/run/toughtype/ToughType.scala @@ -67,4 +67,42 @@ class ToughTypeSpec { await(f(2)) } mustBe 3 } + + @Test def existentialBindIssue19() { + import AsyncId.{await, async} + def m7(a: Any) = async { + a match { + case s: Seq[_] => + val x = s.size + var ss = s + ss = s + await(x) + } + } + m7(Nil) mustBe 0 + } + + @Test def existentialBind2Issue19() { + import scala.async.Async._, scala.concurrent.ExecutionContext.Implicits.global + def conjure[T]: T = null.asInstanceOf[T] + + def m3 = async { + val p: List[Option[_]] = conjure[List[Option[_]]] + await(future(1)) + } + + def m4 = async { + await(future[List[_]](Nil)) + } + } + + @Test def singletonTypeIssue17() { + import scala.async.AsyncId.{async, await} + class A { class B } + async { + val a = new A + def foo(b: a.B) = 0 + await(foo(new a.B)) + } + } } |