Closed
Description
I tried adding the new unused flag (from #16157) to my work codebase and was surprised that it warned about unused private member when used with the http library http4s
s query parameter matching. A minimal reproducer independent of http4s is below.
Compiler version
With nightly: 3.3.0-RC1-bin-20230112-be10bc6-NIGHTLY
Minimized code
//> using scala "3.3.0-RC1-bin-20230112-be10bc6-NIGHTLY"
//> using option "-Wunused:all"
object myPackage:
private object IntExtractor:
def unapply(s: String): Option[Int] = s.toIntOption
def isInt(s: String) = s match {
case IntExtractor(i) => println(s"Number $i")
case _ => println("NaN")
}
myPackage.isInt("42")
Output
[warn] ./unused-extractor-object.sc:5:19: unused private member
[warn] private object IntExtractor:
[warn] ^^^^^^^^^^^^
Expectation
IntExtractor is used when matching against the string, so it should not warn about it being unused.