diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2014-01-20 10:30:48 +0300 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2014-01-20 10:30:57 +0300 |
commit | f2afbb46bb6d915212bbce7e958bfc6a1d8b2d0a (patch) | |
tree | 9369c86d03037fd68dc5986b156d16744b9ebe42 | |
parent | dd875814166f60dd136397ec12ba92d223cb10d0 (diff) | |
download | scala-f2afbb46bb6d915212bbce7e958bfc6a1d8b2d0a.tar.gz scala-f2afbb46bb6d915212bbce7e958bfc6a1d8b2d0a.tar.bz2 scala-f2afbb46bb6d915212bbce7e958bfc6a1d8b2d0a.zip |
a note about Symbol.typeSignature
No changes to behavior, just documenting internal workings of reflection
a bit more thoroughly, one step at a time.
-rw-r--r-- | src/reflect/scala/reflect/internal/Symbols.scala | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala index e15b33e5d7..28d980bcfd 100644 --- a/src/reflect/scala/reflect/internal/Symbols.scala +++ b/src/reflect/scala/reflect/internal/Symbols.scala @@ -118,6 +118,13 @@ trait Symbols extends api.Symbols { self: SymbolTable => def baseClasses = info.baseClasses def module = sourceModule def thisPrefix: Type = thisType + + // automatic full initialization on access to info from reflection API is a double-edged sword + // on the one hand, it's convenient so that the users don't have to deal with initialization themselves before printing out stuff + // (e.g. printing out a method's signature without fully initializing it would result in <_>'s for parameters + // on the other hand, this strategy can potentially cause unexpected effects due to being inconsistent with compiler's behavior + // so far I think user convenience outweighs the scariness, but we need to keep the tradeoff in mind + // NOTE: if you end up removing the call to fullyInitializeSymbol, consider that it would affect both runtime reflection and macros def typeSignature: Type = { fullyInitializeSymbol(this); info } def typeSignatureIn(site: Type): Type = { fullyInitializeSymbol(this); site memberInfo this } |