diff options
author | Martin Odersky <odersky@gmail.com> | 2004-04-16 14:44:57 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2004-04-16 14:44:57 +0000 |
commit | d57f01bdefdaa7647640424db59b4593ba73d7bf (patch) | |
tree | 6f129469830afc2687ab5f85d64a1758021ac453 /sources/scalac/typechecker/RefCheck.java | |
parent | 0de069d6405411d1036b4a784d9896fe8073a1c4 (diff) | |
download | scala-d57f01bdefdaa7647640424db59b4593ba73d7bf.tar.gz scala-d57f01bdefdaa7647640424db59b4593ba73d7bf.tar.bz2 scala-d57f01bdefdaa7647640424db59b4593ba73d7bf.zip |
*** empty log message ***
Diffstat (limited to 'sources/scalac/typechecker/RefCheck.java')
-rw-r--r-- | sources/scalac/typechecker/RefCheck.java | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/sources/scalac/typechecker/RefCheck.java b/sources/scalac/typechecker/RefCheck.java index c57361a670..f65485a33a 100644 --- a/sources/scalac/typechecker/RefCheck.java +++ b/sources/scalac/typechecker/RefCheck.java @@ -206,17 +206,33 @@ public class RefCheck extends Transformer implements Modifiers, Kinds { * M must be labelled `abstract override'. */ void checkOverride(int pos, Symbol clazz, Symbol member, Symbol other) { - //System.out.println(member + member.locationString() + " overrides " + other + other.locationString() + " in " + clazz);//DEBUG + //System.out.println(member + member.locationString() + " overrides " + other + other.locationString() + " in " + clazz);//debug if (member.owner() == clazz) pos = member.pos; - else if (member.owner().isSubClass(other.owner())) - return; // everything was already checked elsewhere else { + if (member.owner().isSubClass(other.owner()) && + (member.flags & DEFERRED) >= (other.flags & DEFERRED)) { + //System.out.println(member + member.locationString() + " shadows1 " + other + other.locationString() + " in " + clazz);//DEBUG + return; // everything was already checked elsewhere + } + Type[] parents = clazz.parents(); - for (int i = 0; i < parents.length; i++) { + boolean memberShadowsOther = true; + for (int i = 0; i < parents.length && memberShadowsOther; i++) { Symbol p = parents[i].symbol(); - if (p.isSubClass(member.owner()) && p.isSubClass(other.owner())) + boolean subMember = p.isSubClass(other.owner()); + boolean subOther = p.isSubClass(member.owner()); + if (subMember != subOther) { + memberShadowsOther = false; + } else if (subMember && subOther && + (member.flags & DEFERRED) >= (other.flags & DEFERRED)) { + //System.out.println(member + member.locationString() + " shadows2 " + other + other.locationString() + " in " + clazz);//DEBUG return; // everything was already checked elsewhere + } + } + if (memberShadowsOther) { + //System.out.println(member + member.locationString() + " shadows " + other + other.locationString() + " in " + clazz);//DEBUG + return; // everything was already checked elsewhere } } |