summaryrefslogtreecommitdiff
path: root/tests/functions/test_lambda_arrow.zc
diff options
context:
space:
mode:
authorSAJJA EASWAR <eshwarsajja20@gmail.com>2026-01-25 22:59:36 +0530
committerSAJJA EASWAR <eshwarsajja20@gmail.com>2026-01-25 22:59:36 +0530
commitebc8b94baa6bc694cb4829e2eb2934a1f17fa6a1 (patch)
tree71b952ad455bf17d5bdea01472f0e2297f25eabe /tests/functions/test_lambda_arrow.zc
parent863118c95caac0d69a35f6ae4d2e83844734a8a1 (diff)
parent489336b2101bf16edeec7bfc4379408eb19b936e (diff)
Merge branch 'main' into pr-109
Diffstat (limited to 'tests/functions/test_lambda_arrow.zc')
-rw-r--r--tests/functions/test_lambda_arrow.zc18
1 files changed, 13 insertions, 5 deletions
diff --git a/tests/functions/test_lambda_arrow.zc b/tests/functions/test_lambda_arrow.zc
index c976ecf..b4c8edc 100644
--- a/tests/functions/test_lambda_arrow.zc
+++ b/tests/functions/test_lambda_arrow.zc
@@ -4,17 +4,25 @@ fn compute(op: fn(I32, I32) -> I32, a: I32, b: I32) -> I32 {
}
test "test_lambda_arrow" {
- var doubler = x -> x * 2;
- var res1 = doubler(5);
+ let doubler = x -> x * 2;
+ let res1 = doubler(5);
"doubler(5) = {res1}";
if res1 != 10 { exit(1); }
- var add = (x, y) -> x + y;
- var res2 = add(10, 20);
+ let add = (x, y) -> x + y;
+ let res2 = add(10, 20);
"add(10, 20) = {res2}";
if res2 != 30 { exit(1); }
- var res3 = compute((a, b) -> a * b, 3, 4);
+ let res3 = compute((a, b) -> a * b, 3, 4);
"compute((a, b) -> a * b, 3, 4) = {res3}";
if res3 != 12 { exit(1); }
}
+
+test "lambda_inference_repro" {
+ let dble = x -> x * 2.0;
+ let res = dble(9.0);
+ if res != 18.0 {
+ exit(1);
+ }
+}