diff options
author | Paul Phillips <paulp@improving.org> | 2013-09-27 12:21:46 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-09-27 12:21:46 -0700 |
commit | f9cd8ea3ca22264ab29d721633d312c850237121 (patch) | |
tree | 4d833087373589bca81c8d8d5ac57de1e8e77960 /test/files/neg | |
parent | 76b4810882f88a141b4445c9ce98f5afcfb80e01 (diff) | |
parent | 343127958ce708cab7bcab7acf344748567bd310 (diff) | |
download | scala-f9cd8ea3ca22264ab29d721633d312c850237121.tar.gz scala-f9cd8ea3ca22264ab29d721633d312c850237121.tar.bz2 scala-f9cd8ea3ca22264ab29d721633d312c850237121.zip |
Merge pull request #2998 from paulp/pr/6120
SI-6120 multiple warnings at same position.
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/checksensible.check | 17 | ||||
-rw-r--r-- | test/files/neg/newpat_unreachable.check | 8 | ||||
-rw-r--r-- | test/files/neg/package-ob-case.check | 5 | ||||
-rw-r--r-- | test/files/neg/pat_unreachable.check | 5 | ||||
-rw-r--r-- | test/files/neg/t5426.check | 8 | ||||
-rw-r--r-- | test/files/neg/t5663-badwarneq.check | 5 | ||||
-rw-r--r-- | test/files/neg/t6048.check | 5 | ||||
-rw-r--r-- | test/files/neg/t6120.check | 20 | ||||
-rw-r--r-- | test/files/neg/t6120.flags | 1 | ||||
-rw-r--r-- | test/files/neg/t6120.scala | 7 | ||||
-rw-r--r-- | test/files/neg/t7721.check | 8 | ||||
-rw-r--r-- | test/files/neg/t7756b.check | 5 | ||||
-rw-r--r-- | test/files/neg/unreachablechar.check | 5 | ||||
-rw-r--r-- | test/files/neg/warn-unused-privates.check | 5 |
14 files changed, 93 insertions, 11 deletions
diff --git a/test/files/neg/checksensible.check b/test/files/neg/checksensible.check index e5f1a38d96..ef3aee5ee4 100644 --- a/test/files/neg/checksensible.check +++ b/test/files/neg/checksensible.check @@ -28,6 +28,9 @@ checksensible.scala:27: warning: comparing values of types Int and Unit using `= checksensible.scala:29: warning: comparing values of types Int and String using `==' will always yield false 1 == "abc" ^ +checksensible.scala:29: warning: Int and String are unrelated: they will most likely never compare equal + 1 == "abc" + ^ checksensible.scala:33: warning: comparing values of types Some[Int] and Int using `==' will always yield false Some(1) == 1 // as above ^ @@ -61,12 +64,18 @@ checksensible.scala:51: warning: comparing values of types Int and Unit using `! checksensible.scala:52: warning: comparing values of types Int and Symbol using `!=' will always yield true (1 != 'sym) ^ +checksensible.scala:52: warning: Int and Symbol are unrelated: they will most likely always compare unequal + (1 != 'sym) + ^ checksensible.scala:58: warning: comparing a fresh object using `==' will always yield false ((x: Int) => x + 1) == null ^ checksensible.scala:59: warning: comparing a fresh object using `==' will always yield false Bep == ((_: Int) + 1) ^ +checksensible.scala:59: warning: Bep.type and Int => Int are unrelated: they will most likely never compare equal + Bep == ((_: Int) + 1) + ^ checksensible.scala:61: warning: comparing a fresh object using `==' will always yield false new Object == new Object ^ @@ -82,6 +91,9 @@ checksensible.scala:66: warning: comparing values of types Int and Null using `= checksensible.scala:71: warning: comparing values of types Bip and Bop using `==' will always yield false (x1 == x2) ^ +checksensible.scala:71: warning: Bip and Bop are unrelated: they will most likely never compare equal + (x1 == x2) + ^ checksensible.scala:81: warning: comparing values of types EqEqRefTest.this.C3 and EqEqRefTest.this.Z1 using `==' will always yield false c3 == z1 ^ @@ -94,9 +106,12 @@ checksensible.scala:83: warning: comparing values of types EqEqRefTest.this.Z1 a checksensible.scala:84: warning: comparing values of types EqEqRefTest.this.C3 and String using `!=' will always yield true c3 != "abc" ^ +checksensible.scala:84: warning: EqEqRefTest.this.C3 and String are unrelated: they will most likely always compare unequal + c3 != "abc" + ^ checksensible.scala:95: warning: comparing values of types Unit and Int using `!=' will always yield true while ((c = in.read) != -1) ^ error: No warnings can be incurred under -Xfatal-warnings. -33 warnings found +38 warnings found one error found diff --git a/test/files/neg/newpat_unreachable.check b/test/files/neg/newpat_unreachable.check index a928e3853a..4463e2f1a4 100644 --- a/test/files/neg/newpat_unreachable.check +++ b/test/files/neg/newpat_unreachable.check @@ -13,6 +13,9 @@ If you intended to match against value d in class A, you must use backticks, lik newpat_unreachable.scala:9: warning: unreachable code due to variable pattern 'b' on line 6 case _ => println("matched neither") ^ +newpat_unreachable.scala:7: warning: unreachable code + case c => println("matched c") + ^ newpat_unreachable.scala:22: warning: patterns after a variable pattern cannot match (SLS 8.1.1) If you intended to match against parameter b of method g, you must use backticks, like: case `b` => case b => 1 @@ -24,6 +27,9 @@ If you intended to match against parameter c of method h, you must use backticks newpat_unreachable.scala:24: warning: unreachable code due to variable pattern 'b' on line 22 case _ => 3 ^ +newpat_unreachable.scala:23: warning: unreachable code + case c => 2 + ^ error: No warnings can be incurred under -Xfatal-warnings. -7 warnings found +9 warnings found one error found diff --git a/test/files/neg/package-ob-case.check b/test/files/neg/package-ob-case.check index 063a120db1..9b0ede1c6d 100644 --- a/test/files/neg/package-ob-case.check +++ b/test/files/neg/package-ob-case.check @@ -2,6 +2,9 @@ package-ob-case.scala:3: warning: it is not recommended to define classes/object If possible, define class X in package foo instead. case class X(z: Int) { } ^ +package-ob-case.scala:3: warning: class X should be placed directly in package foo instead of package object foo. Under some circumstances companion objects and case classes in package objects can fail to recompile. See https://issues.scala-lang.org/browse/SI-5954. + case class X(z: Int) { } + ^ error: No warnings can be incurred under -Xfatal-warnings. -one warning found +two warnings found one error found diff --git a/test/files/neg/pat_unreachable.check b/test/files/neg/pat_unreachable.check index b4c0e7e104..374ee4e9cf 100644 --- a/test/files/neg/pat_unreachable.check +++ b/test/files/neg/pat_unreachable.check @@ -9,6 +9,9 @@ If you intended to match against parameter c of method contrivedExample, you mus pat_unreachable.scala:24: warning: unreachable code due to variable pattern 'b' on line 22 case _ => println("matched neither") ^ +pat_unreachable.scala:23: warning: unreachable code + case c => println("matched c") + ^ error: No warnings can be incurred under -Xfatal-warnings. -three warnings found +four warnings found one error found diff --git a/test/files/neg/t5426.check b/test/files/neg/t5426.check index 98f3ddaaae..c042cdcec3 100644 --- a/test/files/neg/t5426.check +++ b/test/files/neg/t5426.check @@ -4,12 +4,18 @@ t5426.scala:2: warning: comparing values of types Some[Int] and Int using `==' w t5426.scala:3: warning: comparing values of types Int and Some[Int] using `==' will always yield false def f2 = 5 == Some(5) ^ +t5426.scala:3: warning: Int and Some[Int] are unrelated: they will most likely never compare equal + def f2 = 5 == Some(5) + ^ t5426.scala:8: warning: comparing values of types Int and Some[Int] using `==' will always yield false (x1 == x2) ^ +t5426.scala:8: warning: Int and Some[Int] are unrelated: they will most likely never compare equal + (x1 == x2) + ^ t5426.scala:9: warning: comparing values of types Some[Int] and Int using `==' will always yield false (x2 == x1) ^ error: No warnings can be incurred under -Xfatal-warnings. -four warnings found +6 warnings found one error found diff --git a/test/files/neg/t5663-badwarneq.check b/test/files/neg/t5663-badwarneq.check index 732e4f44d0..4b7795585b 100644 --- a/test/files/neg/t5663-badwarneq.check +++ b/test/files/neg/t5663-badwarneq.check @@ -25,6 +25,9 @@ t5663-badwarneq.scala:72: warning: ValueClass1 and Int are unrelated: they will t5663-badwarneq.scala:74: warning: comparing values of types Int and ValueClass1 using `==' will always yield false println(5 == new ValueClass1(5)) // bad ^ +t5663-badwarneq.scala:74: warning: Int and ValueClass1 are unrelated: they will never compare equal + println(5 == new ValueClass1(5)) // bad + ^ t5663-badwarneq.scala:78: warning: ValueClass2[String] and String are unrelated: they will never compare equal println(new ValueClass2("abc") == "abc") // bad ^ @@ -38,5 +41,5 @@ t5663-badwarneq.scala:82: warning: comparing values of types ValueClass3 and Int println(ValueClass3(5) == 5) // bad ^ error: No warnings can be incurred under -Xfatal-warnings. -13 warnings found +14 warnings found one error found diff --git a/test/files/neg/t6048.check b/test/files/neg/t6048.check index 5e11d24fde..f8eddf5471 100644 --- a/test/files/neg/t6048.check +++ b/test/files/neg/t6048.check @@ -10,6 +10,9 @@ t6048.scala:13: warning: patterns after a variable pattern cannot match (SLS 8.1 t6048.scala:14: warning: unreachable code due to variable pattern on line 13 case 5 if true => x // unreachable ^ +t6048.scala:14: warning: unreachable code + case 5 if true => x // unreachable + ^ error: No warnings can be incurred under -Xfatal-warnings. -four warnings found +5 warnings found one error found diff --git a/test/files/neg/t6120.check b/test/files/neg/t6120.check new file mode 100644 index 0000000000..a7d17e29cf --- /dev/null +++ b/test/files/neg/t6120.check @@ -0,0 +1,20 @@ +t6120.scala:5: warning: postfix operator bippy should be enabled +by making the implicit value scala.language.postfixOps visible. +This can be achieved by adding the import clause 'import scala.language.postfixOps' +or by setting the compiler option -language:postfixOps. +See the Scala docs for value scala.language.postfixOps for a discussion +why the feature should be explicitly enabled. + def f = null == null bippy + ^ +t6120.scala:5: warning: method bippy in class BooleanOps is deprecated: bobo + def f = null == null bippy + ^ +t6120.scala:5: warning: comparing values of types Null and Null using `==' will always yield true + def f = null == null bippy + ^ +t6120.scala:6: warning: method bippy in class BooleanOps is deprecated: bobo + def g = true.bippy + ^ +error: No warnings can be incurred under -Xfatal-warnings. +four warnings found +one error found diff --git a/test/files/neg/t6120.flags b/test/files/neg/t6120.flags new file mode 100644 index 0000000000..04d7c7d417 --- /dev/null +++ b/test/files/neg/t6120.flags @@ -0,0 +1 @@ +-feature -deprecation -Xfatal-warnings
\ No newline at end of file diff --git a/test/files/neg/t6120.scala b/test/files/neg/t6120.scala new file mode 100644 index 0000000000..425f09db47 --- /dev/null +++ b/test/files/neg/t6120.scala @@ -0,0 +1,7 @@ +class A { + implicit class BooleanOps(val b: Boolean) { + @deprecated("bobo", "2.11.0") def bippy() = 5 + } + def f = null == null bippy + def g = true.bippy +} diff --git a/test/files/neg/t7721.check b/test/files/neg/t7721.check index e056b9a293..ade1ca3b20 100644 --- a/test/files/neg/t7721.check +++ b/test/files/neg/t7721.check @@ -7,6 +7,9 @@ t7721.scala:15: warning: abstract type pattern A.this.Foo is unchecked since it t7721.scala:19: warning: abstract type pattern A.this.Foo is unchecked since it is eliminated by erasure case x: Foo with Bar => x.bippy + x.barry ^ +t7721.scala:19: warning: abstract type pattern A.this.Bar is unchecked since it is eliminated by erasure + case x: Foo with Bar => x.bippy + x.barry + ^ t7721.scala:39: warning: abstract type pattern B.this.Foo is unchecked since it is eliminated by erasure case x: Foo with Concrete => x.bippy + x.dingo + x.conco ^ @@ -16,6 +19,9 @@ t7721.scala:43: warning: abstract type pattern B.this.Foo is unchecked since it t7721.scala:47: warning: abstract type pattern B.this.Foo is unchecked since it is eliminated by erasure case x: Foo with Bar with Concrete => x.bippy + x.barry + x.dingo + x.conco + x.bongo ^ +t7721.scala:47: warning: abstract type pattern B.this.Bar is unchecked since it is eliminated by erasure + case x: Foo with Bar with Concrete => x.bippy + x.barry + x.dingo + x.conco + x.bongo + ^ error: No warnings can be incurred under -Xfatal-warnings. -6 warnings found +8 warnings found one error found diff --git a/test/files/neg/t7756b.check b/test/files/neg/t7756b.check index 2817a7e230..e764783241 100644 --- a/test/files/neg/t7756b.check +++ b/test/files/neg/t7756b.check @@ -1,6 +1,9 @@ t7756b.scala:3: warning: comparing values of types Int and String using `==' will always yield false case _ => 0 == "" ^ +t7756b.scala:3: warning: Int and String are unrelated: they will most likely never compare equal + case _ => 0 == "" + ^ error: No warnings can be incurred under -Xfatal-warnings. -one warning found +two warnings found one error found diff --git a/test/files/neg/unreachablechar.check b/test/files/neg/unreachablechar.check index 121f12a0c7..a621196c56 100644 --- a/test/files/neg/unreachablechar.check +++ b/test/files/neg/unreachablechar.check @@ -4,6 +4,9 @@ unreachablechar.scala:4: warning: patterns after a variable pattern cannot match unreachablechar.scala:5: warning: unreachable code due to variable pattern on line 4 case 'f' => println("not stuff?"); ^ +unreachablechar.scala:5: warning: unreachable code + case 'f' => println("not stuff?"); + ^ error: No warnings can be incurred under -Xfatal-warnings. -two warnings found +three warnings found one error found diff --git a/test/files/neg/warn-unused-privates.check b/test/files/neg/warn-unused-privates.check index 9c41a33e8f..d012869c93 100644 --- a/test/files/neg/warn-unused-privates.check +++ b/test/files/neg/warn-unused-privates.check @@ -16,6 +16,9 @@ warn-unused-privates.scala:35: warning: private val in class Boppy is never used warn-unused-privates.scala:42: warning: private var in trait Accessors is never used private var v1: Int = 0 // warn ^ +warn-unused-privates.scala:42: warning: private setter in trait Accessors is never used + private var v1: Int = 0 // warn + ^ warn-unused-privates.scala:43: warning: private setter in trait Accessors is never used private var v2: Int = 0 // warn, never set ^ @@ -59,5 +62,5 @@ warn-unused-privates.scala:102: warning: local type OtherThing is never used type OtherThing = String // warn ^ error: No warnings can be incurred under -Xfatal-warnings. -20 warnings found +21 warnings found one error found |