What happened
as title
What you expected
Got invalid value
Minimal reproduction
// Minimal reproduction for Perry Map spread operator bug
// The spread operator [...map] produces incorrect results when values are undefined
const map = new Map();
map.set(-4398046512128, undefined);
const spread = [...map];
const arrayFrom = Array.from(map);
console.log("spread length:", spread.length);
console.log("arrayFrom length:", arrayFrom.length);
// In standard JS, both should be equal
console.log("spread[0]:", spread[0]);
console.log("arrayFrom[0]:", arrayFrom[0]);
// This is the actual bug: spread[0] is not an array [key, value]
if (Array.isArray(spread[0])) {
console.log("spread[0][0]:", spread[0][0]);
console.log("spread[0][1]:", spread[0][1]);
console.log("PASS: spread works correctly");
} else {
console.log("FAIL: spread[0] is not an array, got:", typeof spread[0], spread[0]);
}
// Verify Array.from works correctly
if (Array.isArray(arrayFrom[0]) && arrayFrom[0][0] === -4398046512128 && arrayFrom[0][1] === undefined) {
console.log("PASS: Array.from works correctly");
} else {
console.log("FAIL: Array.from also broken");
}
Command you ran:
# e.g. perry compile main.ts -o app --target ios-simulator
Environment
- Perry version: 0.5.619
- Host OS: ArchLinux
- Target: native
- Rust toolchain (if building from source):
- Installed via:
Diagnostic output
Perry Doctor
Environment Checks
──────────────────
✓ perry version: 0.5.619
✓ update status: up to date
✓ clang (LLVM codegen): clang version 22.1.3
✓ system linker (cc): cc (GCC) 16.1.1 20260430
✓ runtime library: target/release/libperry_runtime.a
⚠ project config (perry.toml): not found - run: perry init
All critical checks passed with some warnings.
Anything else
What happened
as title
What you expected
Got invalid value
Minimal reproduction
Command you ran:
# e.g. perry compile main.ts -o app --target ios-simulatorEnvironment
Diagnostic output
Anything else