summaryrefslogtreecommitdiff
path: root/test/files/run/t7747-repl.scala
blob: 141c2d984451b763c1c2dc3c3b81edf06560fb6a (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import scala.tools.partest.ReplTest
import scala.tools.nsc.Settings

object Test extends ReplTest {

  override def transformSettings(s: Settings): Settings = {
    s.Yreplclassbased.value = true
    s
  }

  def code = """
    |var x = 10
    |var y = 11
    |x = 12
    |y = 13
    |val z = x * y
    |2 ; 3
    |{ 2 ; 3 }
    |5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = {
    |  1 +
    |  2 +
    |  3 } ; bippy+88+11
    |
    |object Bovine { var x: List[_] = null } ; case class Ruminant(x: Int) ; bippy * bippy * bippy
    |Bovine.x = List(Ruminant(5), Cow, new Moo)
    |Bovine.x
    |
    |(2)
    |(2 + 2)
    |((2 + 2))
    |  ((2 + 2))
    |  (  (2 + 2))
    |  (  (2 + 2 )  )
    |5 ;   (  (2 + 2 )  ) ; ((5))
    |(((2 + 2)), ((2 + 2)))
    |(((2 + 2)), ((2 + 2)), 2)
    |(((((2 + 2)), ((2 + 2)), 2).productIterator ++ Iterator(3)).mkString)
    |
    |55 ; ((2 + 2)) ; (1, 2, 3)
    |55 ; (x: Int) => x + 1 ; () => ((5))
    |
    |() => 5
    |55 ; () => 5
    |() => { class X ; new X }
    |
    |def foo(x: Int)(y: Int)(z: Int) = x+y+z
    |foo(5)(10)(15)+foo(5)(10)(15)
    |
    |List(1) ++ List('a')
    |
    |1 to 100 map (_  + 1)
    |val x1 = 1
    |val x2 = 2
    |val x3 = 3
    |case class BippyBungus()
    |x1 + x2 + x3
    |:reset
    |x1 + x2 + x3
    |val x1 = 4
    |new BippyBungus
    |class BippyBungus() { def f = 5 }
    |{ new BippyBungus ; x1 }
    |object x {class y { case object z } }
    |case class BippyBups()
    |case class PuppyPups()
    |case class Bingo()
    |List(BippyBups(), PuppyPups(), Bingo()) // show
    |case class Sum(exp: String, exp2: String)
    |val a = Sum("A", "B")
    |def b(a: Sum): String = a match { case Sum(_, _) => "Found Sum" }
    |b(a)
    |:power
    |intp.lastRequest
    |""".stripMargin
}