From 985fe85de2974745e4a2c3205c3023889216f071 Mon Sep 17 00:00:00 2001 From: yuyi Date: Sun, 29 Aug 2021 17:08:57 +0800 Subject: [PATCH] checker: show concretes type name in error message (#11333) --- vlib/v/checker/checker.v | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index cac3a24fb3..eb83fa798b 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -3524,7 +3524,8 @@ pub fn (mut c Checker) selector_expr(mut node ast.SelectorExpr) ast.Type { } if has_field { if sym.mod != c.mod && !field.is_pub && sym.language != .c { - c.error('field `${sym.name}.$field_name` is not public', node.pos) + unwrapped_sym := c.table.get_type_symbol(c.unwrap_generic(typ)) + c.error('field `${unwrapped_sym.name}.$field_name` is not public', node.pos) } field_sym := c.table.get_type_symbol(field.typ) if field_sym.kind in [.sum_type, .interface_] { @@ -3539,7 +3540,8 @@ pub fn (mut c Checker) selector_expr(mut node ast.SelectorExpr) ast.Type { } if sym.kind !in [.struct_, .aggregate, .interface_, .sum_type] { if sym.kind != .placeholder { - c.error('`$sym.name` has no property `$node.field_name`', node.pos) + unwrapped_sym := c.table.get_type_symbol(c.unwrap_generic(typ)) + c.error('`$unwrapped_sym.name` has no property `$node.field_name`', node.pos) } } else { if sym.info is ast.Struct {