diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-07-06 21:13:44 +0400 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-07-06 22:30:17 +0400 |
commit | a3fe989833cc482dbae04a2e2f822a74cad67a36 (patch) | |
tree | dc81f754896bff47e924a6d434c1df9c292af4b3 /test/files | |
parent | c39c7276c38f9ef66fd7054609ef33627efe5177 (diff) | |
download | scala-a3fe989833cc482dbae04a2e2f822a74cad67a36.tar.gz scala-a3fe989833cc482dbae04a2e2f822a74cad67a36.tar.bz2 scala-a3fe989833cc482dbae04a2e2f822a74cad67a36.zip |
SI-6036 yet again makes sense of magic symbols
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/reflection-magicsymbols.check | 22 | ||||
-rw-r--r-- | test/files/run/reflection-magicsymbols.scala | 11 |
2 files changed, 33 insertions, 0 deletions
diff --git a/test/files/run/reflection-magicsymbols.check b/test/files/run/reflection-magicsymbols.check new file mode 100644 index 0000000000..2600847d99 --- /dev/null +++ b/test/files/run/reflection-magicsymbols.check @@ -0,0 +1,22 @@ +Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala>
+
+scala> import scala.reflect.runtime.universe._
+import scala.reflect.runtime.universe._
+
+scala> class A { def foo(x: Int*) = 1 }
+defined class A
+
+scala> val sig = typeOf[A] member newTermName("foo") typeSignature
+warning: there were 1 feature warnings; re-run with -feature for details
+sig: reflect.runtime.universe.Type = (x: <?>)scala.Int
+
+scala> val x = sig.asInstanceOf[MethodType].params.head
+x: reflect.runtime.universe.Symbol = value x
+
+scala> println(x.typeSignature)
+scala.Int*
+
+scala>
diff --git a/test/files/run/reflection-magicsymbols.scala b/test/files/run/reflection-magicsymbols.scala new file mode 100644 index 0000000000..a40845d6ac --- /dev/null +++ b/test/files/run/reflection-magicsymbols.scala @@ -0,0 +1,11 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + def code = """ + |import scala.reflect.runtime.universe._ + |class A { def foo(x: Int*) = 1 } + |val sig = typeOf[A] member newTermName("foo") typeSignature + |val x = sig.asInstanceOf[MethodType].params.head + |println(x.typeSignature) + |""".stripMargin +} |