feat: functions with formal parameters

This commit is contained in:
2025-05-04 15:21:44 +08:00
parent bc50464db9
commit eea4a4ce9f
6 changed files with 53 additions and 10 deletions

View File

@@ -173,4 +173,7 @@ fn test_func() {
test_expr("(x: x) 1", int!(1));
test_expr("(x: x) (x: x) 1", int!(1));
test_expr("(x: y: x + y) 1 1", int!(2));
test_expr("({ x, y }: x + y) { x = 1; y = 2; }", int!(3));
test_expr("({ x, y, ... }: x + y) { x = 1; y = 2; z = 3; }", int!(3));
test_expr("(inputs@{ x, y, ... }: x + inputs.y) { x = 1; y = 2; z = 3; }", int!(3));
}