checker: add type check in interface fields (#9527)
parent
c1d4074bc4
commit
999c385b7f
|
@ -362,7 +362,9 @@ pub fn (mut c Checker) interface_decl(decl ast.InterfaceDecl) {
|
||||||
}
|
}
|
||||||
for i, field in decl.fields {
|
for i, field in decl.fields {
|
||||||
c.check_valid_snake_case(field.name, 'field name', field.pos)
|
c.check_valid_snake_case(field.name, 'field name', field.pos)
|
||||||
|
if field.typ != table.Type(0) {
|
||||||
c.ensure_type_exists(field.typ, field.pos) or { return }
|
c.ensure_type_exists(field.typ, field.pos) or { return }
|
||||||
|
}
|
||||||
for j in 0 .. i {
|
for j in 0 .. i {
|
||||||
if field.name == decl.fields[j].name {
|
if field.name == decl.fields[j].name {
|
||||||
c.error('field name `$field.name` duplicate', field.pos)
|
c.error('field name `$field.name` duplicate', field.pos)
|
||||||
|
|
Loading…
Reference in New Issue