From edbb39b81d6ea8163bad7c57d0289d40b608a059 Mon Sep 17 00:00:00 2001 From: yuyi Date: Fri, 21 Jan 2022 18:10:09 +0800 Subject: [PATCH] checker: correct error message of struct_decl() (#13240) --- vlib/v/checker/struct.v | 2 +- ...field_can_not_be_from_the_same_type_as_containing_struct.out | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vlib/v/checker/struct.v b/vlib/v/checker/struct.v index 42d158b435..779274d8bf 100644 --- a/vlib/v/checker/struct.v +++ b/vlib/v/checker/struct.v @@ -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) } } diff --git a/vlib/v/checker/tests/field_can_not_be_from_the_same_type_as_containing_struct.out b/vlib/v/checker/tests/field_can_not_be_from_the_same_type_as_containing_struct.out index 6058fd0263..26ceecc4f7 100644 --- a/vlib/v/checker/tests/field_can_not_be_from_the_same_type_as_containing_struct.out +++ b/vlib/v/checker/tests/field_can_not_be_from_the_same_type_as_containing_struct.out @@ -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{}