summaryrefslogtreecommitdiff
path: root/test/files/run/reflection-equality.scala
blob: 0416bc77268e03e3a7edb27e0b80ef2d0301218b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import scala.tools.partest.ReplTest

object Test extends ReplTest {
  def code = """
    |class X {
    |   def methodIntIntInt(x: Int, y: Int) = x+y
    |}
    |
    |import scala.reflect.runtime.universe._
    |import scala.reflect.runtime.{ currentMirror => cm }
    |def im: InstanceMirror = cm.reflect(new X)
    |val cs: ClassSymbol = im.symbol
    |val ts: Type = cs.info
    |val ms: MethodSymbol = ts.decl(TermName("methodIntIntInt")).asMethod
    |val MethodType( _, t1 ) = ms.info
    |val t2 = typeOf[scala.Int]
    |t1 == t2
    |t1 =:= t2
    |t1 <:< t2
    |t2 <:< t1
    |""".stripMargin
}