summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2016-11-16 22:03:46 +0100
committerGitHub <noreply@github.com>2016-11-16 22:03:46 +0100
commiteff3084b06b7d8bb9abdc62ffb13f4780c17dea4 (patch)
treeec885086cf2565d4bcd446b038011cf66086abe6 /test
parent55cff2cfa3f615f9eac158b1d2394ebbf473c6fb (diff)
parenta7a4e5f68c070543516aed3e4ad3e3d6c787dce1 (diff)
downloadscala-eff3084b06b7d8bb9abdc62ffb13f4780c17dea4.tar.gz
scala-eff3084b06b7d8bb9abdc62ffb13f4780c17dea4.tar.bz2
scala-eff3084b06b7d8bb9abdc62ffb13f4780c17dea4.zip
Merge pull request #5449 from som-snytt/issue/9953
SI-9953 Any Any aborts warn on equals
Diffstat (limited to 'test')
-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
+}