diff options
Diffstat (limited to 'src/test/scala')
-rw-r--r-- | src/test/scala/scala/async/TreeInterrogation.scala | 2 | ||||
-rw-r--r-- | src/test/scala/scala/async/run/anf/AnfTransformSpec.scala | 63 |
2 files changed, 33 insertions, 32 deletions
diff --git a/src/test/scala/scala/async/TreeInterrogation.scala b/src/test/scala/scala/async/TreeInterrogation.scala index 02f4b43..9e68005 100644 --- a/src/test/scala/scala/async/TreeInterrogation.scala +++ b/src/test/scala/scala/async/TreeInterrogation.scala @@ -32,6 +32,6 @@ class TreeInterrogation { val varDefs = tree1.collect { case ValDef(mods, name, _, _) if mods.hasFlag(Flag.MUTABLE) => name } - varDefs.map(_.decoded).toSet mustBe(Set("state$async", "onCompleteHandler$async", "await$1$1", "await$2$1")) + varDefs.map(_.decoded).toSet mustBe(Set("state$async", "onCompleteHandler$async", "await$1", "await$2")) } } diff --git a/src/test/scala/scala/async/run/anf/AnfTransformSpec.scala b/src/test/scala/scala/async/run/anf/AnfTransformSpec.scala index 1d6e09a..872e44d 100644 --- a/src/test/scala/scala/async/run/anf/AnfTransformSpec.scala +++ b/src/test/scala/scala/async/run/anf/AnfTransformSpec.scala @@ -112,37 +112,38 @@ class AnfTransformSpec { State.result mustBe (14) } - // TODO JZ -// @Test -// def `inlining block produces duplicate definition`() { -// import scala.async.AsyncId -// -// AsyncId.async { -// val f = 12 -// val x = AsyncId.await(f) -// -// { -// val x = 42 -// println(x) -// } -// -// x -// } -// } -// @Test -// def `inlining block in tail position produces duplicate definition`() { -// import scala.async.AsyncId -// -// AsyncId.async { -// val f = 12 -// val x = AsyncId.await(f) -// -// { -// val x = 42 // TODO should we rename the symbols when we collapse them into the same scope? -// x -// } -// } mustBe (42) -// } + @Test + def `inlining block does not produce duplicate definition`() { + import scala.async.AsyncId + + AsyncId.async { + val f = 12 + val x = AsyncId.await(f) + + { + type X = Int + val x: X = 42 + println(x) + } + type X = Int + x: X + } + } + + @Test + def `inlining block in tail position does not produce duplicate definition`() { + import scala.async.AsyncId + + AsyncId.async { + val f = 12 + val x = AsyncId.await(f) + + { + val x = 42 + x + } + } mustBe (42) + } @Test def `match as expression 1`() { |