Handle missing fields diagnostics

This commit is contained in:
Shoyu Vanilla 2025-01-24 02:54:54 +09:00
parent 7de0b2e75a
commit e6a103ae50
11 changed files with 59 additions and 12 deletions

View file

@ -319,8 +319,9 @@ impl<'a> Ctx<'a> {
};
let visibility = self.lower_visibility(field);
let type_ref = TypeRef::from_ast_opt(body_ctx, field.ty());
let has_default = field.expr().is_some();
Field { name, type_ref, visibility }
Field { name, type_ref, visibility, has_default }
}
fn lower_tuple_field(
@ -332,7 +333,7 @@ impl<'a> Ctx<'a> {
let name = Name::new_tuple_field(idx);
let visibility = self.lower_visibility(field);
let type_ref = TypeRef::from_ast_opt(body_ctx, field.ty());
Field { name, type_ref, visibility }
Field { name, type_ref, visibility, has_default: false }
}
fn lower_union(&mut self, union: &ast::Union) -> Option<FileItemTreeId<Union>> {