Skip to content

Commit 78f34e6

Browse files
committed
checker: vfmt fn.v
1 parent a20fff9 commit 78f34e6

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

examples/gg/drag_n_drop.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const text_size = 16
1010
struct App {
1111
mut:
1212
gg &gg.Context = unsafe { nil }
13-
dropped_file_list []string = []string{}
13+
dropped_file_list []string
1414
}
1515

1616
fn main() {

vlib/v/checker/fn.v

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1766,10 +1766,11 @@ fn (mut c Checker) fn_call(mut node ast.CallExpr, mut continue_check &bool) ast.
17661766
// bug with fn...
17671767
// fn f(p &Foo) => f(foo) -- do not allow this, force f(&foo)
17681768
// if !c.is_builtin_mod
1769-
if param.typ == ast.voidptr_type && func.language == .v
1769+
else if param.typ == ast.voidptr_type && func.language == .v
17701770
&& arg_typ !in [ast.voidptr_type, ast.nil_type] && arg_typ.nr_muls() == 0
17711771
&& func.name !in ['isnil', 'ptr_str'] && !func.name.starts_with('json.')
1772-
&& arg_typ_sym.kind !in [.float_literal, .int_literal] && !c.pref.backend.is_js() {
1772+
&& arg_typ_sym.kind !in [.float_literal, .int_literal, .charptr]
1773+
&& !c.pref.backend.is_js() {
17731774
c.warn('automatic ${arg_typ_sym.name} referencing/dereferencing into voidptr is deprecated and will be removed soon; use `foo(&x)` instead of `foo(x)`',
17741775
call_arg.pos)
17751776
}

0 commit comments

Comments
 (0)