Skip to content

Commit

Permalink
Raise error if function has duplicate argument names (#427)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkruselj authored Jan 9, 2024
1 parent bcfe186 commit f0d7319
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions compiler/ksp_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,10 @@ def modifyFunctionDef(self, node, parent_function = None, function_params = None
# as we visit the function definition, pass along information to nodes further down the tree of the function parameter names
params = function_params + node.parameters

# verify that there are no duplicate argument names in the function definition
if len(set(params)) < len(params):
raise ksp_ast.ParseException(node, "Function contains duplicate argument names!")

if node.return_value:
params.append(node.return_value.identifier)

Expand Down

0 comments on commit f0d7319

Please sign in to comment.