diff options
Diffstat (limited to 'test/files/run/reflection-equality.scala')
-rw-r--r-- | test/files/run/reflection-equality.scala | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/files/run/reflection-equality.scala b/test/files/run/reflection-equality.scala new file mode 100644 index 0000000000..35dc47a59f --- /dev/null +++ b/test/files/run/reflection-equality.scala @@ -0,0 +1,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.typeSignature + |val ms: MethodSymbol = ts.declaration(newTermName("methodIntIntInt")).asMethodSymbol + |val MethodType( _, t1 ) = ms.typeSignature + |val t2 = typeOf[scala.Int] + |t1 == t2 + |t1 =:= t2 + |t1 <:< t2 + |t2 <:< t1 + |""".stripMargin +} |