summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-06-08 11:43:20 +0200
committerEugene Burmako <xeno.by@gmail.com>2012-06-08 15:35:23 +0200
commitabc1c0be79ac2fb2b0e75c87a489570a9c71aa6e (patch)
tree5d2723fa39aa8b28337b1e005ae06891667580a2 /test/files
parent2123201e3cbc34676d2936226539bdfa0555c275 (diff)
downloadscala-abc1c0be79ac2fb2b0e75c87a489570a9c71aa6e.tar.gz
scala-abc1c0be79ac2fb2b0e75c87a489570a9c71aa6e.tar.bz2
scala-abc1c0be79ac2fb2b0e75c87a489570a9c71aa6e.zip
tests and fixes for the mirror API
Diffstat (limited to 'test/files')
-rw-r--r--test/files/run/reflect-overload.scala2
-rw-r--r--test/files/run/reflection-constructormirror-inner-badpath.check2
-rw-r--r--test/files/run/reflection-constructormirror-inner-badpath.scala32
-rw-r--r--test/files/run/reflection-constructormirror-inner-good.check1
-rw-r--r--test/files/run/reflection-constructormirror-inner-good.scala26
-rw-r--r--test/files/run/reflection-constructormirror-nested-badpath.check2
-rw-r--r--test/files/run/reflection-constructormirror-nested-badpath.scala32
-rw-r--r--test/files/run/reflection-constructormirror-nested-good.check1
-rw-r--r--test/files/run/reflection-constructormirror-nested-good.scala26
-rw-r--r--test/files/run/reflection-constructormirror-toplevel-badpath.check2
-rw-r--r--test/files/run/reflection-constructormirror-toplevel-badpath.scala33
-rw-r--r--test/files/run/reflection-constructormirror-toplevel-good.check1
-rw-r--r--test/files/run/reflection-constructormirror-toplevel-good.scala27
-rw-r--r--test/files/run/reflection-fieldmirror-ctorparam.scala2
-rw-r--r--test/files/run/reflection-fieldmirror-getsetval.scala2
-rw-r--r--test/files/run/reflection-fieldmirror-getsetvar.scala2
-rw-r--r--test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala4
-rw-r--r--test/files/run/reflection-fieldmirror-privatethis.scala4
-rw-r--r--test/files/run/reflection-fieldmirror-sanitycheck.scala2
-rw-r--r--test/files/run/reflection-implClass.scala6
-rw-r--r--test/files/run/reflection-modulemirror-inner-badpath.check2
-rw-r--r--test/files/run/reflection-modulemirror-inner-badpath.scala24
-rw-r--r--test/files/run/reflection-modulemirror-inner-good.check2
-rw-r--r--test/files/run/reflection-modulemirror-inner-good.scala23
-rw-r--r--test/files/run/reflection-modulemirror-nested-badpath.check2
-rw-r--r--test/files/run/reflection-modulemirror-nested-badpath.scala26
-rw-r--r--test/files/run/reflection-modulemirror-nested-good.check2
-rw-r--r--test/files/run/reflection-modulemirror-nested-good.scala24
-rw-r--r--test/files/run/reflection-modulemirror-toplevel-badpath.check2
-rw-r--r--test/files/run/reflection-modulemirror-toplevel-badpath.scala26
-rw-r--r--test/files/run/reflection-modulemirror-toplevel-good.check1
-rw-r--r--test/files/run/reflection-modulemirror-toplevel-good.scala20
-rw-r--r--test/files/run/reflection-simple.scala2
-rw-r--r--test/files/run/t5256a.scala2
-rw-r--r--test/files/run/t5256b.scala2
-rw-r--r--test/files/run/t5256c.scala2
-rw-r--r--test/files/run/t5256d.check2
-rw-r--r--test/files/run/t5256d.scala2
-rw-r--r--test/files/run/t5256e.check6
-rw-r--r--test/files/run/t5256e.scala2
-rw-r--r--test/files/run/t5256f.check12
-rw-r--r--test/files/run/t5256f.scala4
-rw-r--r--test/files/run/t5256g.scala2
-rw-r--r--test/files/run/t5256h.scala2
-rw-r--r--test/files/run/t5423.scala2
45 files changed, 372 insertions, 33 deletions
diff --git a/test/files/run/reflect-overload.scala b/test/files/run/reflect-overload.scala
index ea3767903c..870a200813 100644
--- a/test/files/run/reflect-overload.scala
+++ b/test/files/run/reflect-overload.scala
@@ -5,7 +5,7 @@ object Test extends App {
val s = "hello world"
val m = cm.reflect(s)
- val sc = m.reflectClass.symbol
+ val sc = m.symbol
val st = sc.asType
val meth = (st member newTermName("indexOf")).asTermSymbol
val IntType = definitions.IntClass.asType
diff --git a/test/files/run/reflection-constructormirror-inner-badpath.check b/test/files/run/reflection-constructormirror-inner-badpath.check
new file mode 100644
index 0000000000..28b936eca1
--- /dev/null
+++ b/test/files/run/reflection-constructormirror-inner-badpath.check
@@ -0,0 +1,2 @@
+this is an inner class, use reflectClass on an InstanceMirror to obtain its ClassMirror
+()
diff --git a/test/files/run/reflection-constructormirror-inner-badpath.scala b/test/files/run/reflection-constructormirror-inner-badpath.scala
new file mode 100644
index 0000000000..a42bedea83
--- /dev/null
+++ b/test/files/run/reflection-constructormirror-inner-badpath.scala
@@ -0,0 +1,32 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.ClassTag
+
+class Foo{
+ case class R(
+ sales : Int,
+ name : String
+ )
+
+ def foo = {
+ val expectedType = implicitly[TypeTag[R]]
+ val classTag = implicitly[ClassTag[R]]
+ val cl = classTag.runtimeClass.getClassLoader
+ val cm = runtimeMirror(cl)
+ val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethodSymbol
+ val sig = constructor.typeSignature
+ val sym = cm.classSymbol( classTag.runtimeClass )
+ try {
+ val cls = cm.reflectClass( sym )
+ cls.reflectConstructor( constructor )( 5,"test" ).asInstanceOf[R]
+ println("this indicates a failure")
+ } catch {
+ case ex: Throwable =>
+ println(ex.getMessage)
+ }
+ }
+
+}
+object Test extends App{
+ val foo = new Foo
+ println( foo.foo )
+} \ No newline at end of file
diff --git a/test/files/run/reflection-constructormirror-inner-good.check b/test/files/run/reflection-constructormirror-inner-good.check
new file mode 100644
index 0000000000..811ecb2e3f
--- /dev/null
+++ b/test/files/run/reflection-constructormirror-inner-good.check
@@ -0,0 +1 @@
+R(5,test)
diff --git a/test/files/run/reflection-constructormirror-inner-good.scala b/test/files/run/reflection-constructormirror-inner-good.scala
new file mode 100644
index 0000000000..c09f464b24
--- /dev/null
+++ b/test/files/run/reflection-constructormirror-inner-good.scala
@@ -0,0 +1,26 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.ClassTag
+
+class Foo{
+ case class R(
+ sales : Int,
+ name : String
+ )
+
+ def foo = {
+ val expectedType = implicitly[TypeTag[R]]
+ val classTag = implicitly[ClassTag[R]]
+ val cl = classTag.runtimeClass.getClassLoader
+ val cm = runtimeMirror(cl)
+ val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethodSymbol
+ val sig = constructor.typeSignature
+ val sym = cm.classSymbol( classTag.runtimeClass )
+ val cls = cm.reflect( this ).reflectClass( sym )
+ cls.reflectConstructor( constructor )( 5,"test" ).asInstanceOf[R]
+ }
+
+}
+object Test extends App{
+ val foo = new Foo
+ println( foo.foo )
+} \ No newline at end of file
diff --git a/test/files/run/reflection-constructormirror-nested-badpath.check b/test/files/run/reflection-constructormirror-nested-badpath.check
new file mode 100644
index 0000000000..9ceb603dc2
--- /dev/null
+++ b/test/files/run/reflection-constructormirror-nested-badpath.check
@@ -0,0 +1,2 @@
+this is a static class, use reflectClass on a RuntimeMirror to obtain its ClassMirror
+()
diff --git a/test/files/run/reflection-constructormirror-nested-badpath.scala b/test/files/run/reflection-constructormirror-nested-badpath.scala
new file mode 100644
index 0000000000..ece0044c61
--- /dev/null
+++ b/test/files/run/reflection-constructormirror-nested-badpath.scala
@@ -0,0 +1,32 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.ClassTag
+
+class Foo{
+ import Test._
+ def foo = {
+ val expectedType = implicitly[TypeTag[R]]
+ val classTag = implicitly[ClassTag[R]]
+ val cl = classTag.runtimeClass.getClassLoader
+ val cm = runtimeMirror(cl)
+ val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethodSymbol
+ val sig = constructor.typeSignature
+ val sym = cm.classSymbol( classTag.runtimeClass )
+ try {
+ val cls = cm.reflect( this ).reflectClass( sym )
+ cls.reflectConstructor( constructor )( 5,"test" ).asInstanceOf[R]
+ println("this indicates a failure")
+ } catch {
+ case ex: Throwable =>
+ println(ex.getMessage)
+ }
+ }
+
+}
+object Test extends App{
+ case class R(
+ sales : Int,
+ name : String
+ )
+ val foo = new Foo
+ println( foo.foo )
+} \ No newline at end of file
diff --git a/test/files/run/reflection-constructormirror-nested-good.check b/test/files/run/reflection-constructormirror-nested-good.check
new file mode 100644
index 0000000000..811ecb2e3f
--- /dev/null
+++ b/test/files/run/reflection-constructormirror-nested-good.check
@@ -0,0 +1 @@
+R(5,test)
diff --git a/test/files/run/reflection-constructormirror-nested-good.scala b/test/files/run/reflection-constructormirror-nested-good.scala
new file mode 100644
index 0000000000..432e9d3707
--- /dev/null
+++ b/test/files/run/reflection-constructormirror-nested-good.scala
@@ -0,0 +1,26 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.ClassTag
+
+class Foo{
+ import Test._
+ def foo = {
+ val expectedType = implicitly[TypeTag[R]]
+ val classTag = implicitly[ClassTag[R]]
+ val cl = classTag.runtimeClass.getClassLoader
+ val cm = runtimeMirror(cl)
+ val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethodSymbol
+ val sig = constructor.typeSignature
+ val sym = cm.classSymbol( classTag.runtimeClass )
+ val cls = cm.reflectClass( sym )
+ cls.reflectConstructor( constructor )( 5,"test" ).asInstanceOf[R]
+ }
+}
+
+object Test extends App{
+ case class R(
+ sales : Int,
+ name : String
+ )
+ val foo = new Foo
+ println( foo.foo )
+} \ No newline at end of file
diff --git a/test/files/run/reflection-constructormirror-toplevel-badpath.check b/test/files/run/reflection-constructormirror-toplevel-badpath.check
new file mode 100644
index 0000000000..9ceb603dc2
--- /dev/null
+++ b/test/files/run/reflection-constructormirror-toplevel-badpath.check
@@ -0,0 +1,2 @@
+this is a static class, use reflectClass on a RuntimeMirror to obtain its ClassMirror
+()
diff --git a/test/files/run/reflection-constructormirror-toplevel-badpath.scala b/test/files/run/reflection-constructormirror-toplevel-badpath.scala
new file mode 100644
index 0000000000..7a7adbd603
--- /dev/null
+++ b/test/files/run/reflection-constructormirror-toplevel-badpath.scala
@@ -0,0 +1,33 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.ClassTag
+
+case class R(
+ sales : Int,
+ name : String
+)
+
+class Foo{
+ import Test._
+ def foo = {
+ val expectedType = implicitly[TypeTag[R]]
+ val classTag = implicitly[ClassTag[R]]
+ val cl = classTag.runtimeClass.getClassLoader
+ val cm = runtimeMirror(cl)
+ val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethodSymbol
+ val sig = constructor.typeSignature
+ val sym = cm.classSymbol( classTag.runtimeClass )
+ try {
+ val cls = cm.reflect( this ).reflectClass( sym )
+ cls.reflectConstructor( constructor )( 5,"test" ).asInstanceOf[R]
+ println("this indicates a failure")
+ } catch {
+ case ex: Throwable =>
+ println(ex.getMessage)
+ }
+ }
+}
+
+object Test extends App{
+ val foo = new Foo
+ println( foo.foo )
+} \ No newline at end of file
diff --git a/test/files/run/reflection-constructormirror-toplevel-good.check b/test/files/run/reflection-constructormirror-toplevel-good.check
new file mode 100644
index 0000000000..811ecb2e3f
--- /dev/null
+++ b/test/files/run/reflection-constructormirror-toplevel-good.check
@@ -0,0 +1 @@
+R(5,test)
diff --git a/test/files/run/reflection-constructormirror-toplevel-good.scala b/test/files/run/reflection-constructormirror-toplevel-good.scala
new file mode 100644
index 0000000000..96713a11cb
--- /dev/null
+++ b/test/files/run/reflection-constructormirror-toplevel-good.scala
@@ -0,0 +1,27 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.ClassTag
+
+case class R(
+ sales : Int,
+ name : String
+)
+
+class Foo{
+ import Test._
+ def foo = {
+ val expectedType = implicitly[TypeTag[R]]
+ val classTag = implicitly[ClassTag[R]]
+ val cl = classTag.runtimeClass.getClassLoader
+ val cm = runtimeMirror(cl)
+ val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethodSymbol
+ val sig = constructor.typeSignature
+ val sym = cm.classSymbol( classTag.runtimeClass )
+ val cls = cm.reflectClass( sym )
+ cls.reflectConstructor( constructor )( 5,"test" ).asInstanceOf[R]
+ }
+}
+
+object Test extends App{
+ val foo = new Foo
+ println( foo.foo )
+} \ No newline at end of file
diff --git a/test/files/run/reflection-fieldmirror-ctorparam.scala b/test/files/run/reflection-fieldmirror-ctorparam.scala
index 286399072e..fa9dd81d7f 100644
--- a/test/files/run/reflection-fieldmirror-ctorparam.scala
+++ b/test/files/run/reflection-fieldmirror-ctorparam.scala
@@ -9,7 +9,7 @@ object Test extends App {
val a = new A(42)
val im: InstanceMirror = cm.reflect(a)
- val cs = im.reflectClass.symbol
+ val cs = im.symbol
val f = cs.typeSignature.declaration(newTermName("x")).asTermSymbol
try {
val fm: FieldMirror = im.reflectField(f)
diff --git a/test/files/run/reflection-fieldmirror-getsetval.scala b/test/files/run/reflection-fieldmirror-getsetval.scala
index aeae66b422..af9a6e4c56 100644
--- a/test/files/run/reflection-fieldmirror-getsetval.scala
+++ b/test/files/run/reflection-fieldmirror-getsetval.scala
@@ -9,7 +9,7 @@ object Test extends App {
val a = new A
val im: InstanceMirror = cm.reflect(a)
- val cs = im.reflectClass.symbol
+ val cs = im.symbol
val f = cs.typeSignature.declaration(newTermName("x" + nme.LOCAL_SUFFIX_STRING)).asTermSymbol
val fm: FieldMirror = im.reflectField(f)
try {
diff --git a/test/files/run/reflection-fieldmirror-getsetvar.scala b/test/files/run/reflection-fieldmirror-getsetvar.scala
index 99ecc8996c..d9fbdaade0 100644
--- a/test/files/run/reflection-fieldmirror-getsetvar.scala
+++ b/test/files/run/reflection-fieldmirror-getsetvar.scala
@@ -9,7 +9,7 @@ object Test extends App {
val a = new A
val im: InstanceMirror = cm.reflect(a)
- val cs = im.reflectClass.symbol
+ val cs = im.symbol
val f = cs.typeSignature.declaration(newTermName("x" + nme.LOCAL_SUFFIX_STRING)).asTermSymbol
val fm: FieldMirror = im.reflectField(f)
println(fm.get)
diff --git a/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala b/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala
index 9dca7b452c..d89e6a90ef 100644
--- a/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala
+++ b/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala
@@ -9,8 +9,8 @@ object Test extends App {
val a = new A
val im: InstanceMirror = cm.reflect(a)
- val cs = im.reflectClass.symbol
+ val cs = im.symbol
val f = cs.typeSignature.declaration(newTermName("x" + nme.LOCAL_SUFFIX_STRING)).asTermSymbol
val fm: FieldMirror = im.reflectField(f)
- println(fm.field.isVariable)
+ println(fm.symbol.isVariable)
}
diff --git a/test/files/run/reflection-fieldmirror-privatethis.scala b/test/files/run/reflection-fieldmirror-privatethis.scala
index 844822d449..0c415e09e4 100644
--- a/test/files/run/reflection-fieldmirror-privatethis.scala
+++ b/test/files/run/reflection-fieldmirror-privatethis.scala
@@ -9,10 +9,10 @@ object Test extends App {
val a = new A
val im: InstanceMirror = cm.reflect(a)
- val cs = im.reflectClass.symbol
+ val cs = im.symbol
val f = cs.typeSignature.declaration(newTermName("x")).asTermSymbol
val fm: FieldMirror = im.reflectField(f)
- println(fm.field.isVariable)
+ println(fm.symbol.isVariable)
println(fm.get)
fm.set(2)
println(fm.get)
diff --git a/test/files/run/reflection-fieldmirror-sanitycheck.scala b/test/files/run/reflection-fieldmirror-sanitycheck.scala
index abd4cf57c5..6a992dd282 100644
--- a/test/files/run/reflection-fieldmirror-sanitycheck.scala
+++ b/test/files/run/reflection-fieldmirror-sanitycheck.scala
@@ -9,7 +9,7 @@ object Test extends App {
val a = new A
val im: InstanceMirror = cm.reflect(a)
- val cs = im.reflectClass.symbol
+ val cs = im.symbol
//val f = cs.typeSignature.declaration(newTermName("x" + nme.LOCAL_SUFFIX_STRING)).asTermSymbol
val f = cs.typeSignature.declaration(newTermName("x")).asTermSymbol
try {
diff --git a/test/files/run/reflection-implClass.scala b/test/files/run/reflection-implClass.scala
index 91288562f4..b3c0081ccf 100644
--- a/test/files/run/reflection-implClass.scala
+++ b/test/files/run/reflection-implClass.scala
@@ -10,8 +10,8 @@ object Test extends App with Outer {
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
- assert(cm.reflectClass(classTag[Foo].runtimeClass).symbol.typeSignature.declaration(newTermName("bar")).typeSignature ==
- cm.reflectClass(classTag[Bar].runtimeClass).symbol.typeSignature.declaration(newTermName("foo")).typeSignature)
+ assert(cm.classSymbol(classTag[Foo].runtimeClass).typeSignature.declaration(newTermName("bar")).typeSignature ==
+ cm.classSymbol(classTag[Bar].runtimeClass).typeSignature.declaration(newTermName("foo")).typeSignature)
val s1 = implClass(classTag[Foo].runtimeClass)
assert(s1 != NoSymbol)
@@ -25,7 +25,7 @@ object Test extends App with Outer {
assert(s2.companionSymbol.typeSignature.declaration(newTermName("foo")) != NoSymbol)
def implClass(clazz: Class[_]) = {
val implClass = Class.forName(clazz.getName + "$class")
- cm.reflectClass(implClass).symbol
+ cm.classSymbol(implClass)
}
}
diff --git a/test/files/run/reflection-modulemirror-inner-badpath.check b/test/files/run/reflection-modulemirror-inner-badpath.check
new file mode 100644
index 0000000000..d3fe43336e
--- /dev/null
+++ b/test/files/run/reflection-modulemirror-inner-badpath.check
@@ -0,0 +1,2 @@
+this is an inner module, use reflectModule on an InstanceMirror to obtain its ModuleMirror
+()
diff --git a/test/files/run/reflection-modulemirror-inner-badpath.scala b/test/files/run/reflection-modulemirror-inner-badpath.scala
new file mode 100644
index 0000000000..de200c548b
--- /dev/null
+++ b/test/files/run/reflection-modulemirror-inner-badpath.scala
@@ -0,0 +1,24 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.reflect.ClassTag
+
+class Foo{
+ object R { override def toString = "R" }
+ def foo = {
+ val classTag = implicitly[ClassTag[R.type]]
+ val sym = cm.moduleSymbol(classTag.runtimeClass)
+ try {
+ val cls = cm.reflectModule(sym)
+ cls.instance
+ println("this indicates a failure")
+ } catch {
+ case ex: Throwable =>
+ println(ex.getMessage)
+ }
+ }
+}
+
+object Test extends App{
+ val foo = new Foo
+ println(foo.foo)
+} \ No newline at end of file
diff --git a/test/files/run/reflection-modulemirror-inner-good.check b/test/files/run/reflection-modulemirror-inner-good.check
new file mode 100644
index 0000000000..0bf38a73d1
--- /dev/null
+++ b/test/files/run/reflection-modulemirror-inner-good.check
@@ -0,0 +1,2 @@
+inner and nested modules are not supported yet
+()
diff --git a/test/files/run/reflection-modulemirror-inner-good.scala b/test/files/run/reflection-modulemirror-inner-good.scala
new file mode 100644
index 0000000000..b5540dbe1c
--- /dev/null
+++ b/test/files/run/reflection-modulemirror-inner-good.scala
@@ -0,0 +1,23 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.reflect.ClassTag
+
+class Foo{
+ object R { override def toString = "R" }
+ def foo = {
+ val classTag = implicitly[ClassTag[R.type]]
+ val sym = cm.moduleSymbol(classTag.runtimeClass)
+ val cls = cm.reflect(this).reflectModule(sym)
+ try {
+ cls.instance
+ } catch {
+ case ex: Throwable =>
+ println(ex.getMessage)
+ }
+ }
+}
+
+object Test extends App{
+ val foo = new Foo
+ println(foo.foo)
+} \ No newline at end of file
diff --git a/test/files/run/reflection-modulemirror-nested-badpath.check b/test/files/run/reflection-modulemirror-nested-badpath.check
new file mode 100644
index 0000000000..16a5b10390
--- /dev/null
+++ b/test/files/run/reflection-modulemirror-nested-badpath.check
@@ -0,0 +1,2 @@
+this is a static module, use reflectModule on a RuntimeMirror to obtain its ModuleMirror
+()
diff --git a/test/files/run/reflection-modulemirror-nested-badpath.scala b/test/files/run/reflection-modulemirror-nested-badpath.scala
new file mode 100644
index 0000000000..43cae00f9c
--- /dev/null
+++ b/test/files/run/reflection-modulemirror-nested-badpath.scala
@@ -0,0 +1,26 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.reflect.ClassTag
+
+class Foo{
+ import Test._
+ def foo = {
+ val classTag = implicitly[ClassTag[R.type]]
+ val sym = cm.moduleSymbol(classTag.runtimeClass)
+ try {
+ val cls = cm.reflect(this).reflectModule(sym)
+ cls.instance
+ println("this indicates a failure")
+ } catch {
+ case ex: Throwable =>
+ println(ex.getMessage)
+ }
+ }
+
+}
+
+object Test extends App{
+ object R { override def toString = "R" }
+ val foo = new Foo
+ println(foo.foo)
+}
diff --git a/test/files/run/reflection-modulemirror-nested-good.check b/test/files/run/reflection-modulemirror-nested-good.check
new file mode 100644
index 0000000000..0bf38a73d1
--- /dev/null
+++ b/test/files/run/reflection-modulemirror-nested-good.check
@@ -0,0 +1,2 @@
+inner and nested modules are not supported yet
+()
diff --git a/test/files/run/reflection-modulemirror-nested-good.scala b/test/files/run/reflection-modulemirror-nested-good.scala
new file mode 100644
index 0000000000..8390bbaac7
--- /dev/null
+++ b/test/files/run/reflection-modulemirror-nested-good.scala
@@ -0,0 +1,24 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.reflect.ClassTag
+
+class Foo{
+ import Test._
+ def foo = {
+ val classTag = implicitly[ClassTag[R.type]]
+ val sym = cm.moduleSymbol(classTag.runtimeClass)
+ val cls = cm.reflectModule(sym)
+ try {
+ cls.instance
+ } catch {
+ case ex: Throwable =>
+ println(ex.getMessage)
+ }
+ }
+}
+
+object Test extends App{
+ object R { override def toString = "R" }
+ val foo = new Foo
+ println(foo.foo)
+} \ No newline at end of file
diff --git a/test/files/run/reflection-modulemirror-toplevel-badpath.check b/test/files/run/reflection-modulemirror-toplevel-badpath.check
new file mode 100644
index 0000000000..16a5b10390
--- /dev/null
+++ b/test/files/run/reflection-modulemirror-toplevel-badpath.check
@@ -0,0 +1,2 @@
+this is a static module, use reflectModule on a RuntimeMirror to obtain its ModuleMirror
+()
diff --git a/test/files/run/reflection-modulemirror-toplevel-badpath.scala b/test/files/run/reflection-modulemirror-toplevel-badpath.scala
new file mode 100644
index 0000000000..8b2994cabb
--- /dev/null
+++ b/test/files/run/reflection-modulemirror-toplevel-badpath.scala
@@ -0,0 +1,26 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.reflect.ClassTag
+
+object R { override def toString = "R" }
+
+class Foo{
+ import Test._
+ def foo = {
+ val classTag = implicitly[ClassTag[R.type]]
+ val sym = cm.moduleSymbol(classTag.runtimeClass)
+ try {
+ val cls = cm.reflect(this).reflectModule(sym)
+ cls.instance
+ println("this indicates a failure")
+ } catch {
+ case ex: Throwable =>
+ println(ex.getMessage)
+ }
+ }
+}
+
+object Test extends App{
+ val foo = new Foo
+ println(foo.foo)
+} \ No newline at end of file
diff --git a/test/files/run/reflection-modulemirror-toplevel-good.check b/test/files/run/reflection-modulemirror-toplevel-good.check
new file mode 100644
index 0000000000..ac044e5e46
--- /dev/null
+++ b/test/files/run/reflection-modulemirror-toplevel-good.check
@@ -0,0 +1 @@
+R \ No newline at end of file
diff --git a/test/files/run/reflection-modulemirror-toplevel-good.scala b/test/files/run/reflection-modulemirror-toplevel-good.scala
new file mode 100644
index 0000000000..0663136a22
--- /dev/null
+++ b/test/files/run/reflection-modulemirror-toplevel-good.scala
@@ -0,0 +1,20 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.reflect.ClassTag
+
+object R { override def toString = "R" }
+
+class Foo{
+ import Test._
+ def foo = {
+ val classTag = implicitly[ClassTag[R.type]]
+ val sym = cm.moduleSymbol(classTag.runtimeClass)
+ val cls = cm.reflectModule(sym)
+ cls.instance
+ }
+}
+
+object Test extends App{
+ val foo = new Foo
+ println(foo.foo)
+} \ No newline at end of file
diff --git a/test/files/run/reflection-simple.scala b/test/files/run/reflection-simple.scala
index 152d8c4505..ec34b71cec 100644
--- a/test/files/run/reflection-simple.scala
+++ b/test/files/run/reflection-simple.scala
@@ -6,7 +6,7 @@ object Test {
System.out.println("Running")
case class Foo(a: Int, b: Int, c: Int)
import scala.reflect.runtime.{currentMirror => cm}
- val props = cm.reflectClass(classOf[Foo]).symbol.typeSignature.members.filter(_.isTerm).map(_.toString)
+ val props = cm.classSymbol(classOf[Foo]).typeSignature.members.filter(_.isTerm).map(_.toString)
props.toList.sorted foreach System.out.println
}
}
diff --git a/test/files/run/t5256a.scala b/test/files/run/t5256a.scala
index e3d22f8a93..84ef97b0d2 100644
--- a/test/files/run/t5256a.scala
+++ b/test/files/run/t5256a.scala
@@ -4,7 +4,7 @@ import scala.reflect.runtime.{currentMirror => cm}
class A { def foo = ??? }
object Test extends App {
- val c = cm.reflectClass(classOf[A]).symbol
+ val c = cm.classSymbol(classOf[A])
println(c)
println(c.fullName)
println(c.typeSignature)
diff --git a/test/files/run/t5256b.scala b/test/files/run/t5256b.scala
index fedec6323d..0ffab8a668 100644
--- a/test/files/run/t5256b.scala
+++ b/test/files/run/t5256b.scala
@@ -3,7 +3,7 @@ import scala.reflect.runtime.{currentMirror => cm}
object Test extends App {
class A { def foo = ??? }
- val c = cm.reflectClass(classOf[A]).symbol
+ val c = cm.classSymbol(classOf[A])
println(c)
println(c.fullName)
println(c.typeSignature)
diff --git a/test/files/run/t5256c.scala b/test/files/run/t5256c.scala
index a8a3323443..d56215f6eb 100644
--- a/test/files/run/t5256c.scala
+++ b/test/files/run/t5256c.scala
@@ -4,7 +4,7 @@ import scala.reflect.runtime.{currentMirror => cm}
object Test extends App {
{
class A { def foo = ??? }
- val c = cm.reflectClass(classOf[A]).symbol
+ val c = cm.classSymbol(classOf[A])
println(c)
println(c.fullName)
println(c.typeSignature)
diff --git a/test/files/run/t5256d.check b/test/files/run/t5256d.check
index e466e1e2e8..dd32c05a93 100644
--- a/test/files/run/t5256d.check
+++ b/test/files/run/t5256d.check
@@ -12,7 +12,7 @@ import scala.reflect.runtime.{currentMirror=>cm}
scala> class A { def foo = ??? }
defined class A
-scala> val c = cm.reflectClass(classOf[A]).symbol
+scala> val c = cm.classSymbol(classOf[A])
c: reflect.runtime.universe.ClassSymbol = class A
scala> println(c)
diff --git a/test/files/run/t5256d.scala b/test/files/run/t5256d.scala
index 574013f444..24ac1eb316 100644
--- a/test/files/run/t5256d.scala
+++ b/test/files/run/t5256d.scala
@@ -5,7 +5,7 @@ object Test extends ReplTest {
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
class A { def foo = ??? }
-val c = cm.reflectClass(classOf[A]).symbol
+val c = cm.classSymbol(classOf[A])
println(c)
println(c.fullName)
println(c.typeSignature)
diff --git a/test/files/run/t5256e.check b/test/files/run/t5256e.check
index 20ea35c74d..6c6de90acc 100644
--- a/test/files/run/t5256e.check
+++ b/test/files/run/t5256e.check
@@ -1,6 +1,6 @@
-class A
-Test.C.A
+class A
+Test.C.A
Object {
def <init>: <?>
def foo: <?>
-}
+}
diff --git a/test/files/run/t5256e.scala b/test/files/run/t5256e.scala
index 32031f919a..f83546f2c0 100644
--- a/test/files/run/t5256e.scala
+++ b/test/files/run/t5256e.scala
@@ -3,7 +3,7 @@ import scala.reflect.runtime.{currentMirror => cm}
object Test extends App {
class C { class A { def foo = ??? } }
- val c = cm.reflectClass(classOf[C#A]).symbol
+ val c = cm.classSymbol(classOf[C#A])
println(c)
println(c.fullName)
println(c.typeSignature)
diff --git a/test/files/run/t5256f.check b/test/files/run/t5256f.check
index 7a58aa003d..c840793fd5 100644
--- a/test/files/run/t5256f.check
+++ b/test/files/run/t5256f.check
@@ -1,12 +1,12 @@
-class A1
-Test.A1
+class A1
+Test.A1
Object {
def <init>: <?>
def foo: <?>
-}
-class A2
-Test.A2
+}
+class A2
+Test.A2
Object {
def <init>: <?>
def foo: <?>
-}
+}
diff --git a/test/files/run/t5256f.scala b/test/files/run/t5256f.scala
index 072f927abc..80c7ad8018 100644
--- a/test/files/run/t5256f.scala
+++ b/test/files/run/t5256f.scala
@@ -4,7 +4,7 @@ import scala.reflect.runtime.{currentMirror => cm}
object Test extends App {
class A1 { def foo = ??? }
- val c1 = cm.reflectClass(classOf[A1]).symbol
+ val c1 = cm.classSymbol(classOf[A1])
println(c1)
println(c1.fullName)
println(c1.typeSignature)
@@ -15,7 +15,7 @@ object Test extends App {
class Test {
class A2 { def foo = ??? }
- val c2 = cm.reflectClass(classOf[A2]).symbol
+ val c2 = cm.classSymbol(classOf[A2])
println(c2)
println(c2.fullName)
println(c2.typeSignature)
diff --git a/test/files/run/t5256g.scala b/test/files/run/t5256g.scala
index a4d81a28dc..358c18601a 100644
--- a/test/files/run/t5256g.scala
+++ b/test/files/run/t5256g.scala
@@ -6,7 +6,7 @@ trait B
object Test extends App {
val mutant = new A with B
- val c = cm.reflectClass(mutant.getClass).symbol
+ val c = cm.classSymbol(mutant.getClass)
println(c)
println(c.fullName)
println(c.typeSignature)
diff --git a/test/files/run/t5256h.scala b/test/files/run/t5256h.scala
index 723d606a1e..fd4ffd9b12 100644
--- a/test/files/run/t5256h.scala
+++ b/test/files/run/t5256h.scala
@@ -3,7 +3,7 @@ import scala.reflect.runtime.{currentMirror => cm}
object Test extends App {
val mutant = new { val x = 2 }
- val c = cm.reflectClass(mutant.getClass).symbol
+ val c = cm.classSymbol(mutant.getClass)
println(c)
println(c.fullName)
println(c.typeSignature)
diff --git a/test/files/run/t5423.scala b/test/files/run/t5423.scala
index 9c73ed0bef..9b8ba090fa 100644
--- a/test/files/run/t5423.scala
+++ b/test/files/run/t5423.scala
@@ -6,6 +6,6 @@ final class table extends annotation.StaticAnnotation
@table class A
object Test extends App {
- val s = cm.reflectClass(classOf[A]).symbol
+ val s = cm.classSymbol(classOf[A])
println(s.getAnnotations)
} \ No newline at end of file