diff options
author | Paul Phillips <paulp@improving.org> | 2012-09-17 07:19:16 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-09-17 07:19:16 -0700 |
commit | cc94a21b694e132c945eafa9022b3a6e19e804fb (patch) | |
tree | b953674685a0f4ef4d0bb02cad911ab6a083e7ab | |
parent | 61c83d2903f1c68c943ea646e75b4ca32d75f991 (diff) | |
parent | b41f079b42850a287b0088b74d5aa2bde7b2eb8a (diff) | |
download | scala-cc94a21b694e132c945eafa9022b3a6e19e804fb.tar.gz scala-cc94a21b694e132c945eafa9022b3a6e19e804fb.tar.bz2 scala-cc94a21b694e132c945eafa9022b3a6e19e804fb.zip |
Merge pull request #1320 from scalamacros/topic/is-implicit
moves isImplicit from TermSymbol to Symbol
-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 |