plum

#treesitter#compiler#wasm

git clone https://git.pyrossh.dev/plum

A statically typed, imperative programming language inspired by rust, python


d1c02f3 — Peter John 2026-11-03T21:55:51+05:30
codegen_tests: account for closure specialisation copies
plum-wasm-codegen/tests/codegen_tests.rs CHANGED
@@ -1167,15 +1167,17 @@ fun main() -> Int =
1167
1167
  maps
1168
1168
  );
1169
1169
  assert!(
1170
+ // `$c<N>` is closure specialisation's intended copy naming, not leftover generic mangling
1170
- !keys.iter().any(|k| k.contains('$')),
1171
+ !keys.iter().any(|k| k.replace("$c", "").contains('$')),
1171
1172
  "mangled names remain"
1172
1173
  );
1173
1174
 
1174
1175
  let src = format!(
1175
1176
  "{}{}\
1176
1177
  fun main() -> Int =
1178
+ f := |n| n + 1
1177
- a := mapList(Slice(1, 2), |n| n + 1)
1179
+ a := mapList(Slice(1, 2), f)
1178
- b := mapList(Slice(3), |n| n * 2)
1180
+ b := mapList(Slice(3), f)
1179
1181
  a.length() + b.length()
1180
1182
  ",
1181
1183
  STD_HEAD, LIST_FNS
@@ -1900,7 +1902,8 @@ fun main() -> Int =
1900
1902
  "{STD_HEAD}\
1901
1903
  fun main() -> Int =
1902
1904
  units := Slice(1, 2, 3, 4)
1905
+ keep := |u| u > 2
1903
- alive := retainList(units, |u| u > 2)
1906
+ alive := retainList(units, keep)
1904
1907
  alive.length()
1905
1908
  {LIST_FNS}"
1906
1909
  );