diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-09-16 23:07:54 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-09-16 23:07:54 +0200 |
commit | b41f079b42850a287b0088b74d5aa2bde7b2eb8a (patch) | |
tree | 2151039cb40a0024fdd9fc2be08b9d2391222439 | |
parent | 997829f06cef218db227f90f2e3f781771a92bfe (diff) | |
download | scala-b41f079b42850a287b0088b74d5aa2bde7b2eb8a.tar.gz scala-b41f079b42850a287b0088b74d5aa2bde7b2eb8a.tar.bz2 scala-b41f079b42850a287b0088b74d5aa2bde7b2eb8a.zip |
moves isImplicit from TermSymbol to Symbol
Because classes can also be implicit.
-rw-r--r-- | src/reflect/scala/reflect/api/Symbols.scala | 8 | ||||
-rw-r--r-- | test/files/run/reflection-implicit.check | 2 | ||||
-rw-r--r-- | test/files/run/reflection-implicit.scala | 15 |
3 files changed, 21 insertions, 4 deletions
diff --git a/src/reflect/scala/reflect/api/Symbols.scala b/src/reflect/scala/reflect/api/Symbols.scala index cf1f574ade..0c4be4f7e1 100644 --- a/src/reflect/scala/reflect/api/Symbols.scala +++ b/src/reflect/scala/reflect/api/Symbols.scala @@ -170,6 +170,10 @@ trait Symbols extends base.Symbols { self: Universe => */ def isJava: Boolean + /** Does this symbol represent an implicit value, definition, class or parameter? + */ + def isImplicit: Boolean + /******************* helpers *******************/ /** ... @@ -222,10 +226,6 @@ trait Symbols extends base.Symbols { self: Universe => */ def isOverloaded : Boolean - /** Does this symbol represent an implicit value, definition or parameter? - */ - def isImplicit: Boolean - /** Does this symbol represent a lazy value? */ def isLazy: Boolean diff --git a/test/files/run/reflection-implicit.check b/test/files/run/reflection-implicit.check new file mode 100644 index 0000000000..bab1518c45 --- /dev/null +++ b/test/files/run/reflection-implicit.check @@ -0,0 +1,2 @@ +List(true, true, true, true)
+true
diff --git a/test/files/run/reflection-implicit.scala b/test/files/run/reflection-implicit.scala new file mode 100644 index 0000000000..637ef24e14 --- /dev/null +++ b/test/files/run/reflection-implicit.scala @@ -0,0 +1,15 @@ +import scala.reflect.runtime.universe._ + +class C { + implicit val v = new C + implicit def d(x: C)(implicit c: C): Int = ??? + implicit class X(val x: Int) +} + +object Test extends App { + val decls = typeOf[C].typeSymbol.typeSignature.declarations.sorted.toList.filter(sym => !sym.isTerm || (sym.isMethod && !sym.asMethod.isConstructor)) + println(decls map (_.isImplicit)) + val param = decls.find(_.name.toString == "d").get.asMethod.params.last.head + param.typeSignature + println(param.isImplicit) +}
\ No newline at end of file |