1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

checker: correct error message of struct_decl() (#13240)

This commit is contained in:
yuyi 2022-01-21 18:10:09 +08:00 committed by GitHub
parent 295156e054
commit edbb39b81d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -51,7 +51,7 @@ pub fn (mut c Checker) struct_decl(mut node ast.StructDecl) {
if field.typ != 0 {
if !field.typ.is_ptr() {
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)
}
}

View File

@ -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 {
4 | pfield &Foo = 0
5 | field Foo = Bar{}