diff --git a/src/compiler/parse_global.c b/src/compiler/parse_global.c index dbe6d910b..896bd8223 100644 --- a/src/compiler/parse_global.c +++ b/src/compiler/parse_global.c @@ -1736,6 +1736,12 @@ CHECK_ELLIPSIS: vec_add(params, param); if (!try_consume(c, TOKEN_COMMA)) break; } + if (tok_is(c, TOKEN_LBRACE) || tok_is(c, TOKEN_STAR) || tok_is(c, TOKEN_LBRACKET)) + { + PRINT_ERROR_LAST("Expected the name of a type here. ('%s' in a parameter list must follow a type).", token_type_to_string(c->tok)); + return false; + } + *params_ref = params; return true; } diff --git a/test/test_suite/functions/body_argument_fail.c3 b/test/test_suite/functions/body_argument_fail.c3 index 7af99bcf5..fa6ff2eab 100644 --- a/test/test_suite/functions/body_argument_fail.c3 +++ b/test/test_suite/functions/body_argument_fail.c3 @@ -2,4 +2,5 @@ fn void foo1(int... x;) {} // #error: Expected ')' fn void foo2(... x;) {} // #error: Expected ')' fn void foo3(... x;) {} // #error: Expected ')' fn void foo4(;) {} // #error: Expected ')' -fn void foo5(int x;) {} // #error: Expected ')' \ No newline at end of file +fn void foo5(int x;) {} // #error: Expected ')' +fn void foo6(string[] x) {} // #error: Expected the name of a type here. ('[' in a parameter list must follow a type) \ No newline at end of file