This commit is contained in:
Folkert 2020-09-06 18:53:26 +02:00
parent ceb938c9af
commit 46755973d6
8 changed files with 59 additions and 13 deletions

View file

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