summaryrefslogtreecommitdiff
path: root/test/files/presentation/t8941b/Test.scala
blob: 7269a14286896598e4de3666b21e77df07d8fac7 (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
import scala.tools.nsc.interactive.tests.core.IdempotencyTest

// At the time of writing this test, removing any part of `enterExistingSym` 
// leads to a failure.
object Test {
  def main(args: Array[String]) {
    test("""
      object Foo {
        def term {
          def foo(c: String = "") = c
          class MagicInterruptionMarker
          foo()/*?*/
        }
      }
    """)

    test("""
      object Foo {
        def term {
          def foo = 42
          class MagicInterruptionMarker
          foo/*?*/
        }
      }
    """)

    test("""
      object Foo {
        def term {
          lazy val foo = 42
          class MagicInterruptionMarker
          foo/*?*/
        }
      }
    """)

    test("""
      object Foo {
        implicit class C(val a: String) extends AnyVal
        class MagicInterruptionMarker
        ""/*?*/
      }
    """)
  }

  def test(code0: String) {
    val t = new IdempotencyTest {
      def code = code0
    }
    t.show()
  }
}