Skip to content

Instantly share code, notes, and snippets.

@dragos
Created August 7, 2013 10:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dragos/6172890 to your computer and use it in GitHub Desktop.
Save dragos/6172890 to your computer and use it in GitHub Desktop.
val tpe = typeOf[test.GenericFoo[Int]] //> tpe : reflect.runtime.universe.Type = test.GenericFoo[Int]
tpe.getClass //> res0: Class[?0] = class scala.reflect.internal.Types$TypeRef$$anon$5
tpe.takesTypeArgs //> res1: Boolean = false
val tpe1 = typeOf[test.GenericFoo[_]].typeSymbol.typeSignature
//> tpe1 : reflect.runtime.universe.Type = [T]AnyRef{def <init>(): test.Generic
//| Foo[T]}
tpe1.getClass //> res2: Class[?0] = class scala.reflect.internal.Types$PolyType
tpe1.takesTypeArgs //> res3: Boolean = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment