Warnings for pattern matching #6

merged 7 commits into from May 16, 2012


None yet
2 participants

ghost commented May 5, 2012

Add checks for useless patterns and non-exhaustive pattern lists in match and let expressions. Common.uniq should be fixed to work for lists of big_ints before this is accepted.

jetomit added some commits Apr 24, 2012

@jetomit jetomit First version of exhaustive pattern matching check 4d6047c
@jetomit jetomit Move exhaustive pattern check to a new module 0ec9580
@jetomit jetomit Simplify pattern constructor type
Function arity returns number of required subpatterns for each pattern
constructor in a uniform way.
@jetomit jetomit Implement is_irrefutable with check_pats
Also, clean up the find_constructors function.
@jetomit jetomit Improve comments and clean up code in check.ml 23850e1
@jetomit jetomit Add support for records in exhaustiveness checks
When a record pattern is encountered, it is normalized - all fields are
specified in the order of definition, with those fields missing from
the pattern set to wildcards. After that, the recursion proceeds the
same way as for tuple patterns.
@jetomit jetomit Find a counterexample for non-exhaustive matches
Note that exhaustiveness check is currently broken for most patterns
containing integers because Big_ints cannot be compared in Common.uniq.

@matijapretnar matijapretnar merged commit 6fa5fc9 into matijapretnar:master May 16, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment