summaryrefslogtreecommitdiff
path: root/test/disabled/run/code.scala
blob: 763a481e5e027cce475e3d25f9e66c39228acf50 (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
import scala.tools.partest.utils.CodeTest

case class Element(name: String)

object Test extends App {
  case class InnerElement(name: String)
  def foo[T](ys: List[T]) = {
    val fun: reflect.Code[Int => Int] = x => x + ys.length
    fun
  }
  CodeTest(foo(List(2)), args)
  CodeTest({() => val e = Element("someName"); e}, args)
//  CodeTest({() => val e = InnerElement("someName"); e}, args) // (does not work yet)
  def titi() = {
    var truc = 0
    CodeTest(() => {
      truc = 6
    }, args)
  }
  def tata(): Unit = {
    var truc = 0
    CodeTest(() => {
      truc = truc + 6
    }, args)
  }
  titi()
  tata()
  new baz.A(args)
}

package baz {

  case class BazElement(name: String) { }

  class A(args: Array[String]) {
    CodeTest(() => new baz.BazElement("someName"), args)
  }

}