You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
--Warning:--------------------------------------------------------------------5|valFooImpl(myInt) = someFoo
|^^^^^^^|pattern'stypeFooImpl is more specialized than the right hand side expression'stypeFoo||If the narrowing is intentional, this can be communicated by adding `: @unchecked` after the expression,
|which may result in a MatchError at runtime.
valmyInt:Int=23
Expectation
possibly be more sophisticated and accept when there is only one possible pattern?
The text was updated successfully, but these errors were encountered:
its quite rare to have real-life code that really only has one child of a sealed trait.
Perhaps. This strategy is useful to hide an implementation case class (that cannot be evolved binary-compatibly) behind a user-facing sealed trait. The codebase may internally prefer to operate on terms of the implementation class.
bishabosha
changed the title
only possible pattern of sealed trait considered refutable
extractor for only possible concrete class of sealed trait considered refutable
Oct 4, 2023
Compiler version
3.3.1
Minimized code
Output
Expectation
possibly be more sophisticated and accept when there is only one possible pattern?
The text was updated successfully, but these errors were encountered: