diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/scala/scala/async/neg/AnfTransformNegSpec.scala | 59 | ||||
-rw-r--r-- | src/test/scala/scala/async/run/anf/AnfTransformSpec.scala | 32 |
2 files changed, 32 insertions, 59 deletions
diff --git a/src/test/scala/scala/async/neg/AnfTransformNegSpec.scala b/src/test/scala/scala/async/neg/AnfTransformNegSpec.scala deleted file mode 100644 index 0678429..0000000 --- a/src/test/scala/scala/async/neg/AnfTransformNegSpec.scala +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Copyright (C) 2012 Typesafe Inc. <http://www.typesafe.com> - */ -package scala.async -package neg - -import org.junit.runner.RunWith -import org.junit.runners.JUnit4 -import org.junit.{Ignore, Test} - -@RunWith(classOf[JUnit4]) -class AnfTransformNegSpec { - - @Test - @Ignore - def `inlining block produces duplicate definition`() { - expectError("x is already defined as value x", "-deprecation -Xfatal-warnings") { - """ - | import scala.concurrent.ExecutionContext.Implicits.global - | import scala.concurrent.Future - | import scala.async.Async._ - | - | async { - | val f = Future { 12 } - | val x = await(f) - | - | { - | val x = 42 - | println(x) - | } - | - | x - | } - """.stripMargin - } - } - - @Test - @Ignore - def `inlining block in tail position produces duplicate definition`() { - expectError("x is already defined as value x", "-deprecation -Xfatal-warnings") { - """ - | import scala.concurrent.ExecutionContext.Implicits.global - | import scala.concurrent.Future - | import scala.async.Async._ - | - | async { - | val f = Future { 12 } - | val x = await(f) - | - | { - | val x = 42 - | x - | } - | } - """.stripMargin - } - } -} diff --git a/src/test/scala/scala/async/run/anf/AnfTransformSpec.scala b/src/test/scala/scala/async/run/anf/AnfTransformSpec.scala index f2fc2d7..0abb937 100644 --- a/src/test/scala/scala/async/run/anf/AnfTransformSpec.scala +++ b/src/test/scala/scala/async/run/anf/AnfTransformSpec.scala @@ -111,4 +111,36 @@ class AnfTransformSpec { Await.result(fut, 2 seconds) State.result mustBe (14) } + + @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) + + } } |