summaryrefslogtreecommitdiff
path: root/test/files/run/reflection-equality.scala
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2012-07-06 01:42:40 -0700
committerAdriaan Moors <adriaan.moors@epfl.ch>2012-07-06 01:42:40 -0700
commitcd0fb51ee8c49c6681c053f0ddeb531e92058c92 (patch)
tree37f8e340a72d3dad3ffff3e9ddae1ed521663ef5 /test/files/run/reflection-equality.scala
parent34d36108bf152469a934408da2b55c1df9c70a7a (diff)
parent0529dd502a45e29aa617986ff9ab29e145d62582 (diff)
downloadscala-cd0fb51ee8c49c6681c053f0ddeb531e92058c92.tar.gz
scala-cd0fb51ee8c49c6681c053f0ddeb531e92058c92.tar.bz2
scala-cd0fb51ee8c49c6681c053f0ddeb531e92058c92.zip
Merge pull request #822 from scalamacros/ticket/5959
SI-5959 type equality now accounts for mirrors
Diffstat (limited to 'test/files/run/reflection-equality.scala')
-rw-r--r--test/files/run/reflection-equality.scala22
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
+}