This commit is contained in:
blueloveTH 2026-02-05 11:20:11 +08:00
parent 82b4fff934
commit cbbe319520
2 changed files with 14 additions and 0 deletions

View File

@ -2301,6 +2301,9 @@ static Error* _compile_f_args(Compiler* self, FuncDecl* decl, bool is_lambda) {
int state = 0; // 0 for args, 1 for *args, 2 for k=v, 3 for **kwargs
Error* err;
do {
// allow trailing comma
if(!is_lambda && curr()->type == TK_RPAREN) break;
if(state >= 3) return SyntaxError(self, "**kwargs should be the last argument");
if(match(TK_MUL)) {
if(state < 1)

View File

@ -156,6 +156,17 @@ def f(a,
assert f(1, 2) == 3
# https://github.com/pocketpy/pocketpy/issues/458
def f(
x: int,
y: int,
):
return x + y
assert f(1, 2) == 3
# try:
# f(a=1)
# exit(1)