Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test to avoid error with scala2_library_tasty #21327

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions tests/warn/nonunit-statement.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
-- [E176] Potential Issue Warning: tests/warn/nonunit-statement.scala:13:4 ---------------------------------------------
13 | improved // warn
| ^^^^^^^^
| unused value of type (improved : => scala.concurrent.Future[Int])
-- [E176] Potential Issue Warning: tests/warn/nonunit-statement.scala:20:4 ---------------------------------------------
20 | new E().toString // warn
| ^^^^^^^^^^^^^^^^
| unused value of type String
-- [E176] Potential Issue Warning: tests/warn/nonunit-statement.scala:26:2 ---------------------------------------------
26 | Future(42) // warn
| ^^^^^^^^^^
| unused value of type scala.concurrent.Future[Int]
-- [E176] Potential Issue Warning: tests/warn/nonunit-statement.scala:30:6 ---------------------------------------------
30 | copy() // warn
| ^^^^^^
| unused value of type K
-- [E176] Potential Issue Warning: tests/warn/nonunit-statement.scala:37:2 ---------------------------------------------
37 | 27 +: xs // warn
| ^^^^^^^^
| unused value of type List[Int]
-- [E129] Potential Issue Warning: tests/warn/nonunit-statement.scala:44:2 ---------------------------------------------
44 | null // warn for purity
| ^^^^
| A pure expression does nothing in statement position
|
| longer explanation available when compiling with `-explain`
-- [E175] Potential Issue Warning: tests/warn/nonunit-statement.scala:58:19 --------------------------------------------
58 | if (!isEmpty) f(a) // warn (if)
| ^^^^
| discarded non-Unit value of type U
-- [E175] Potential Issue Warning: tests/warn/nonunit-statement.scala:62:7 ---------------------------------------------
62 | f(a) // warn (if)
| ^^^^
| discarded non-Unit value of type Boolean
-- [E175] Potential Issue Warning: tests/warn/nonunit-statement.scala:73:25 --------------------------------------------
73 | if (!fellback) action(z) // warn (if)
| ^^^^^^^^^
| discarded non-Unit value of type U
-- [E176] Potential Issue Warning: tests/warn/nonunit-statement.scala:79:6 ---------------------------------------------
79 | g // warn block statement
| ^
| unused value of type (g : => Int)
-- [E175] Potential Issue Warning: tests/warn/nonunit-statement.scala:81:6 ---------------------------------------------
81 | g // warn (if)
| ^
| discarded non-Unit value of type (g : => Int)
-- [E176] Potential Issue Warning: tests/warn/nonunit-statement.scala:84:6 ---------------------------------------------
84 | g // warn
| ^
| unused value of type (g : => Int)
-- [E175] Potential Issue Warning: tests/warn/nonunit-statement.scala:86:6 ---------------------------------------------
86 | g // warn
| ^
| discarded non-Unit value of type (g : => Int)
-- [E176] Potential Issue Warning: tests/warn/nonunit-statement.scala:96:4 ---------------------------------------------
96 | if (b) { // warn, at least one branch looks interesting
| ^
| unused value of type Int
97 | println("true")
98 | i
99 | }
100 | else {
101 | println("false")
102 | j
103 | }
-- [E176] Potential Issue Warning: tests/warn/nonunit-statement.scala:116:4 --------------------------------------------
116 | set += a // warn because cannot know whether the `set` was supposed to be consumed or assigned
| ^^^^^^^^
| unused value of type scala.collection.mutable.LinkedHashSet[A]
-- [E175] Potential Issue Warning: tests/warn/nonunit-statement.scala:126:37 -------------------------------------------
126 | if (start.length != 0) jsb.append(start) // warn (value-discard)
| ^^^^^^^^^^^^^^^^^
| discarded non-Unit value of type StringBuilder
-- [E175] Potential Issue Warning: tests/warn/nonunit-statement.scala:132:18 -------------------------------------------
132 | jsb.append(it.next()) // warn (value-discard)
| ^^^^^^^^^^^^^^^^^^^^^
| discarded non-Unit value of type StringBuilder
-- [E175] Potential Issue Warning: tests/warn/nonunit-statement.scala:135:35 -------------------------------------------
135 | if (end.length != 0) jsb.append(end) // warn (value-discard)
| ^^^^^^^^^^^^^^^
| discarded non-Unit value of type StringBuilder
-- [E175] Potential Issue Warning: tests/warn/nonunit-statement.scala:141:14 -------------------------------------------
141 | b.append(it.next()) // warn (value-discard)
| ^^^^^^^^^^^^^^^^^^^
| discarded non-Unit value of type StringBuilder
-- [E175] Potential Issue Warning: tests/warn/nonunit-statement.scala:146:30 -------------------------------------------
146 | while (it.hasNext) it.next() // warn
| ^^^^^^^^^
| discarded non-Unit value of type String
6 changes: 3 additions & 3 deletions tests/warn/nonunit-statement.scala
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ class J {
class Variant {
var bs = ListBuffer.empty[Int]
val xs = ListBuffer.empty[Int]
private[this] val ys = ListBuffer.empty[Int]
private[this] var zs = ListBuffer.empty[Int]
private val ys = ListBuffer.empty[Int]
private var zs = ListBuffer.empty[Int]
def f(i: Int): Unit = {
bs.addOne(i)
xs.addOne(i)
Expand All @@ -175,7 +175,7 @@ final class ArrayOops[A](private val xs: Array[A]) extends AnyVal {
val bb = new ArrayBuilder.ofRef[Array[B]]()(ClassTag[Array[B]](aClass))
if (xs.length == 0) bb.result()
else {
def mkRowBuilder() = ArrayBuilder.make[B](ClassTag[B](aClass.getComponentType))
def mkRowBuilder() = ArrayBuilder.make[B](using ClassTag[B](aClass.getComponentType))
val bs = new ArrayOps(asArray(xs(0))).map((x: B) => mkRowBuilder())
for (xs <- other) {
var i = 0
Expand Down
Loading