diff options
Diffstat (limited to 'compiler/src/dotty/tools/dotc')
-rw-r--r-- | compiler/src/dotty/tools/dotc/core/SymDenotations.scala | 4 | ||||
-rw-r--r-- | compiler/src/dotty/tools/dotc/core/TypeErasure.scala | 4 | ||||
-rw-r--r-- | compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala | 4 |
3 files changed, 9 insertions, 3 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala index c98b444d9..326f0e39e 100644 --- a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala @@ -957,6 +957,10 @@ object SymDenotations { else companionNamed(name)(ctx.outersIterator.dropWhile(_.scope eq ctx.scope).next) + /** Is this symbol the same or a linked class of `sym`? */ + final def isLinkedWith(sym: Symbol)(implicit ctx: Context): Boolean = + (symbol eq sym) || (linkedClass eq sym) + /** If this is a class, the module class of its companion object. * If this is a module class, its companion class. * NoSymbol otherwise. diff --git a/compiler/src/dotty/tools/dotc/core/TypeErasure.scala b/compiler/src/dotty/tools/dotc/core/TypeErasure.scala index 2140405b1..10587afd5 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeErasure.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeErasure.scala @@ -215,13 +215,13 @@ object TypeErasure { } /** The erased least upper bound is computed as follows - * - if both argument are arrays of objects, an array of the lub of the element types + * - if both argument are arrays of objects, an array of the erased lub of the element types * - if both arguments are arrays of same primitives, an array of this primitive * - if one argument is array of primitives and the other is array of objects, Object * - if one argument is an array, Object * - otherwise a common superclass or trait S of the argument classes, with the * following two properties: - * S is minimal: no other common superclass or trait derives from S] + * S is minimal: no other common superclass or trait derives from S * S is last : in the linearization of the first argument type `tp1` * there are no minimal common superclasses or traits that * come after S. diff --git a/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala b/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala index 17f13d7c1..f67798eaa 100644 --- a/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala +++ b/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala @@ -95,7 +95,9 @@ object ProtoTypes { override def isMatchedBy(tp1: Type)(implicit ctx: Context) = { name == nme.WILDCARD || { - val mbr = tp1.member(name) + val mbr = + if (tp1.widen.classSymbol.isLinkedWith(ctx.owner.enclosingClass)) tp1.member(name) + else tp1.nonPrivateMember(name) def qualifies(m: SingleDenotation) = memberProto.isRef(defn.UnitClass) || compat.normalizedCompatible(m.info, memberProto) |