mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: c2v array fix (#14426)
This commit is contained in:
parent
32dd801201
commit
bc397bb0e1
@ -958,6 +958,9 @@ pub fn (mut c Checker) fn_call(mut node ast.CallExpr, mut continue_check &bool)
|
|||||||
if param.typ == ast.voidptr_type_idx || arg_typ == ast.voidptr_type_idx {
|
if param.typ == ast.voidptr_type_idx || arg_typ == ast.voidptr_type_idx {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if param.typ.is_any_kind_of_pointer() && arg_typ.is_any_kind_of_pointer() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
param_typ_sym_ := c.table.sym(c.table.unaliased_type(param.typ))
|
param_typ_sym_ := c.table.sym(c.table.unaliased_type(param.typ))
|
||||||
arg_typ_sym_ := c.table.sym(c.table.unaliased_type(arg_typ))
|
arg_typ_sym_ := c.table.sym(c.table.unaliased_type(arg_typ))
|
||||||
// Allow `[32]i8` as `&i8` etc
|
// Allow `[32]i8` as `&i8` etc
|
||||||
@ -968,6 +971,17 @@ pub fn (mut c Checker) fn_call(mut node ast.CallExpr, mut continue_check &bool)
|
|||||||
&& (typ_is_number || c.table.unaliased_type(arg_typ).is_any_kind_of_pointer())) {
|
&& (typ_is_number || c.table.unaliased_type(arg_typ).is_any_kind_of_pointer())) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
// Allow `[N]anyptr` as `[N]anyptr`
|
||||||
|
if arg_typ_sym_.kind == .array && param_typ_sym_.kind == .array {
|
||||||
|
if (arg_typ_sym_.info as ast.Array).elem_type.is_any_kind_of_pointer()
|
||||||
|
&& (param_typ_sym_.info as ast.Array).elem_type.is_any_kind_of_pointer() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
} else if arg_typ_sym_.kind == .array_fixed && param_typ_sym_.kind == .array_fixed {
|
||||||
|
if (arg_typ_sym_.info as ast.ArrayFixed).elem_type.is_any_kind_of_pointer()&& (param_typ_sym_.info as ast.ArrayFixed).elem_type.is_any_kind_of_pointer() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
// Allow `int` as `&i8`
|
// Allow `int` as `&i8`
|
||||||
if param.typ.is_any_kind_of_pointer() && typ_is_number {
|
if param.typ.is_any_kind_of_pointer() && typ_is_number {
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user