summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2003-10-07 06:28:55 +0000
committerpaltherr <paltherr@epfl.ch>2003-10-07 06:28:55 +0000
commit923c969e57d72a1d072b4772d2f2870a061b23ad (patch)
treee5348d5f137f7aeff3fb676d8d9b9487109ab37c /sources
parentec98152cb2656b5d795406df20a5bc2e8513a473 (diff)
downloadscala-923c969e57d72a1d072b4772d2f2870a061b23ad.tar.gz
scala-923c969e57d72a1d072b4772d2f2870a061b23ad.tar.bz2
scala-923c969e57d72a1d072b4772d2f2870a061b23ad.zip
- Added a version of overridingSymbolfor phases...
- Added a version of overridingSymbolfor phases after Erasure
Diffstat (limited to 'sources')
-rw-r--r--sources/scalac/symtab/Symbol.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/sources/scalac/symtab/Symbol.java b/sources/scalac/symtab/Symbol.java
index 311df5084d..7c75004677 100644
--- a/sources/scalac/symtab/Symbol.java
+++ b/sources/scalac/symtab/Symbol.java
@@ -1172,6 +1172,9 @@ public abstract class Symbol implements Modifiers, Kinds {
* `sub' must be a subclass of this.owner().
*/
public Symbol overridingSymbol(Type sub) {
+ return overridingSymbol(sub, false);
+ }
+ public Symbol overridingSymbol(Type sub, boolean exact) {
assert !isOverloaded() : this;
Symbol sym1 = sub.lookup(name);
if (sym1.kind == Kinds.NONE || (sym1.flags & STATIC) != 0) {
@@ -1185,13 +1188,18 @@ public abstract class Symbol implements Modifiers, Kinds {
switch (sym1type) {
case OverloadedType(Symbol[] alts, Type[] alttypes):
for (int i = 0; i < alts.length; i++) {
- if (alttypes[i].derefDef().isSubType(symtype)) return alts[i];
+ if (exact
+ ? alttypes[i].derefDef().isSameAs(symtype)
+ : alttypes[i].derefDef().isSubType(symtype))
+ return alts[i];
}
return Symbol.NONE;
default:
- if (sym1type.isSubType(symtype)) return sym1;
+ if (exact
+ ? sym1type.isSameAs(symtype)
+ : sym1type.isSubType(symtype)) return sym1;
else {
- if (Global.instance.debug) System.out.println(this + locationString() + " is not overridden by " + sym1 + sym1.locationString() + ", since " + sym1type + " !<= " + symtype);//DEBUG
+ if (Global.instance.debug) System.out.println(this + locationString() + " is not overridden by " + sym1 + sym1.locationString() + ", since " + sym1type + (exact ? " != " : " !<= ") + symtype);//DEBUG
return Symbol.NONE;
}
}