diff options
author | Martin Odersky <odersky@gmail.com> | 2006-08-14 15:54:33 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2006-08-14 15:54:33 +0000 |
commit | a959d0cd1054396113417ae0fc29117601811d6f (patch) | |
tree | dd81595dadfe43c21b2bf34d662e3d25e83abd82 | |
parent | 1bedeb3b3369a3cd6b9f8730114a8b24f21559c0 (diff) | |
download | scala-a959d0cd1054396113417ae0fc29117601811d6f.tar.gz scala-a959d0cd1054396113417ae0fc29117601811d6f.tar.bz2 scala-a959d0cd1054396113417ae0fc29117601811d6f.zip |
fixed bug698
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/RefChecks.scala | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index 8e798b31c1..c745290cc9 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -111,9 +111,14 @@ abstract class RefChecks extends InfoTransform { ); def overridesType(tp1: Type, tp2: Type): boolean = Pair(tp1, tp2) match { - case Pair(MethodType(List(), rtp1), PolyType(List(), rtp2)) => rtp1 <:< rtp2 - case Pair(PolyType(List(), rtp1), MethodType(List(), rtp2)) => rtp1 <:< rtp2 - case _ => tp1 <:< tp2 + case Pair(MethodType(List(), rtp1), PolyType(List(), rtp2)) => + rtp1 <:< rtp2 + case Pair(PolyType(List(), rtp1), MethodType(List(), rtp2)) => + rtp1 <:< rtp2 + case Pair(TypeRef(_, sym, _), _) if (sym.isModuleClass) => + overridesType(PolyType(List(), tp1), tp2) + case _ => + tp1 <:< tp2 } /* Check that all conditions for overriding `other' by `member' are met. */ @@ -127,7 +132,7 @@ abstract class RefChecks extends InfoTransform { def overrideTypeError(): unit = { if (other.tpe != ErrorType && member.tpe != ErrorType) { - overrideError("has incompatible type"); + overrideError("has incompatible type "+member.tpe); explainTypes(member.tpe, other.tpe); } } |