Skip to content

Commit

Permalink
Remove deprecated advice
Browse files Browse the repository at this point in the history
  • Loading branch information
som-snytt committed Dec 21, 2023
1 parent 97c2515 commit dab82c6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1896,7 +1896,7 @@ abstract class RefChecks extends Transform {
}
case _ => t
}
def msg = s"unused value of type ${where.tpe} (add `: Unit` to discard silently)"
def msg = s"unused value of type ${where.tpe}"
refchecksWarning(where.pos, msg, WarningCategory.OtherPureStatement)
true
}
Expand Down
30 changes: 15 additions & 15 deletions test/files/neg/nonunit-if.check
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,52 @@ nonunit-if.scala:58: warning: discarded non-Unit value of type U
nonunit-if.scala:62: warning: discarded non-Unit value of type Boolean
f(a) // warn, check is on
^
nonunit-if.scala:13: warning: unused value of type scala.concurrent.Future[Int] (add `: Unit` to discard silently)
nonunit-if.scala:13: warning: unused value of type scala.concurrent.Future[Int]
improved // warn
^
nonunit-if.scala:20: warning: unused value of type String (add `: Unit` to discard silently)
nonunit-if.scala:20: warning: unused value of type String
new E().toString // warn
^
nonunit-if.scala:26: warning: unused value of type scala.concurrent.Future[Int] (add `: Unit` to discard silently)
nonunit-if.scala:26: warning: unused value of type scala.concurrent.Future[Int]
Future(42) // warn
^
nonunit-if.scala:30: warning: unused value of type K (add `: Unit` to discard silently)
nonunit-if.scala:30: warning: unused value of type K
copy() // warn
^
nonunit-if.scala:37: warning: unused value of type List[Int] (add `: Unit` to discard silently)
nonunit-if.scala:37: warning: unused value of type List[Int]
27 +: xs // warn
^
nonunit-if.scala:44: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
null // warn for purity
^
nonunit-if.scala:58: warning: unused value of type U (add `: Unit` to discard silently)
nonunit-if.scala:58: warning: unused value of type U
if (!isEmpty) f(a) // warn, check is on
^
nonunit-if.scala:62: warning: unused value of type Boolean (add `: Unit` to discard silently)
nonunit-if.scala:62: warning: unused value of type Boolean
f(a) // warn, check is on
^
nonunit-if.scala:73: warning: unused value of type U (add `: Unit` to discard silently)
nonunit-if.scala:73: warning: unused value of type U
if (!fellback) action(z) // warn, check is on
^
nonunit-if.scala:81: warning: unused value of type Int (add `: Unit` to discard silently)
nonunit-if.scala:81: warning: unused value of type Int
g // warn, check is on
^
nonunit-if.scala:79: warning: unused value of type Int (add `: Unit` to discard silently)
nonunit-if.scala:79: warning: unused value of type Int
g // warn block statement
^
nonunit-if.scala:86: warning: unused value of type Int (add `: Unit` to discard silently)
nonunit-if.scala:86: warning: unused value of type Int
g // warn
^
nonunit-if.scala:84: warning: unused value of type Int (add `: Unit` to discard silently)
nonunit-if.scala:84: warning: unused value of type Int
g // warn
^
nonunit-if.scala:96: warning: unused value of type Int (add `: Unit` to discard silently)
nonunit-if.scala:96: warning: unused value of type Int
if (b) { // warn, at least one branch looks interesting
^
nonunit-if.scala:116: warning: unused value of type scala.collection.mutable.LinkedHashSet[A] (add `: Unit` to discard silently)
nonunit-if.scala:116: warning: unused value of type scala.collection.mutable.LinkedHashSet[A]
set += a // warn because cannot know whether the `set` was supposed to be consumed or assigned
^
nonunit-if.scala:146: warning: unused value of type String (add `: Unit` to discard silently)
nonunit-if.scala:146: warning: unused value of type String
while (it.hasNext) it.next() // warn
^
error: No warnings can be incurred under -Werror.
Expand Down
22 changes: 11 additions & 11 deletions test/files/neg/nonunit-statement.check
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
nonunit-statement.scala:13: warning: unused value of type scala.concurrent.Future[Int] (add `: Unit` to discard silently)
nonunit-statement.scala:13: warning: unused value of type scala.concurrent.Future[Int]
improved // warn
^
nonunit-statement.scala:20: warning: unused value of type String (add `: Unit` to discard silently)
nonunit-statement.scala:20: warning: unused value of type String
new E().toString // warn
^
nonunit-statement.scala:26: warning: unused value of type scala.concurrent.Future[Int] (add `: Unit` to discard silently)
nonunit-statement.scala:26: warning: unused value of type scala.concurrent.Future[Int]
Future(42) // warn
^
nonunit-statement.scala:30: warning: unused value of type K (add `: Unit` to discard silently)
nonunit-statement.scala:30: warning: unused value of type K
copy() // warn
^
nonunit-statement.scala:37: warning: unused value of type List[Int] (add `: Unit` to discard silently)
nonunit-statement.scala:37: warning: unused value of type List[Int]
27 +: xs // warn
^
nonunit-statement.scala:44: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
null // warn for purity
^
nonunit-statement.scala:79: warning: unused value of type Int (add `: Unit` to discard silently)
nonunit-statement.scala:79: warning: unused value of type Int
g // warn block statement
^
nonunit-statement.scala:86: warning: unused value of type Int (add `: Unit` to discard silently)
nonunit-statement.scala:86: warning: unused value of type Int
g // warn
^
nonunit-statement.scala:84: warning: unused value of type Int (add `: Unit` to discard silently)
nonunit-statement.scala:84: warning: unused value of type Int
g // warn
^
nonunit-statement.scala:96: warning: unused value of type Int (add `: Unit` to discard silently)
nonunit-statement.scala:96: warning: unused value of type Int
if (b) { // warn, at least one branch looks interesting
^
nonunit-statement.scala:116: warning: unused value of type scala.collection.mutable.LinkedHashSet[A] (add `: Unit` to discard silently)
nonunit-statement.scala:116: warning: unused value of type scala.collection.mutable.LinkedHashSet[A]
set += a // warn because cannot know whether the `set` was supposed to be consumed or assigned
^
nonunit-statement.scala:146: warning: unused value of type String (add `: Unit` to discard silently)
nonunit-statement.scala:146: warning: unused value of type String
while (it.hasNext) it.next() // warn
^
error: No warnings can be incurred under -Werror.
Expand Down

0 comments on commit dab82c6

Please sign in to comment.