aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/scala/async/neg/AnfTransformNegSpec.scala
blob: 0678429d618930f304673eed82a8ae461907db33 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/**
 * 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
    }
  }
}