@@ -1543,8 +1543,11 @@ fn (mut c Checker) fn_call(mut node ast.CallExpr, mut continue_check &bool) ast.
15431543 }
15441544 }
15451545 arg_typ_sym := c.table.sym (arg_typ)
1546- if arg_typ_sym.kind == .none && param.typ.has_flag (.generic) && ! param.typ.has_flag (.option) {
1547- c.error ('cannot use `none` as generic argument' , call_arg.pos)
1546+ if param.typ.has_flag (.generic) {
1547+ if arg_typ_sym.kind == .none && ! param.typ.has_flag (.option) {
1548+ c.error ('cannot use `none` as generic argument' , call_arg.pos)
1549+ }
1550+ c.check_unresolved_generic_param (node, call_arg)
15481551 }
15491552 param_typ_sym := c.table.sym (param.typ)
15501553 if func.is_variadic && arg_typ.has_flag (.variadic) && args_len - 1 > i {
@@ -2573,6 +2576,7 @@ fn (mut c Checker) method_call(mut node ast.CallExpr, mut continue_check &bool)
25732576 }
25742577 }
25752578 if exp_arg_typ.has_flag (.generic) {
2579+ c.check_unresolved_generic_param (node, arg)
25762580 method_concrete_types := if method_generic_names_len == rec_concrete_types.len {
25772581 rec_concrete_types
25782582 } else {
@@ -2753,6 +2757,13 @@ fn (mut c Checker) handle_generic_lambda_arg(node &ast.CallExpr, mut lambda ast.
27532757 }
27542758}
27552759
2760+ fn (mut c Checker) check_unresolved_generic_param (node & ast.CallExpr, arg ast.CallArg) {
2761+ if node.raw_concrete_types.len == 0 && arg.expr is ast.ArrayInit
2762+ && arg.expr.typ == ast.void_type {
2763+ c.error ('cannot use empty array as generic argument' , arg.pos)
2764+ }
2765+ }
2766+
27562767fn (mut c Checker) spawn_expr (mut node ast.SpawnExpr) ast.Type {
27572768 ret_type := c.call_expr (mut node.call_expr)
27582769 if node.call_expr.or_block.kind != .absent {
0 commit comments