Proceedings of the 2016 7th ACM SIGPLAN Symposium on Scala 2016
DOI: 10.1145/2998392.2998401
|View full text |Cite
|
Sign up to set email alerts
|

A generic algorithm for checking exhaustivity of pattern matching (short paper)

Abstract: Algebraic data types and pattern matching are key features of functional programming languages. Exhaustivity checking of pattern matching is a safety belt that defends against unmatched exceptions at runtime and boosts type safety. However, the presence of language features like inheritance, typecase, traits, GADTs, path-dependent types and union types makes the checking difficult and the algorithm complex. In this paper we propose a generic algorithm that decouples the checking algorithm from specific type th… Show more

Help me understand this report

Search citation statements

Order By: Relevance

Paper Sections

Select...
1

Citation Types

0
1
0

Year Published

2019
2019
2022
2022

Publication Types

Select...
2
1

Relationship

0
3

Authors

Journals

citations
Cited by 3 publications
(1 citation statement)
references
References 9 publications
0
1
0
Order By: Relevance
“…The Scala compiler checks for pattern matching exhaustivity to prevent runtime exceptions caused by missing cases. Exhaustivity checking uses static knowledge about the class hierarchy (such as the sealed and final annotations) to check that every value in the scrutinee type is covered by the pattern clauses [Liu 2016]. Non-exhaustive patterns are compiled with an additional "catch-all" case which throws a runtime exception.…”
Section: Pattern Matching Exhaustivitymentioning
confidence: 99%
“…The Scala compiler checks for pattern matching exhaustivity to prevent runtime exceptions caused by missing cases. Exhaustivity checking uses static knowledge about the class hierarchy (such as the sealed and final annotations) to check that every value in the scrutinee type is covered by the pattern clauses [Liu 2016]. Non-exhaustive patterns are compiled with an additional "catch-all" case which throws a runtime exception.…”
Section: Pattern Matching Exhaustivitymentioning
confidence: 99%