From a37284fdf7e2b2917c9e894a9b93c02d1defc983 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Wed, 1 Dec 2010 16:25:54 +0000 Subject: More fiddling with checkSensible. warnings. Fixed some bugs revealed by said warnings, and made some minor changes to avoid warnings. (Technically it's not a bug to have unrelated classes compare as equal, but it so often is a bug that it behooves us not to do it intentionally so the warnings stand out.) Disabled the most useful warning for the moment since it'd be wrong with some frequency. No review. --- test/files/neg/checksensible.check | 10 +++++----- test/files/neg/checksensible.scala | 7 ++++--- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/files/neg/checksensible.check b/test/files/neg/checksensible.check index 67a76dd7be..9977739196 100644 --- a/test/files/neg/checksensible.check +++ b/test/files/neg/checksensible.check @@ -73,19 +73,19 @@ checksensible.scala:59: error: comparing values of types Int and Null using `==' checksensible.scala:64: error: comparing values of types Bip and Bop using `==' will always yield false (x1 == x2) ^ -checksensible.scala:75: error: comparing values of types EqEqRefTest.this.C3 and EqEqRefTest.this.Z1 using `==' will always yield false +checksensible.scala:74: error: comparing values of types EqEqRefTest.this.C3 and EqEqRefTest.this.Z1 using `==' will always yield false c3 == z1 ^ -checksensible.scala:76: error: comparing values of types EqEqRefTest.this.Z1 and EqEqRefTest.this.C3 using `==' will always yield false +checksensible.scala:75: error: comparing values of types EqEqRefTest.this.Z1 and EqEqRefTest.this.C3 using `==' will always yield false z1 == c3 ^ -checksensible.scala:77: error: comparing values of types EqEqRefTest.this.Z1 and EqEqRefTest.this.C3 using `!=' will always yield true +checksensible.scala:76: error: comparing values of types EqEqRefTest.this.Z1 and EqEqRefTest.this.C3 using `!=' will always yield true z1 != c3 ^ -checksensible.scala:78: error: comparing values of types EqEqRefTest.this.C3 and java.lang.String using `!=' will always yield true +checksensible.scala:77: error: comparing values of types EqEqRefTest.this.C3 and java.lang.String using `!=' will always yield true c3 != "abc" ^ -checksensible.scala:87: error: comparing values of types Unit and Int using `!=' will always yield true +checksensible.scala:88: error: comparing values of types Unit and Int using `!=' will always yield true while ((c = in.read) != -1) ^ 30 errors found diff --git a/test/files/neg/checksensible.scala b/test/files/neg/checksensible.scala index e68a6ce9c7..4872df4dfb 100644 --- a/test/files/neg/checksensible.scala +++ b/test/files/neg/checksensible.scala @@ -29,7 +29,7 @@ class EqEqValTest { 1 == "abc" 1 == ("abc": Any) // doesn't warn because an Any may be a boxed Int 1 == (1: Any) // as above - "abc" == 1 // doesn't warn since String defines an equals method + "abc" == 1 // doesn't generally warn since String defines an equals method, but can chatty warn new AnyRef == 1 1 == new AnyRef // doesn't warn because it could be... @@ -70,12 +70,13 @@ class EqEqRefTest { val z1 = new Z1 val c3 = new C3 - // all but c3 != z1 should warn - c3 != z1 + // these should always warn c3 == z1 z1 == c3 z1 != c3 c3 != "abc" + // this should warn when feeling chatty + c3 != z1 // non-warners (null: AnyRef) == (null: AnyRef) -- cgit v1.2.3