You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
codegen(wasm): a user fn named like a String builtin (e.g. trim) returning an array is refused as a ++ operand #853
architectureStructural/system-level shape and runtime behaviourbindingsABI, FFI, WASM, and cross-language interop surfacesbugSomething is broken or behaves incorrectlyenhancementNew capability or improvement to existing behaviourpriority:p2Normal - queue itscope:repoConfined to this repositorystatus:readyFully specified and ready to be picked up
A user function named like a String builtin, but returning an array, is wrongly refused as a ++ operand on core wasm. The failure is loud: compilation fails.
affinescript compile x.affine -o x.wasm fails with Code generation error; interp and Bun-ESM accept the program. Re-verified on main-based build 161eaaf.
Cause, found by the #836 work (PR #841): is_string_concat_operand in lib/codegen.ml recognises String-returning builtins by spelling alone (trim, to_lowercase, string_sub, …), without checking whether the program defines its own function of that name.
Fix: consult the user-binding check from PR #841 (user_binds), or the type channel, before treating a call as a String operand.
Problem: On core wasm, a user-defined function that shares a name with a String builtin (e.g. trim) but returns an array is rejected as a ++ operand, and affinescript compile fails with Code generation error. Interp and Bun-ESM accept the same program (verified on 161eaaf). The cause is that is_string_concat_operand in lib/codegen.ml matches builtins by name alone.
Expected:trim([1]) ++ [2] compiles to wasm as array concatenation and prints 2, the same as on interp and Bun-ESM.
architectureStructural/system-level shape and runtime behaviourbindingsABI, FFI, WASM, and cross-language interop surfacesbugSomething is broken or behaves incorrectlyenhancementNew capability or improvement to existing behaviourpriority:p2Normal - queue itscope:repoConfined to this repositorystatus:readyFully specified and ready to be picked up
Activity
whatproblem-ai commentedon Dec 1, 2026
Problem: On core wasm, a user-defined function that shares a name with a String builtin (e.g.
trim) but returns an array is rejected as a++operand, andaffinescript compilefails withCode generation error. Interp and Bun-ESM accept the same program (verified on161eaaf). The cause is thatis_string_concat_operandinlib/codegen.mlmatches builtins by name alone.Expected:
trim([1]) ++ [2]compiles to wasm as array concatenation and prints2, the same as on interp and Bun-ESM.Clarity: 94%. Clear enough to work on.
⌨️ Commands · 💬 Have feedback? Tell us · 🎯 New here? Add WhatProblem to your repo · 🔒 Privacy