Wnonunit-statement must specify match branch, etc
Reproduction steps
Warning on a large match, where one of the cases has an interesting result, doesn't show which case(s) is interesting.
Problem
It's not usable on matches of appreciable size.
Also, it reports "result type" but not the tree shape; that is, perhaps under verbose flag, show the tree.
Also it's not handling sb.append(x).append(y). I must have dreamt that.
Also p.asInstanceOf[T].m. Also p.synchronized.
Also nested unibranch if in result position.
That's from a pass over the code base.
Perhaps Scala 3 will do better once it has -Wnonunit-statement at all :-)
@SethTisue No, it has the same issue. (Or one of them.)
-- [E176] Potential Issue Warning: test/files/pos/t12653.scala:19:84 ---------------------------------------------------
19 | buf.append("symbol table = " + (if (syms.length == 0) "<empty>" else "")).append(EOL)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| unused value of type (buf : StringBuilder)
2 warnings found
So arguably it does better. Edit, no it's just failing to warn, such as:
test/files/pos/t12653.scala:25: warning: unused value of type C (add `: Unit` to discard silently)
def morely(): Unit = new C().more("hello").more(", ").more("world")