Closed azarzadavila closed 1 year ago
This is probably linked with #12252
collection.:+
has unapply
that returns Option[(C, A)]
for (init, last)
.
It is refutable. The question is whether to use "special knowledge" about this extractor when emitting warnings because it is so visible.
I wonder if there is a FAQ about Seq
-extraction.
Maybe they need irrefutable :+_!
...
Reproduction steps
Scala version: 2.13.10
Problem
At compilation with sbt, the following warning appears:
I would expect no warning as the matching should be complete having tested both the non-empty and empty Queue. I tested the execution with both
val x: Queue[Int] = Queue()
andval: Queue[Int] = Queue.empty[Int]
and both work fine.