diff --git a/vlib/v/gen/fn.v b/vlib/v/gen/fn.v index 57508145c8..39ed634b39 100644 --- a/vlib/v/gen/fn.v +++ b/vlib/v/gen/fn.v @@ -239,7 +239,7 @@ fn (mut g Gen) fn_args(args []table.Param, is_variadic bool) ([]string, []string mut fargs := []string{} mut fargtypes := []string{} for i, arg in args { - caname := c_name(arg.name) + caname := if arg.name == '_' { g.new_tmp_var() } else { c_name(arg.name) } typ := g.unwrap_generic(arg.typ) arg_type_sym := g.table.get_type_symbol(typ) mut arg_type_name := g.typ(typ) // util.no_dots(arg_type_sym.name) diff --git a/vlib/v/tests/blank_ident_test.v b/vlib/v/tests/blank_ident_test.v index e2678b3811..2b98ac6053 100644 --- a/vlib/v/tests/blank_ident_test.v +++ b/vlib/v/tests/blank_ident_test.v @@ -10,6 +10,20 @@ fn test_fn_with_blank_param() { fn_with_blank_param(321) } +fn fn_with_multiple_blank_param(_ int, _ f32) { + _ = 'not an int nor a float' +} + +struct Abc {} + +fn (_ Abc) fn_with_multiple_blank_param(_ int, _ f32) {} + +fn test_fn_with_multiple_blank_param() { + fn_with_multiple_blank_param(1, 1.1) + a := Abc{} + a.fn_with_multiple_blank_param(1, 1.1) +} + fn test_for_in_range() { for _ in 1 .. 10 { assert true