diff options
author | Martin Odersky <odersky@gmail.com> | 2007-03-28 16:33:37 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2007-03-28 16:33:37 +0000 |
commit | 1ab4fbc3b92d249f7a354ad0cfd794a3196fd95a (patch) | |
tree | 99ebc29a3faefa9bf8689b24d26a8808d375b799 /src/compiler/scala/tools/nsc/typechecker/RefChecks.scala | |
parent | eabe0b477d8169934d296682f1a12e8c707d5de7 (diff) | |
download | scala-1ab4fbc3b92d249f7a354ad0cfd794a3196fd95a.tar.gz scala-1ab4fbc3b92d249f7a354ad0cfd794a3196fd95a.tar.bz2 scala-1ab4fbc3b92d249f7a354ad0cfd794a3196fd95a.zip |
Fixed problem with sensibility checks.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/RefChecks.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/RefChecks.scala | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index 7527f80b13..00e015956c 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -448,9 +448,15 @@ abstract class RefChecks extends InfoTransform { } name match { case nme.EQ | nme.NE | nme.LT | nme.GT | nme.LE | nme.GE => - val formal = fn.tpe.paramTypes.head.widen.symbol - val actual = args.head.tpe.widen.symbol - val receiver = qual.tpe.widen.symbol + def underlyingClass(tp: Type): Symbol = { + var sym = tp.widen.symbol + while (sym.isAbstractType) + sym = sym.info.bounds.hi.widen.symbol + sym + } + val formal = underlyingClass(fn.tpe.paramTypes.head) + val actual = underlyingClass(args.head.tpe) + val receiver = underlyingClass(qual.tpe) def nonSensibleWarning(what: String, alwaysEqual: boolean) = unit.warning(pos, "comparing "+what+" using `"+name.decode+"' will always yield "+ (alwaysEqual == (name == nme.EQ || name == nme.LE || name == nme.GE))) |