summaryrefslogtreecommitdiff
path: root/test/files/run/t8196.scala
blob: d526eafbb36f13a974e2e13924f066a4b8362519 (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
object Test extends App {
 
  trait FormTrait {
    import scala.reflect.runtime.{ universe => ru }

    val runtimeMirror = ru.runtimeMirror(this.getClass.getClassLoader)
    val instanceMirror = runtimeMirror.reflect(this)
    val members = instanceMirror.symbol.typeSignature.members
    def fields = members.filter(_.typeSignature <:< ru.typeOf[Int])
  }
 
  val f = () => {
 
    class Form1 extends FormTrait {
      val f1 = 5
    }
    val form1 = new Form1
 
    println(form1.fields)
 
    val form2 = new FormTrait {
      val g1 = new Form1
    }
 
    form2.g1 // comment this line in order to make the test pass
    ()
  }

  f()  
}