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
Is your feature request related to a problem? Please describe.
The compiler (3.3.1) seems to be aware of exhaustivity of a union type argument:
scala>traitID|caseclassUserName(name: String) extendsID|caseclassPassword(hash: Int) extendsID// defined trait ID// defined case class UserName// defined case class Password
scala>defhelp(id: UserName|Password) = id match|caseUserName(name) => name
|// omitting the Password(hash) case on purpose1 warning found
-- [E029] PatternMatchExhaustivityWarning:-------------------------------------------------------------------------1|defhelp(id: UserName|Password) = id match| ^^
|match may not be exhaustive.
||It would fail on pattern case:Password(_)
|| longer explanation available when compiling with`-explain`defhelp(id: UserName|Password):String
But we don't get an exhaustive match option for them, like we do for enums or other matchable types:
Describe the solution you'd like
Would it be possible to get match (exhaustive) option there?
Is your feature request related to a problem? Please describe.
The compiler (3.3.1) seems to be aware of exhaustivity of a union type argument:
But we don't get an exhaustive match option for them, like we do for
![Screenshot from 2024-02-02 10-20-59](https://private-user-images.githubusercontent.com/4255997/301762718-2fcea11b-09a8-4aab-a706-d908e6a5812e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkxMjUxMTksIm5iZiI6MTcxOTEyNDgxOSwicGF0aCI6Ii80MjU1OTk3LzMwMTc2MjcxOC0yZmNlYTExYi0wOWE4LTRhYWItYTcwNi1kOTA4ZTZhNTgxMmUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYyMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MjNUMDY0MDE5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZGMyNzU0YTUwZjA5ZjIzZjViMWU2MDM1YjM0NWUxYTliMTQzZDZkNGMxMGY0NzlhYjlmZjhhM2NkMzFlMzc5NSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.Tg7EYY_EbkLMS_Xh7PXBdEOZFynY-stqz8B8vqJOCcg)
enum
s or other matchable types:Describe the solution you'd like
Would it be possible to get
match (exhaustive)
option there?Describe alternatives you've considered
(no alternatives)
Additional context
Might be relevant #317
Search terms
union types pattern matching exhaustivity
The text was updated successfully, but these errors were encountered: