summaryrefslogtreecommitdiff
path: root/src/reflect/scala/reflect/api/Types.scala
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2014-01-28 17:29:58 +0300
committerEugene Burmako <xeno.by@gmail.com>2014-02-14 14:16:43 +0100
commit0f4e95574081bd9a945fb5b32d157a32af840cd3 (patch)
treed512def0c31970706073afb8a442fc0032c8a85f /src/reflect/scala/reflect/api/Types.scala
parentdf061de3fb2bc9a96d7bc77dc45c09f10fdb8531 (diff)
downloadscala-0f4e95574081bd9a945fb5b32d157a32af840cd3.tar.gz
scala-0f4e95574081bd9a945fb5b32d157a32af840cd3.tar.bz2
scala-0f4e95574081bd9a945fb5b32d157a32af840cd3.zip
adds Type.typeArgs
It’s very probable that this is the single most requested method in the entire reflection API of Scala 2.10.
Diffstat (limited to 'src/reflect/scala/reflect/api/Types.scala')
-rw-r--r--src/reflect/scala/reflect/api/Types.scala15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/reflect/scala/reflect/api/Types.scala b/src/reflect/scala/reflect/api/Types.scala
index e524af583b..0944171482 100644
--- a/src/reflect/scala/reflect/api/Types.scala
+++ b/src/reflect/scala/reflect/api/Types.scala
@@ -231,6 +231,21 @@ trait Types {
*/
def dealias: Type
+ /******* popular methods from subclasses *******/
+
+ /** List of type arguments ingrained in this type reference.
+ * Depending on your use case you might or might not want to call `dealias` first.
+ * scala> type T = List[Int]
+ * defined type alias T
+ *
+ * scala> typeOf[T].typeArgs
+ * res0: List[reflect.runtime.universe.Type] = List()
+ *
+ * scala> typeOf[T].dealias.typeArgs
+ * res1: List[reflect.runtime.universe.Type] = List(scala.Int)
+ */
+ def typeArgs: List[Type]
+
/******************* helpers *******************/
/** Provides an alternate if type is NoType.