@@ -102,6 +102,8 @@ object RefChecks {
102102 * 4. Check that every member with an `override` modifier
103103 * overrides some other member.
104104 * TODO check that classes are not overridden
105+ * TODO This still needs to be cleaned up; the current version is a staright port of what was there
106+ * before, but it looks too complicated and method bodies are far too large.
105107 */
106108 private def checkAllOverrides (clazz : Symbol )(implicit ctx : Context ): Unit = {
107109 val self = clazz.thisType
@@ -116,11 +118,15 @@ object RefChecks {
116118 case List (MixinOverrideError (_, msg)) =>
117119 ctx.error(msg, clazz.pos)
118120 case MixinOverrideError (member, msg) :: others =>
119- val others1 = others.map(_.member.name.decode).filter(member.name.decode != _).distinct
120- ctx.error(
121- msg + (if (others1.isEmpty) " "
122- else " ;\n other members with override errors are: " + (others1 mkString " , " )),
123- clazz.pos)
121+ val others1 = others.map(_.member).filter(_.name != member.name).distinct
122+ def othersMsg = {
123+ val others1 = others.map(_.member)
124+ .filter(_.name != member.name)
125+ .map(_.show).distinct
126+ if (others1.isEmpty) " "
127+ else i " ; \n other members with override errors are:: $others1%, % "
128+ }
129+ ctx.error(msg + othersMsg, clazz.pos)
124130 }
125131 }
126132
@@ -129,9 +135,9 @@ object RefChecks {
129135
130136 def infoString0 (sym : Symbol , showLocation : Boolean ) = {
131137 val sym1 = sym.underlyingSymbol
132- if (showLocation) sym1.show
138+ if (showLocation) sym1.showLocated
133139 else
134- sym1.showLocated +
140+ sym1.show +
135141 (if (sym1.isAliasType) " , which equals " + self.memberInfo(sym1)
136142 else if (sym1.isAbstractType) " with bounds" + self.memberInfo(sym1)
137143 else if (sym1.is(Module )) " "
@@ -182,6 +188,8 @@ object RefChecks {
182188 }
183189
184190 def overrideAccessError () = {
191+ ctx.log(i " member: ${member.showLocated} ${member.flags}" ) // DEBUG
192+ ctx.log(i " other: ${other.showLocated} ${other.flags}" ) // DEBUG
185193 val otherAccess = (other.flags & AccessFlags ).toString
186194 overrideError(" has weaker access privileges; it should be " +
187195 (if (otherAccess == " " ) " public" else " at least " + otherAccess))
@@ -331,7 +339,7 @@ object RefChecks {
331339 // 2. Check that only abstract classes have deferred members
332340 def checkNoAbstractMembers (): Unit = {
333341 // Avoid spurious duplicates: first gather any missing members.
334- val missing = clazz.info .abstractTermMembers.filterNot(ignoreDeferred)
342+ val missing = clazz.thisType .abstractTermMembers.filterNot(ignoreDeferred)
335343 // Group missing members by the name of the underlying symbol,
336344 // to consolidate getters and setters.
337345 val grouped : Map [Name , Seq [SingleDenotation ]] = missing groupBy (_.symbol.underlyingSymbol.name)
@@ -464,6 +472,9 @@ object RefChecks {
464472 if (decl.is(Deferred ) && ! ignoreDeferred(decl)) {
465473 val impl = decl.matchingMember(clazz.thisType)
466474 if (impl == NoSymbol || (decl.owner isSubClass impl.owner)) {
475+ val impl1 = clazz.thisType.nonPrivateMember(decl.name) // DEBUG
476+ ctx.log(i " ${impl1}: ${impl1.info}" ) // DEBUG
477+ ctx.log(i " ${clazz.thisType.memberInfo(decl)}" ) // DEBUG
467478 abstractClassError(false , " there is a deferred declaration of " + infoString(decl) +
468479 " which is not implemented in a subclass" + err.abstractVarMessage(decl))
469480 }
@@ -499,7 +510,7 @@ object RefChecks {
499510 def hasMatchingSym (inclazz : Symbol , member : Symbol ): Boolean = {
500511
501512 def isSignatureMatch (sym : Symbol ) = ! sym.isTerm ||
502- clazz.thisType.memberInfo(sym).matches (member.info)
513+ clazz.thisType.memberInfo(sym).matchesLoosely (member.info)
503514
504515 /* The rules for accessing members which have an access boundary are more
505516 * restrictive in java than scala. Since java has no concept of package nesting,
@@ -626,7 +637,11 @@ object RefChecks {
626637 override val levelAndIndex : LevelAndIndex =
627638 ((outerLevelAndIndex, 0 ) /: stats) {(mi, stat) =>
628639 val (m, idx) = mi
629- (if (stat.symbol.exists) m.updated(stat.symbol, (this , idx)) else m, idx + 1 )
640+ val m1 = stat match {
641+ case stat : MemberDef => m.updated(stat.symbol, (this , idx))
642+ case _ => m
643+ }
644+ (m1, idx + 1 )
630645 }._1
631646 var maxIndex : Int = Int .MinValue
632647 var refPos : Position = _
0 commit comments