summaryrefslogtreecommitdiff
path: root/test/files/run/t9102.scala
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2015-03-11 10:04:27 -0700
committerSom Snytt <som.snytt@gmail.com>2015-03-11 10:04:27 -0700
commit0a8dfd927e6362656b541360cf6920c2c7c69b08 (patch)
treecd95feec10581c3f8de178f8e2e6f875e5b860b1 /test/files/run/t9102.scala
parentd7b99c3c33de8d759353c7ffd1d89e2cb38d793b (diff)
downloadscala-0a8dfd927e6362656b541360cf6920c2c7c69b08.tar.gz
scala-0a8dfd927e6362656b541360cf6920c2c7c69b08.tar.bz2
scala-0a8dfd927e6362656b541360cf6920c2c7c69b08.zip
SI-9102: Improve test
Cover the second use case reported on the ML (ctors). Improve formatting per the review. And it really does look a lot better.
Diffstat (limited to 'test/files/run/t9102.scala')
-rw-r--r--test/files/run/t9102.scala8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/files/run/t9102.scala b/test/files/run/t9102.scala
index 37ae53b2ab..c46cf0e4b4 100644
--- a/test/files/run/t9102.scala
+++ b/test/files/run/t9102.scala
@@ -7,6 +7,8 @@ object Test extends App {
class V(val v: Int) extends AnyVal { def doubled = 2 * v }
class D { def f(i: Int, j: V) = i + j.doubled }
+ class E(i: Int, j: V)
+
locally {
val ms = typeOf[C].member(TermName("f")).asMethod
val im = currentMirror reflect (new C)
@@ -19,6 +21,12 @@ object Test extends App {
val mm = im reflectMethod ms
assert(mm(2, new V(3)) == 8)
}
+ locally {
+ val ms = typeOf[E].typeSymbol.asClass.primaryConstructor
+ val cm = currentMirror reflectClass typeOf[E].typeSymbol.asClass
+ val mm = cm reflectConstructor ms.asMethod
+ assert(mm(42, new V(7)).isInstanceOf[E])
+ }
}
/* Session tests without special init code should reside in simple script files.