summaryrefslogtreecommitdiff
path: root/test/files/run/reflect-resolveoverload-targs.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run/reflect-resolveoverload-targs.scala')
-rw-r--r--test/files/run/reflect-resolveoverload-targs.scala29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/files/run/reflect-resolveoverload-targs.scala b/test/files/run/reflect-resolveoverload-targs.scala
new file mode 100644
index 0000000000..888b2f0c15
--- /dev/null
+++ b/test/files/run/reflect-resolveoverload-targs.scala
@@ -0,0 +1,29 @@
+
+import reflect.runtime.{universe=>u}
+import scala.reflect.runtime.{currentMirror => cm}
+
+class C {
+ def foo[T: u.TypeTag](x: String) = 1
+ def foo[T: u.TypeTag, S: u.TypeTag](x: String) = 2
+}
+
+object Test extends App {
+ val c = new C
+ val im = cm.reflect(c)
+ val foo = u.typeOf[C] member u.newTermName("foo") asTermSymbol
+ val f1 = foo.resolveOverloaded(
+ targs = Seq(u.typeOf[Int]),
+ posVargs = Seq(u.typeOf[String])
+ )
+
+ val f2 = foo.resolveOverloaded(
+ targs = Seq(u.typeOf[Int],
+ u.typeOf[Int]), posVargs = Seq(u.typeOf[String])
+ )
+
+ val m1 = im.reflectMethod(f1 asMethodSymbol)
+ val m2 = im.reflectMethod(f2 asMethodSymbol)
+
+ assert(m1("a", u.typeTag[Int]) == c.foo[Int]("a"))
+ assert(m2("a", u.typeTag[Int], u.typeTag[Int]) == c.foo[Int, Int]("a"))
+}