diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-07-30 22:35:36 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-08-02 15:36:57 +0200 |
commit | 7112c66d6951ac83ae3591426291ec2797824258 (patch) | |
tree | f8da05ea01df38b658c4b0cc75e96900c6dd4f32 /test | |
parent | 37d4bfe77c1d8443e522a951cd404459a409035b (diff) | |
download | scala-7112c66d6951ac83ae3591426291ec2797824258.tar.gz scala-7112c66d6951ac83ae3591426291ec2797824258.tar.bz2 scala-7112c66d6951ac83ae3591426291ec2797824258.zip |
navigation between fields and accessors
This works around SI-5736 that's been deemed too risky to be fixed in 2.10.0.
A reflection newbie will be unlikely to acquire a field symbol from its name,
but the `accessed` method provides an easy way to navigate to it from a getter.
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/reflection-fieldsymbol-navigation.check | 6 | ||||
-rw-r--r-- | test/files/run/reflection-fieldsymbol-navigation.scala | 15 |
2 files changed, 21 insertions, 0 deletions
diff --git a/test/files/run/reflection-fieldsymbol-navigation.check b/test/files/run/reflection-fieldsymbol-navigation.check new file mode 100644 index 0000000000..79f0928ea5 --- /dev/null +++ b/test/files/run/reflection-fieldsymbol-navigation.check @@ -0,0 +1,6 @@ +method x
+false
+variable x
+true
+method x
+method x_=
diff --git a/test/files/run/reflection-fieldsymbol-navigation.scala b/test/files/run/reflection-fieldsymbol-navigation.scala new file mode 100644 index 0000000000..da4612a564 --- /dev/null +++ b/test/files/run/reflection-fieldsymbol-navigation.scala @@ -0,0 +1,15 @@ +import scala.reflect.runtime.universe._ + +class C { + var x = 2 +} + +object Test extends App { + val x = typeOf[C].member(newTermName("x")).asTerm + println(x) + println(x.isVariable) + println(x.accessed) + println(x.accessed.asTerm.isVariable) + println(x.getter) + println(x.setter) +}
\ No newline at end of file |