summaryrefslogtreecommitdiff
path: root/test/files/neg
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2016-10-07 19:55:21 -0700
committerSom Snytt <som.snytt@gmail.com>2016-10-07 19:55:21 -0700
commita7a4e5f68c070543516aed3e4ad3e3d6c787dce1 (patch)
treea7c01437df3ddc576edf72b4966cac2d78b9630c /test/files/neg
parent9d3f0777ff883a7c59da3fa7fee156890f51701e (diff)
downloadscala-a7a4e5f68c070543516aed3e4ad3e3d6c787dce1.tar.gz
scala-a7a4e5f68c070543516aed3e4ad3e3d6c787dce1.tar.bz2
scala-a7a4e5f68c070543516aed3e4ad3e3d6c787dce1.zip
SI-9953 Any Any aborts warn on equals
Don't warn about equals if any `Any` is involved. cf SI-8965 The condition for warning is that both types lub to a supertype of Object.
Diffstat (limited to 'test/files/neg')
-rw-r--r--test/files/neg/t9953.check6
-rw-r--r--test/files/neg/t9953.flags1
-rw-r--r--test/files/neg/t9953.scala13
3 files changed, 20 insertions, 0 deletions
diff --git a/test/files/neg/t9953.check b/test/files/neg/t9953.check
new file mode 100644
index 0000000000..f5dcbcacee
--- /dev/null
+++ b/test/files/neg/t9953.check
@@ -0,0 +1,6 @@
+t9953.scala:10: warning: Object and X are unrelated: they will never compare equal
+ def b = y == x // warn
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/test/files/neg/t9953.flags b/test/files/neg/t9953.flags
new file mode 100644
index 0000000000..85d8eb2ba2
--- /dev/null
+++ b/test/files/neg/t9953.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/test/files/neg/t9953.scala b/test/files/neg/t9953.scala
new file mode 100644
index 0000000000..faaee86d50
--- /dev/null
+++ b/test/files/neg/t9953.scala
@@ -0,0 +1,13 @@
+
+class X(val v: Int) extends AnyVal
+trait T extends Any
+object Y extends T
+
+class C {
+ val x = new X(42)
+ val y = new Object
+ val a: T = null
+ def b = y == x // warn
+ def c = y == a // no warn
+ def d = Y == a // no warn
+}