fix problem with patterns and optional record fields

This commit is contained in:
Folkert 2020-11-09 01:04:40 +01:00
parent 099c56fcf6
commit 4868c0bd25
2 changed files with 10 additions and 3 deletions

View file

@ -1347,9 +1347,14 @@ fn to_pending_def<'a>(
body_expr,
} => {
if ann_pattern.value.equivalent(&body_pattern.value) {
// NOTE: Pick the body pattern, picking the annotation one is
// incorrect in the presence of optional record fields!
//
// { x, y } : { x : Int, y ? Bool }*
// { x, y ? False } = rec
Some(pending_typed_body(
env,
ann_pattern,
body_pattern,
ann_type,
body_expr,
var_store,