mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: include built-in pointer types when checking fn expects non reference. closes #7133
This commit is contained in:
parent
44b9ea4a75
commit
8931d3d39c
@ -1910,7 +1910,8 @@ pub fn (mut c Checker) return_stmt(mut return_stmt ast.Return) {
|
||||
c.error('cannot use `$got_typ_sym.name` as type `$exp_typ_sym.name` in return argument',
|
||||
pos)
|
||||
}
|
||||
if got_typ.is_ptr() && !exp_type.is_ptr() {
|
||||
if (got_typ.is_ptr() || got_typ.is_pointer()) &&
|
||||
(!exp_type.is_ptr() && !exp_type.is_pointer()) {
|
||||
pos := return_stmt.exprs[i].position()
|
||||
c.error('fn `$c.cur_fn.name` expects you to return a non reference type `${c.table.type_to_str(exp_type)}`, but you are returning `${c.table.type_to_str(got_typ)}` instead',
|
||||
pos)
|
||||
|
Loading…
Reference in New Issue
Block a user