checker: fix receiver pos for single letter type error message (#8393)

pull/8392/head
Uwe Krüger 2021-01-28 14:20:07 +01:00 committed by GitHub
parent 1a29719f16
commit 0afe36e153
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -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) {

View File

@ -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 |