Compiler version
3.3.1
Minimized code
sealed trait Foo
final case class FooImpl(x: Int) extends Foo
def someFoo: Foo = FooImpl(23)
val FooImpl(myInt) = someFoo
Output
-- Warning: --------------------------------------------------------------------
5 |val FooImpl(myInt) = someFoo
| ^^^^^^^
|pattern's type FooImpl is more specialized than the right hand side expression's type Foo
|
|If the narrowing is intentional, this can be communicated by adding `: @unchecked` after the expression,
|which may result in a MatchError at runtime.
val myInt: Int = 23
Expectation
possibly be more sophisticated and accept when there is only one possible pattern?