summaryrefslogtreecommitdiff
path: root/test/files/neg/t9675.check
diff options
context:
space:
mode:
authorteldosas <teldosas@gmail.com>2017-02-01 02:32:10 +0200
committerteldosas <teldosas@gmail.com>2017-02-01 02:32:10 +0200
commit6864d32fbd903ce67d43ef9e0b9f011baabc8695 (patch)
treea18077f9c72ffa80e076fb91b5c5336574b6a37b /test/files/neg/t9675.check
parentb9d4089d19ead36d07c2d6cdda283c9b678d515e (diff)
downloadscala-6864d32fbd903ce67d43ef9e0b9f011baabc8695.tar.gz
scala-6864d32fbd903ce67d43ef9e0b9f011baabc8695.tar.bz2
scala-6864d32fbd903ce67d43ef9e0b9f011baabc8695.zip
Add warning about non-sensible equals in anonymous functions
Diffstat (limited to 'test/files/neg/t9675.check')
-rw-r--r--test/files/neg/t9675.check27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/files/neg/t9675.check b/test/files/neg/t9675.check
new file mode 100644
index 0000000000..255477499c
--- /dev/null
+++ b/test/files/neg/t9675.check
@@ -0,0 +1,27 @@
+t9675.scala:4: warning: comparing values of types Test.A and String using `!=' will always yield true
+ val func1 = (x: A) => { x != "x" }
+ ^
+t9675.scala:6: warning: comparing values of types Test.A and String using `!=' will always yield true
+ val func2 = (x: A) => { x != "x" }: Boolean
+ ^
+t9675.scala:8: warning: comparing values of types Test.A and String using `!=' will always yield true
+ val func3: Function1[A, Boolean] = (x) => { x != "x" }
+ ^
+t9675.scala:11: warning: comparing values of types Test.A and String using `!=' will always yield true
+ def apply(x: A): Boolean = { x != "x" }
+ ^
+t9675.scala:14: warning: comparing values of types Test.A and String using `!=' will always yield true
+ def method(x: A): Boolean = { x != "x" }
+ ^
+t9675.scala:18: warning: comparing values of types Test.A and String using `!=' will always yield true
+ A("x") != "x"
+ ^
+t9675.scala:20: warning: comparing values of types Test.A and String using `!=' will always yield true
+ val func5: Function1[A, Boolean] = (x) => { x != "x" }
+ ^
+t9675.scala:22: warning: comparing values of types Test.A and String using `!=' will always yield true
+ List(A("x")).foreach((item: A) => item != "x")
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+8 warnings found
+one error found