summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2009-11-15 13:56:21 +0000
committerMartin Odersky <odersky@gmail.com>2009-11-15 13:56:21 +0000
commit0c373e49859b872e339a3e86216d0f2d7c471454 (patch)
treeb53f6b446e88bb1f30c30141f0c686bf201728d1 /src
parentc43f01c39d029be1a82c78bb2f49da5eb6833ab5 (diff)
downloadscala-0c373e49859b872e339a3e86216d0f2d7c471454.tar.gz
scala-0c373e49859b872e339a3e86216d0f2d7c471454.tar.bz2
scala-0c373e49859b872e339a3e86216d0f2d7c471454.zip
Fixed #1459
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Symbols.scala6
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala16
2 files changed, 11 insertions, 11 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
index e4cbe159a1..1326e89774 100644
--- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
@@ -112,7 +112,7 @@ trait Symbols {
* the annotations attached to member a definition (class, method, type, field).
*/
def annotations: List[AnnotationInfo] = {
- // .initialize: the type completer of the symbol parses the annotations,
+ // .initialize: the type completer o f the symbol parses the annotations,
// see "def typeSig" in Namers
val annots1 = initialize.rawannots map {
case LazyAnnotationInfo(annot) => annot()
@@ -1369,8 +1369,8 @@ trait Symbols {
/** The non-private member of `site' whose type and name match the type of this symbol
*/
- final def matchingSymbol(site: Type): Symbol =
- site.nonPrivateMember(name).filter(sym =>
+ final def matchingSymbol(site: Type, admit: Long = 0L): Symbol =
+ site.nonPrivateMemberAdmitting(name, admit).filter(sym =>
!sym.isTerm || (site.memberType(this) matches site.memberType(sym)))
/** The symbol overridden by this symbol in given class `ofclazz'.
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index d5187a4564..522a03d91d 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -401,9 +401,7 @@ abstract class RefChecks extends InfoTransform {
else clazz.toString() + " needs to be abstract") + ", since " + msg);
clazz.setFlag(ABSTRACT)
}
- // Find a concrete Java method that overrides `sym' under the erasure model.
- // Bridge symbols qualify.
- // Used as a fall back if no overriding symbol of a Java abstract method can be found
+
def javaErasedOverridingSym(sym: Symbol): Symbol =
clazz.tpe.nonPrivateMemberAdmitting(sym.name, BRIDGE).filter(other =>
!other.isDeferred &&
@@ -413,10 +411,12 @@ abstract class RefChecks extends InfoTransform {
atPhase(currentRun.erasurePhase.next)(tp1 matches tp2)
})
+ def ignoreDeferred(member: Symbol) =
+ isAbstractTypeWithoutFBound(member) ||
+ ((member hasFlag JAVA) && javaErasedOverridingSym(member) != NoSymbol)
+
for (member <- clazz.tpe.nonPrivateMembersAdmitting(VBRIDGE))
- if (member.isDeferred && !(clazz hasFlag ABSTRACT) &&
- !isAbstractTypeWithoutFBound(member) &&
- !((member hasFlag JAVA) && javaErasedOverridingSym(member) != NoSymbol)) {
+ if (member.isDeferred && !(clazz hasFlag ABSTRACT) && !ignoreDeferred(member)) {
abstractClassError(
false, infoString(member) + " is not defined" + analyzer.varNotice(member))
} else if ((member hasFlag ABSOVERRIDE) && member.isIncompleteIn(clazz)) {
@@ -438,8 +438,8 @@ abstract class RefChecks extends InfoTransform {
// (3) is violated but not (2).
def checkNoAbstractDecls(bc: Symbol) {
for (decl <- bc.info.decls.iterator) {
- if (decl.isDeferred && !isAbstractTypeWithoutFBound(decl)) {
- val impl = decl.matchingSymbol(clazz.thisType)
+ if (decl.isDeferred && !ignoreDeferred(decl)) {
+ val impl = decl.matchingSymbol(clazz.thisType, admit = VBRIDGE)
if (impl == NoSymbol || (decl.owner isSubClass impl.owner)) {
abstractClassError(false, "there is a deferred declaration of "+infoString(decl)+
" which is not implemented in a subclass"+analyzer.varNotice(decl))