checker: correct error message of struct_decl() (#13240)
parent
295156e054
commit
edbb39b81d
|
@ -51,7 +51,7 @@ pub fn (mut c Checker) struct_decl(mut node ast.StructDecl) {
|
||||||
if field.typ != 0 {
|
if field.typ != 0 {
|
||||||
if !field.typ.is_ptr() {
|
if !field.typ.is_ptr() {
|
||||||
if c.table.unaliased_type(field.typ) == struct_typ_idx {
|
if c.table.unaliased_type(field.typ) == struct_typ_idx {
|
||||||
c.error('Field `$field.name` is part of `$node.name`, they can not both have the same type',
|
c.error('field `$field.name` is part of `$node.name`, they can not both have the same type',
|
||||||
field.type_pos)
|
field.type_pos)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
vlib/v/checker/tests/field_can_not_be_from_the_same_type_as_containing_struct.vv:5:9: error: Field `field` is part of `Bar`, they can not both have the same type
|
vlib/v/checker/tests/field_can_not_be_from_the_same_type_as_containing_struct.vv:5:9: error: field `field` is part of `Bar`, they can not both have the same type
|
||||||
3 | struct Bar {
|
3 | struct Bar {
|
||||||
4 | pfield &Foo = 0
|
4 | pfield &Foo = 0
|
||||||
5 | field Foo = Bar{}
|
5 | field Foo = Bar{}
|
||||||
|
|
Loading…
Reference in New Issue