Closed Daenyth closed 2 years ago
Warns since 2.13.4. https://github.com/scala/scala/releases/tag/v2.13.4
Alias is not pertinent?
Behavior is as expected and documented.
for custom extractors: demarking irrefutable extractors as such, by defining the return type as Some
(where "demarking" is a Britishism for "marking"?) (I guess a return type is a kind of demarcation.)
The part of this that confuses me is that Foo.unapply
returns Option
, not Some
, so you can't invoke it and have the return type of Bar.unapply
be Some
Scala 3 is simpler for this case. I don't know why Scala 2 doesn't emit Some
for case unapply.
Reproduction steps
Scala version: 2.13.10
Scastie
Problem
The
x match
line emits a "non-exhaustive match" warning.The code previously worked in 2.12
Workaround
Define
unapply
to returnSome((bar.a, bar.b))
explicitly