aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/SymDenotations.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-04-04 10:24:25 +0200
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2014-04-08 17:03:57 +0200
commitdcfd96328f350a6265d7aac55c411ab798e93e77 (patch)
treed07871190bb367e64235daa662d9f314696cc067 /src/dotty/tools/dotc/core/SymDenotations.scala
parentebd7df51e5b20e2c42717e216cc6be996d12c52a (diff)
downloaddotty-dcfd96328f350a6265d7aac55c411ab798e93e77.tar.gz
dotty-dcfd96328f350a6265d7aac55c411ab798e93e77.tar.bz2
dotty-dcfd96328f350a6265d7aac55c411ab798e93e77.zip
Shadowed references
In TypeAssigner#ensureAccible we sometimes pick an inherited public member as the denotation of a NamedType instead of an inaccessible private one. The problem is that both are denotations for the same type, which caused a noDoubleBindings assert failure. We now solve this problem by creating a "shadowed" named type to hold the inherited member. The shadowed named type is distinguished by its name, which reads (inherited)originalName In the future, we should make this more robust by using a general tagging scheme to create shadowed names. Another fix is about import symbols. They are now referenced with NonMemberTermRefs. With this fix, the test suite passes with no double def violations.
Diffstat (limited to 'src/dotty/tools/dotc/core/SymDenotations.scala')
-rw-r--r--src/dotty/tools/dotc/core/SymDenotations.scala6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala
index 7762f61dd..dc76999f6 100644
--- a/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -684,7 +684,8 @@ object SymDenotations {
/** The symbol, in class `inClass`, that is overridden by this denotation. */
final def overriddenSymbol(inClass: ClassSymbol)(implicit ctx: Context): Symbol =
- matchingSymbol(inClass, owner.thisType)
+ if ((this is Private) && (owner ne inClass)) NoSymbol
+ else matchingSymbol(inClass, owner.thisType)
/** All symbols overriden by this denotation. */
final def allOverriddenSymbols(implicit ctx: Context): Iterator[Symbol] =
@@ -731,6 +732,9 @@ object SymDenotations {
override def termRefWithSig(implicit ctx: Context): TermRef =
TermRef.withSig(owner.thisType, name.asTermName, signature, this)
+ def nonMemberTermRef(implicit ctx: Context): TermRef =
+ TermRef.withNonMemberSym(owner.thisType, name.asTermName, symbol.asTerm)
+
/** The variance of this type parameter or type member as an Int, with
* +1 = Covariant, -1 = Contravariant, 0 = Nonvariant, or not a type parameter
*/