This commit is contained in:
Felipe Pena 2025-08-16 10:02:56 -03:00
parent a897e98da4
commit 3fd4e71d21

View file

@ -1546,7 +1546,7 @@ fn (mut c Checker) fn_call(mut node ast.CallExpr, mut continue_check &bool) ast.
if arg_typ_sym.kind == .none && param.typ.has_flag(.generic) && !param.typ.has_flag(.option) {
c.error('cannot use `none` as generic argument', call_arg.pos)
} else if param.typ.has_flag(.generic) && call_arg.expr is ast.ArrayInit
&& call_arg.expr.exprs.len == 0 {
&& call_arg.expr.typ == ast.void_type {
c.error('cannot use empty array as generic argument', call_arg.pos)
}
param_typ_sym := c.table.sym(param.typ)
@ -2576,7 +2576,7 @@ fn (mut c Checker) method_call(mut node ast.CallExpr, mut continue_check &bool)
}
}
if exp_arg_typ.has_flag(.generic) {
if arg.expr is ast.ArrayInit && arg.expr.exprs.len == 0 {
if arg.expr is ast.ArrayInit && arg.expr.typ == ast.void_type {
c.error('cannot use empty array as generic argument', arg.pos)
}
method_concrete_types := if method_generic_names_len == rec_concrete_types.len {