diff options
Diffstat (limited to 'tests/pending/run/reflection-constructormirror-toplevel-badpath.scala')
-rw-r--r-- | tests/pending/run/reflection-constructormirror-toplevel-badpath.scala | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/pending/run/reflection-constructormirror-toplevel-badpath.scala b/tests/pending/run/reflection-constructormirror-toplevel-badpath.scala new file mode 100644 index 000000000..eda4aa053 --- /dev/null +++ b/tests/pending/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( termNames.CONSTRUCTOR ).asMethod + val sig = constructor.info + 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 |