diff --git a/python/run.n b/python/run.n index 2c1d7462..f18c25e1 100644 --- a/python/run.n +++ b/python/run.n @@ -4,6 +4,6 @@ let i: () -> () -> int = [] -> () -> int { } } -let ii: () -> int = i(()) +let ii: () -> int = i() print(ii()) \ No newline at end of file diff --git a/python/scope.py b/python/scope.py index 7d59b37e..762637e5 100644 --- a/python/scope.py +++ b/python/scope.py @@ -789,6 +789,8 @@ async def eval_expr(self, expr): elif expr.data == "function_callback" or expr.data == "function_callback_pipe": if expr.data == "function_callback": function, *arguments = expr.children[0].children + if len(arguments) == 0: + arguemnts.append(()) else: mainarg = expr.children[0] function, *arguments = expr.children[1].children @@ -796,6 +798,8 @@ async def eval_expr(self, expr): arg_values = [] for arg in arguments: arg_values.append(await self.eval_expr(arg)) + if len(arg_values) == 0: + arg_values = ["unit"] return await (await self.eval_expr(function)).run(arg_values) elif expr.data == "or_expression": left, _, right = expr.children @@ -1308,6 +1312,8 @@ def type_check_expr(self, expr): elif expr.data == "function_callback" or expr.data == "function_callback_pipe": if expr.data == "function_callback": function, *arguments = expr.children[0].children + if len(arguments) == 0: + arguments.append("unit") else: mainarg = expr.children[0] function, *arguments = expr.children[1].children