diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2014-01-29 22:47:37 +0300 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2014-02-14 14:19:45 +0100 |
commit | 47dba05c5475b95c8ed9a43d4db29458f16a680b (patch) | |
tree | 20d41734112929a19addd7fe6a669e9e001c6231 | |
parent | b5c4666be9b53a5d8e8d656a3aa597b3897a37c8 (diff) | |
download | scala-47dba05c5475b95c8ed9a43d4db29458f16a680b.tar.gz scala-47dba05c5475b95c8ed9a43d4db29458f16a680b.tar.bz2 scala-47dba05c5475b95c8ed9a43d4db29458f16a680b.zip |
SI-8086 addresses problem with calling Symbol.getter
Due to an unintended clash between `def getter: Symbol` (public reflection)
and `def getter(base: Symbol): Symbol` (internal reflection), the former
is uncallable from compiler internals and/or REPL’s power mode.
While both methods are guarded by compatibility constraints, we can’t
solve this problem radically and will have to live with it for some time
Thankfully, a replacement for `sym.getter` is quite approachable, namely:
`sym.getter(sym.owner)`.
In the meanwhile, I’ve deprecated the internal `getter` method by
renaming it to `getterIn`, also touching a nearby `superSymbol`. In the next
release we’ll be able to fix the name clash for good.
-rw-r--r-- | src/reflect/scala/reflect/internal/Symbols.scala | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala index 74528267d6..86d3975a19 100644 --- a/src/reflect/scala/reflect/internal/Symbols.scala +++ b/src/reflect/scala/reflect/internal/Symbols.scala @@ -2280,7 +2280,10 @@ trait Symbols extends api.Symbols { self: SymbolTable => * seen from class `base`. This symbol is always concrete. * pre: `this.owner` is in the base class sequence of `base`. */ - final def superSymbol(base: Symbol): Symbol = { + @deprecated("Use `superSymbolIn` instead", "2.11.0") + final def superSymbol(base: Symbol): Symbol = superSymbolIn(base) + + final def superSymbolIn(base: Symbol): Symbol = { var bcs = base.info.baseClasses dropWhile (owner != _) drop 1 var sym: Symbol = NoSymbol while (!bcs.isEmpty && sym == NoSymbol) { @@ -2294,7 +2297,10 @@ trait Symbols extends api.Symbols { self: SymbolTable => /** The getter of this value or setter definition in class `base`, or NoSymbol if * none exists. */ - final def getter(base: Symbol): Symbol = + @deprecated("Use `getterIn` instead", "2.11.0") + final def getter(base: Symbol): Symbol = getterIn(base) + + final def getterIn(base: Symbol): Symbol = base.info decl getterName filter (_.hasAccessorFlag) def getterName: TermName = name.getterName |