summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2004-07-06 14:17:48 +0000
committerMartin Odersky <odersky@gmail.com>2004-07-06 14:17:48 +0000
commit40db5ce7419683e7d336dbd3f3fe793bf7ae4d65 (patch)
tree9d98877248b4b3c683c85a6266febc6a3eec024e /sources
parentb5127bbfea6df39af5db3dc45bb9f7e698acb3f1 (diff)
downloadscala-40db5ce7419683e7d336dbd3f3fe793bf7ae4d65.tar.gz
scala-40db5ce7419683e7d336dbd3f3fe793bf7ae4d65.tar.bz2
scala-40db5ce7419683e7d336dbd3f3fe793bf7ae4d65.zip
*** empty log message ***
Diffstat (limited to 'sources')
-rw-r--r--sources/scala/tools/scalac/CompilerPhases.scala2
-rw-r--r--sources/scalac/CompilerPhases.java2
-rw-r--r--sources/scalac/symtab/Type.java17
-rw-r--r--sources/scalac/typechecker/RefCheck.java8
4 files changed, 16 insertions, 13 deletions
diff --git a/sources/scala/tools/scalac/CompilerPhases.scala b/sources/scala/tools/scalac/CompilerPhases.scala
index 97f81358bc..4f236a1f93 100644
--- a/sources/scala/tools/scalac/CompilerPhases.scala
+++ b/sources/scala/tools/scalac/CompilerPhases.scala
@@ -20,6 +20,8 @@ class CompilerPhases extends scalac_CompilerPhases {
Class.forName("scala.tools.scalac.ast.parser.ParserPhase$class");
protected override def ANALYZER_PHASE(): Class =
Class.forName("scala.tools.scalac.typechecker.AnalyzerPhase$class");
+ protected override def REFCHECK_PHASE(): Class =
+ Class.forName("scala.tools.scalac.typechecker.RefCheckPhase$class");
protected override def TRANSMATCH_PHASE(): Class =
Class.forName("scala.tools.scalac.transformer.TransMatchPhase$class");
protected override def WHOLEPROG_PHASE(): Class =
diff --git a/sources/scalac/CompilerPhases.java b/sources/scalac/CompilerPhases.java
index 3dc4e9a24f..c65eb93957 100644
--- a/sources/scalac/CompilerPhases.java
+++ b/sources/scalac/CompilerPhases.java
@@ -54,7 +54,7 @@ public abstract class CompilerPhases {
*/
protected abstract Class PARSER_PHASE();
protected abstract Class ANALYZER_PHASE();
- protected Class REFCHECK_PHASE() { return scalac.typechecker.RefCheckPhase.class; }
+ protected abstract Class REFCHECK_PHASE();
protected Class UNCURRY_PHASE() { return scalac.transformer.UnCurryPhase.class; }
protected abstract Class TRANSMATCH_PHASE() ;
protected Class LAMBDALIFT_PHASE() { return scalac.transformer.LambdaLiftPhase.class; }
diff --git a/sources/scalac/symtab/Type.java b/sources/scalac/symtab/Type.java
index e88240a56f..65bb56a73a 100644
--- a/sources/scalac/symtab/Type.java
+++ b/sources/scalac/symtab/Type.java
@@ -1938,9 +1938,9 @@ public class Type implements Modifiers, Kinds, TypeTags, EntryTags {
case PolyType(Symbol[] ps, Type res):
if (ps.length != ps1.length) return false;
for (int i = 0; i < ps.length; i++)
- if (!ps1[i].info().subst(ps1, ps).isSameAs(ps[i].info()) ||
- !ps[i].loBound().isSameAs(ps1[i].loBound().subst(ps1, ps)) ||
- !ps[i].vuBound().isSameAs(ps1[i].vuBound().subst(ps1, ps)))
+ if (!ps1[i].info().subst(ps1, ps).isSubType(ps[i].info()) ||
+ !ps[i].loBound().isSubType(ps1[i].loBound().subst(ps1, ps)) ||
+ !ps1[i].vuBound().subst(ps1, ps).isSubType(ps[i].vuBound()))
return false;
return res.isSubType(res1.subst(ps1, ps));
}
@@ -2378,9 +2378,9 @@ public class Type implements Modifiers, Kinds, TypeTags, EntryTags {
case PolyType(Symbol[] ps, Type res):
if (ps.length != ps1.length) return false;
for (int i = 0; i < ps.length; i++)
- if (!ps1[i].info().subst(ps1, ps).isSameAs(ps[i].info()) ||
- !ps[i].loBound().isSameAs(ps1[i].loBound().subst(ps1, ps)) ||
- !ps[i].vuBound().isSameAs(ps1[i].vuBound().subst(ps1, ps)))
+ if (!ps1[i].info().subst(ps1, ps).isSubType(ps[i].info()) ||
+ !ps[i].loBound().isSubType(ps1[i].loBound().subst(ps1, ps)) ||
+ !ps1[i].vuBound().subst(ps1, ps).isSubType(ps[i].vuBound()))
return false;
return res.overrides(res1.subst(ps1, ps));
}
@@ -2390,7 +2390,10 @@ public class Type implements Modifiers, Kinds, TypeTags, EntryTags {
throw new ApplicationError("overrides inapplicable for " + tp);
default:
- return true;
+ switch (this) {
+ case MethodType(_, _): case PolyType(_, _): return false;
+ default: return true;
+ }
}
}
}
diff --git a/sources/scalac/typechecker/RefCheck.java b/sources/scalac/typechecker/RefCheck.java
index dc383e5067..0a35ae25a8 100644
--- a/sources/scalac/typechecker/RefCheck.java
+++ b/sources/scalac/typechecker/RefCheck.java
@@ -116,12 +116,10 @@ public class RefCheck extends Transformer implements Modifiers, Kinds {
if (member1.kind == VAL) {
Type self = clazz.thisType();
Type otherinfo = normalizedInfo(self, other);
- Type template = resultToAny(otherinfo);
switch (member1.info()) {
case OverloadedType(Symbol[] alts, _):
for (int i = 0; i < alts.length; i++) {
- if (normalizedInfo(self, alts[i]).isSubType(template) /*&&
- alts[i].owner() == member1.owner()*/) {
+ if (normalizedInfo(self, alts[i]).overrides(otherinfo)) {
if (member == other)
member = alts[i];
else
@@ -136,7 +134,7 @@ public class RefCheck extends Transformer implements Modifiers, Kinds {
}
break;
default:
- if (normalizedInfo(self, member1).isSubType(template)) {
+ if (normalizedInfo(self, member1).overrides(otherinfo)) {
member = member1;
}
}
@@ -212,7 +210,7 @@ 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.type() + member.locationString() + " overrides " + other + ":" + other.type() + other.locationString() + " in " + clazz);//DEBUG
if (member.owner() == clazz)
pos = member.pos;
else {