Closed
Conversation
|
This PR does not affect the produced WebAssembly code. |
crusso
reviewed
Jun 20, 2021
Co-authored-by: Claudio Russo <claudio@dfinity.org>
crusso
reviewed
Jun 21, 2021
crusso
reviewed
Jun 21, 2021
crusso
reviewed
Jun 21, 2021
crusso
reviewed
Jun 21, 2021
crusso
reviewed
Jun 21, 2021
| When a pattern check alternative has the potential to fail, then it becomes important to find out whether the whole `switch` expression can fail. If this can happen the execution of the program can trap for certain inputs, posing an operational threat. To this end, the compiler checks for the exhaustiveness of pattern matching by keeping track of the covered shape of the scrutinee. The compiler issues a warning for any non-covered scrutinees ({proglang} even constructs a helpful example of a scrutinee that is not matched). As by-product of the exhaustiveness check, warnings are also issued for dead alternatives. | ||
|
|
||
| In summary, pattern checking is a great tool for several use-cases and enables active assistance from the compiler to the programmer by pointing out which inputs are not exhaustively taken care of. The static compile-time nature of coverage checking reliably rules out runtime failures. | ||
| In summary, pattern checking is a great tool with several use-cases. By statically analyzing patterns, the compiler can assists the programmer by pointing out unhandled cases and unreachable code, both of which often indicate programmer error. The static compile-time nature of coverage checking reliably rules out runtime failures. |
Contributor
There was a problem hiding this comment.
Suggested change
| In summary, pattern checking is a great tool with several use-cases. By statically analyzing patterns, the compiler can assists the programmer by pointing out unhandled cases and unreachable code, both of which often indicate programmer error. The static compile-time nature of coverage checking reliably rules out runtime failures. | |
| In summary, pattern checking is a great tool with several use-cases. By statically analyzing patterns, the compiler can assists the programmer by pointing out unhandled cases and unreachable code, both of which often indicate programmer error. The static, compile-time nature of coverage checking reliably rules out runtime failures. |
crusso
reviewed
Jun 21, 2021
crusso
reviewed
Jun 21, 2021
crusso
approved these changes
Jun 21, 2021
Contributor
|
Incorporated into #2619 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.