fix bug with optional record fields

This commit is contained in:
Folkert 2020-09-07 14:13:22 +02:00
parent 46755973d6
commit 127dd06586
10 changed files with 202 additions and 162 deletions

View file

@ -705,17 +705,11 @@ fn unify_flat_type(
(EmptyRecord, EmptyRecord) => merge(subs, ctx, Structure(left.clone())),
(Record(fields, ext), EmptyRecord) if has_only_optional_fields(&mut fields.values()) => {
let mut outcome = unify_pool(subs, pool, *ext, ctx.second);
outcome.extend(merge(subs, ctx, Structure(FlatType::EmptyRecord)));
outcome
unify_pool(subs, pool, *ext, ctx.second)
}
(EmptyRecord, Record(fields, ext)) if has_only_optional_fields(&mut fields.values()) => {
let mut outcome = unify_pool(subs, pool, ctx.first, *ext);
outcome.extend(merge(subs, ctx, Structure(FlatType::EmptyRecord)));
outcome
unify_pool(subs, pool, ctx.first, *ext)
}
(Record(fields1, ext1), Record(fields2, ext2)) => {