diff options
author | Martin Odersky <odersky@gmail.com> | 2016-10-14 10:21:26 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-10-14 10:21:50 +0200 |
commit | bcd3c1f6e26f814a2f69d7e44f165b59b1db0fe3 (patch) | |
tree | d3cb73da07e195838c6e17750741c5b9088314e3 /src | |
parent | 8bfaadaae141e83db7f515b042fcee26ed0e54fd (diff) | |
download | dotty-bcd3c1f6e26f814a2f69d7e44f165b59b1db0fe3.tar.gz dotty-bcd3c1f6e26f814a2f69d7e44f165b59b1db0fe3.tar.bz2 dotty-bcd3c1f6e26f814a2f69d7e44f165b59b1db0fe3.zip |
Fix #1531: Ignore private members when looking for abstract ones
Private members do not override abstract ones. So when looking for
abstract members we need to search with `nonPrivateMember`, not
`member`.
Fixes #1531. Review by @smarter.
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 8 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/RefChecks.scala | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index d242843e5..aa3de60d7 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -615,13 +615,13 @@ object Types { /** The set of abstract term members of this type. */ final def abstractTermMembers(implicit ctx: Context): Seq[SingleDenotation] = track("abstractTermMembers") { memberDenots(abstractTermNameFilter, - (name, buf) => buf ++= member(name).altsWith(_ is Deferred)) + (name, buf) => buf ++= nonPrivateMember(name).altsWith(_ is Deferred)) } /** The set of abstract type members of this type. */ final def abstractTypeMembers(implicit ctx: Context): Seq[SingleDenotation] = track("abstractTypeMembers") { memberDenots(abstractTypeNameFilter, - (name, buf) => buf += member(name).asSingleDenotation) + (name, buf) => buf += nonPrivateMember(name).asSingleDenotation) } /** The set of abstract type members of this type. */ @@ -3756,7 +3756,7 @@ object Types { object abstractTypeNameFilter extends NameFilter { def apply(pre: Type, name: Name)(implicit ctx: Context): Boolean = name.isTypeName && { - val mbr = pre.member(name) + val mbr = pre.nonPrivateMember(name) (mbr.symbol is Deferred) && mbr.info.isInstanceOf[RealTypeBounds] } } @@ -3773,7 +3773,7 @@ object Types { /** A filter for names of deferred term definitions of a given type */ object abstractTermNameFilter extends NameFilter { def apply(pre: Type, name: Name)(implicit ctx: Context): Boolean = - name.isTermName && (pre member name).hasAltWith(_.symbol is Deferred) + name.isTermName && pre.nonPrivateMember(name).hasAltWith(_.symbol is Deferred) } object typeNameFilter extends NameFilter { diff --git a/src/dotty/tools/dotc/typer/RefChecks.scala b/src/dotty/tools/dotc/typer/RefChecks.scala index 4d82a2d12..834bb37a8 100644 --- a/src/dotty/tools/dotc/typer/RefChecks.scala +++ b/src/dotty/tools/dotc/typer/RefChecks.scala @@ -487,7 +487,7 @@ object RefChecks { // abstract method, and a cursory examination of the difference reveals // something obvious to us, let's make it more obvious to them. val abstractParams = underlying.info.firstParamTypes - val matchingName = clazz.info.member(underlying.name).alternatives + val matchingName = clazz.info.nonPrivateMember(underlying.name).alternatives val matchingArity = matchingName filter { m => !m.symbol.is(Deferred) && m.info.firstParamTypes.length == abstractParams.length |