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
comptime: array literal passed to a &List parameter stays CV_ARRAY; .len() is refused in the evaluator #2760
Found while running a seed-driven gate without WITH set (2026-10-27): build actions fell back to the driver's comptime evaluator and c-migrator-basic-tests failed at build/selfhost.w:179 args.len() — "method 'len' is not comptime-evaluable yet" — reached through bs_check_migrate_d119_arrays -> bs_migrate_expect_success -> bs_run_cli_capture_cwd_with_env.
Root cause (exact lines, current main): ComptimeEval.eval_array (src/ComptimeEval.w:6620) always returns comptime_value_array (CV_ARRAY) whatever Sema typed the literal; nothing converts CV_ARRAY to CV_LIST at let binding (eval_let_binding) or call argument binding (eval_call bind_value clone). Method dispatch then routes CV_ARRAY to eval_array_view_method_call, which knows only first/last/rest. The native build runner masks this because build actions normally run compiled.
Minimal repro (fails identically on pinned seed nightly-20261025-local-1, installed, and stage1):
fn count(args: &List[str]) -> i32:
var n = 0
for i in 0..args.len():
n = n + 1
n
const N: i32 = count(["a", "b", "c"])
fn main:
print(N)
Expected: prints 3. Actual: error: method 'len' is not comptime-evaluable yet.
Fix direction: convert at the owner of the type fact — when Sema typed the literal (or the demanded parameter/binding type) as List[T], the evaluator value is CV_LIST (mirror eval_comprehension's std_generic_of check at src/ComptimeEval.w:7683), at eval_array or at argument/let binding. A regression fixture belongs in test/behavior (comptime array literal to List parameter).
Workaround in build code today: build the list with List.new() + push (the pattern neighboring cases in build/selfhost.w use).
Merged to main ae20d89 (#3248): a bracket literal at a List demand is a list to the compile-time evaluator (the site's demand, and the parameter's type at a call). lldb at ComptimeEval.eval_array showed type_id = 0 for the argument literal. Fixture test/behavior/behav_2760_comptime_list_literal_argument.w.
Activity
Issues batch A: #1021 #1022 #1023 #2760 #3057 #3060 #3086 #3113 #3114 (…
ehartford commentedon Nov 11, 2026
Merged to main ae20d89 (#3248): a bracket literal at a List demand is a list to the compile-time evaluator (the site's demand, and the parameter's type at a call). lldb at ComptimeEval.eval_array showed type_id = 0 for the argument literal. Fixture test/behavior/behav_2760_comptime_list_literal_argument.w.