summaryrefslogtreecommitdiff
path: root/test/files/neg/t5663-badwarneq.check
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2012-04-11 17:29:49 -0700
committerSom Snytt <som.snytt@gmail.com>2012-04-13 15:20:50 -0700
commit72d86cbe8cb4792a2eae190aee3677854bffb89f (patch)
treec629e6d62e902c61ffc3c78ac589a417445c0e72 /test/files/neg/t5663-badwarneq.check
parentb448f13d431a1a4e9d23c6acbf4bd15ccb647e3f (diff)
downloadscala-72d86cbe8cb4792a2eae190aee3677854bffb89f.tar.gz
scala-72d86cbe8cb4792a2eae190aee3677854bffb89f.tar.bz2
scala-72d86cbe8cb4792a2eae190aee3677854bffb89f.zip
SI-5663: Tweak warnings on case class equals
Re-enable testing the sensibility of comparing instances of two case classes. In particular, warn if we detect that the two objects inherit from different case classes. In addition, avoid emitting misleading warnings when comparing "new C".
Diffstat (limited to 'test/files/neg/t5663-badwarneq.check')
-rw-r--r--test/files/neg/t5663-badwarneq.check22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/files/neg/t5663-badwarneq.check b/test/files/neg/t5663-badwarneq.check
new file mode 100644
index 0000000000..00c2234e9d
--- /dev/null
+++ b/test/files/neg/t5663-badwarneq.check
@@ -0,0 +1,22 @@
+t5663-badwarneq.scala:42: error: comparing case class values of types Some[Int] and None.type using `==' will always yield false
+ println(new Some(1) == None) // Should complain on type, was: spuriously complains on fresh object
+ ^
+t5663-badwarneq.scala:43: error: comparing case class values of types Some[Int] and Thing using `==' will always yield false
+ println(Some(1) == new Thing(1)) // Should complain on type, was: spuriously complains on fresh object
+ ^
+t5663-badwarneq.scala:51: error: ThingOne and Thingy are unrelated: they will most likely never compare equal
+ println(t1 == t2) // true, but apparently unrelated, a compromise warning
+ ^
+t5663-badwarneq.scala:52: error: ThingThree and Thingy are unrelated: they will most likely never compare equal
+ println(t4 == t2) // true, complains because ThingThree is final and Thingy not a subclass, stronger claim than unrelated
+ ^
+t5663-badwarneq.scala:55: error: comparing case class values of types ThingTwo and Some[Int] using `==' will always yield false
+ println(t3 == Some(1)) // false, warn on different cases
+ ^
+t5663-badwarneq.scala:56: error: comparing values of types ThingOne and Cousin using `==' will always yield false
+ println(t1 == c) // should warn
+ ^
+t5663-badwarneq.scala:64: error: comparing case class values of types Simple and SimpleSibling.type using `==' will always yield false
+ println(new Simple() == SimpleSibling) // like Some(1) == None, but needn't be final case
+ ^
+7 errors found