bug icon indicating copy to clipboard operation
bug copied to clipboard

Scala 2.13.9 with -Wnonunit-statement and xml literals result in false positives

Open SimY4 opened this issue 3 years ago • 2 comments

Reproduction steps

Scala version: 2.13.9

class C {
  val xml = <xml><elem></elem></xml>
  
  def some = xml
}

Problem

Warning produced on line 2: unused value of type scala.xml.NodeBuffer (add : Unit to discard silently)

Expected: the code compiles without warning.

SimY4 avatar Sep 29 '22 22:09 SimY4

good catch, thanks! @som-snytt will likely want to take a look

SethTisue avatar Sep 29 '22 22:09 SethTisue

Thanks, I'll take a look. My umbrella ticket is https://github.com/scala/bug/issues/12653, but I'll follow up here.

I would not have thought to check XML -- in case there is another ticket for "things we never compile when we compile the compiler."

som-snytt avatar Sep 29 '22 23:09 som-snytt

@som-snytt I'm putting this on Backlog, but feel free to try to fix it for 2.13.11 anyway, if you're so inclined :-)

SethTisue avatar Feb 20 '23 20:02 SethTisue