diff options
Diffstat (limited to 'src/test/scala')
-rw-r--r-- | src/test/scala/scala/async/TreeInterrogation.scala | 3 | ||||
-rw-r--r-- | src/test/scala/scala/async/run/match0/Match0.scala | 13 | ||||
-rw-r--r-- | src/test/scala/scala/async/run/toughtype/ToughType.scala | 32 |
3 files changed, 46 insertions, 2 deletions
diff --git a/src/test/scala/scala/async/TreeInterrogation.scala b/src/test/scala/scala/async/TreeInterrogation.scala index a06437d..86a7157 100644 --- a/src/test/scala/scala/async/TreeInterrogation.scala +++ b/src/test/scala/scala/async/TreeInterrogation.scala @@ -40,8 +40,7 @@ class TreeInterrogation { val varDefs = tree1.collect { case ValDef(mods, name, _, _) if mods.hasFlag(Flag.MUTABLE) => name } - varDefs.map(_.decoded.trim).toSet mustBe (Set("state", "await$1", "await$2")) - varDefs.map(_.decoded.trim).toSet mustBe (Set("state", "await$1", "await$2")) + varDefs.map(_.decoded.trim).toSet mustBe (Set("state", "await$1$1", "await$2$1")) val defDefs = tree1.collect { case t: Template => diff --git a/src/test/scala/scala/async/run/match0/Match0.scala b/src/test/scala/scala/async/run/match0/Match0.scala index 7624838..8b99214 100644 --- a/src/test/scala/scala/async/run/match0/Match0.scala +++ b/src/test/scala/scala/async/run/match0/Match0.scala @@ -111,4 +111,17 @@ class MatchSpec { } result mustBe (3) } + + @Test def duplicateBindName() { + import AsyncId.{async, await} + def m4(m: Any) = async { + m match { + case buf: String => + await(0) + case buf: Double => + await(2) + } + } + m4("") mustBe 0 + } } diff --git a/src/test/scala/scala/async/run/toughtype/ToughType.scala b/src/test/scala/scala/async/run/toughtype/ToughType.scala index 6fcd966..2737132 100644 --- a/src/test/scala/scala/async/run/toughtype/ToughType.scala +++ b/src/test/scala/scala/async/run/toughtype/ToughType.scala @@ -105,4 +105,36 @@ class ToughTypeSpec { await(foo(new a.B)) } } + + @Test def existentialMatch() { + import scala.async.AsyncId.{async, await} + trait Container[+A] + case class ContainerImpl[A](value: A) extends Container[A] + def foo: Container[_] = async { + val a: Any = List(1) + a match { + case buf: Seq[_] => + val foo = await(5) + val e0 = buf(0) + ContainerImpl(e0) + } + } + foo + } + + @Test def existentialIfElse0() { + import scala.async.AsyncId.{async, await} + trait Container[+A] + case class ContainerImpl[A](value: A) extends Container[A] + def foo: Container[_] = async { + val a: Any = List(1) + if (true) { + val buf: Seq[_] = List(1) + val foo = await(5) + val e0 = buf(0) + ContainerImpl(e0) + } else ??? + } + foo + } } |