summaryrefslogtreecommitdiff
path: root/test/files/run/reflection-methodsymbol-typeparams.scala
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-07-30 21:14:42 +0200
committerEugene Burmako <xeno.by@gmail.com>2012-08-02 15:36:58 +0200
commit367b82de04bdee24b0994e30c1464297eae16d74 (patch)
tree79480d2ac5adc812b0d50041ddeca5e910ffb46f /test/files/run/reflection-methodsymbol-typeparams.scala
parent7112c66d6951ac83ae3591426291ec2797824258 (diff)
downloadscala-367b82de04bdee24b0994e30c1464297eae16d74.tar.gz
scala-367b82de04bdee24b0994e30c1464297eae16d74.tar.bz2
scala-367b82de04bdee24b0994e30c1464297eae16d74.zip
miscellaneous refinements of reflection API
1) Removed unnecessary (i.e. implementable with pattern matching) type APIs. 2) Renamed isHigherKinded to takesTypeArgs making it easier to understand. 2) typeParams and resultType have been moved from MethodType to MethodSymbol Strictly speaking they are superfluous, but they are used very often.
Diffstat (limited to 'test/files/run/reflection-methodsymbol-typeparams.scala')
-rw-r--r--test/files/run/reflection-methodsymbol-typeparams.scala24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/files/run/reflection-methodsymbol-typeparams.scala b/test/files/run/reflection-methodsymbol-typeparams.scala
new file mode 100644
index 0000000000..28f1c8973d
--- /dev/null
+++ b/test/files/run/reflection-methodsymbol-typeparams.scala
@@ -0,0 +1,24 @@
+import scala.reflect.runtime.universe._
+
+class C {
+ def x1: Int = ???
+ def x2(): Int = ???
+ def x3(x: Int): Int = ???
+ def x4(x: Int)(y: Int): Int = ???
+
+ def y1[T]: Int = ???
+ def y2[T](): Int = ???
+ def y3[T](x: Int): Int = ???
+ def y4[T](x: Int)(y: Int): Int = ???
+}
+
+object Test extends App {
+ println(typeOf[C].member(newTermName("x1")).asMethodSymbol.typeParams)
+ println(typeOf[C].member(newTermName("x2")).asMethodSymbol.typeParams)
+ println(typeOf[C].member(newTermName("x3")).asMethodSymbol.typeParams)
+ println(typeOf[C].member(newTermName("x4")).asMethodSymbol.typeParams)
+ println(typeOf[C].member(newTermName("y1")).asMethodSymbol.typeParams)
+ println(typeOf[C].member(newTermName("y2")).asMethodSymbol.typeParams)
+ println(typeOf[C].member(newTermName("y3")).asMethodSymbol.typeParams)
+ println(typeOf[C].member(newTermName("y4")).asMethodSymbol.typeParams)
+} \ No newline at end of file