Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exhaustive pattern matches on numeric values yield compiler warning #6928

Closed
teo-tsirpanis opened this issue Jun 2, 2019 · 0 comments · Fixed by #7445
Closed

Exhaustive pattern matches on numeric values yield compiler warning #6928

teo-tsirpanis opened this issue Jun 2, 2019 · 0 comments · Fixed by #7445
Labels
Milestone

Comments

@teo-tsirpanis
Copy link
Contributor

I created a function to compute the AES S-Box. This is its code:

    let sBox k =
        match k with
        | 0uy ->  0x63uy
        | 1uy ->  0x7cuy
        | 2uy ->  0x77uy
        | 3uy ->  0x7buy
       /// It lasts forever...
        | 251uy ->  0x0fuy
        | 252uy ->  0xb0uy
        | 253uy ->  0x54uy
        | 254uy ->  0xbbuy
        | 255uy ->  0x16uy

However, the compiler raises an "Incomplete pattern matches on this expression" warning, even though my code handles all 256 possible cases for the byte type.

Repro steps

Already covered.

Expected behavior

Code compiles successfuly without warnings.

Actual behavior

image

Known workarounds

Have a redundant wildcard case at the end of match statement.

@cartermp cartermp added this to the Backlog milestone Jun 3, 2019
gdziadkiewicz added a commit to gdziadkiewicz/fsharp that referenced this issue Aug 21, 2019
gdziadkiewicz added a commit to gdziadkiewicz/fsharp that referenced this issue Aug 21, 2019
…ase requirement and add check for complete match similar to the one executed for bool.
gdziadkiewicz added a commit to gdziadkiewicz/fsharp that referenced this issue Aug 24, 2019
gdziadkiewicz added a commit to gdziadkiewicz/fsharp that referenced this issue Aug 24, 2019
gdziadkiewicz added a commit to gdziadkiewicz/fsharp that referenced this issue Aug 25, 2019
cartermp pushed a commit that referenced this issue Aug 29, 2019
…d check for complete match. (#7445)

* #6928 - Removed SByte and Byte from default case requirement and added check for complete match.

* Upgrade new tests (#6928)
@cartermp cartermp modified the milestones: Backlog, 16.5 Jan 17, 2020
nosami pushed a commit to xamarin/visualfsharp that referenced this issue Feb 23, 2021
…d added check for complete match. (dotnet#7445)

* dotnet#6928 - Removed SByte and Byte from default case requirement and added check for complete match.

* Upgrade new tests (dotnet#6928)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants