From 0afe36e15362122f2d80b0fa954d4cbaf3d0e8e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kr=C3=BCger?= <45282134+UweKrueger@users.noreply.github.com> Date: Thu, 28 Jan 2021 14:20:07 +0100 Subject: [PATCH] checker: fix receiver pos for single letter type error message (#8393) --- vlib/v/checker/checker.v | 2 +- vlib/v/checker/tests/receiver_unknown_type_single_letter.out | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index bf886293ef..8cd50f8b15 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -5287,7 +5287,7 @@ fn (mut c Checker) fn_decl(mut node ast.FnDecl) { } if sym.name.len == 1 { // One letter types are reserved for generics. - c.error('unknown type `$sym.name`', node.pos) + c.error('unknown type `$sym.name`', node.receiver_pos) return } // if sym.has_method(node.name) { diff --git a/vlib/v/checker/tests/receiver_unknown_type_single_letter.out b/vlib/v/checker/tests/receiver_unknown_type_single_letter.out index bd78937087..40e356eff7 100644 --- a/vlib/v/checker/tests/receiver_unknown_type_single_letter.out +++ b/vlib/v/checker/tests/receiver_unknown_type_single_letter.out @@ -1,3 +1,4 @@ vlib/v/checker/tests/receiver_unknown_type_single_letter.vv:1:5: error: unknown type `A` 1 | fn (p A) foo() {} | ~~~ + 2 |