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
let [a, b, c] = fixed_array is called refutable; §9.7 compile-time length matching makes it irrefutable #1367
Spec §9.7: "For fixed-size arrays, the compiler performs compile-time length matching: [a, b, c] matches exactly 3 elements". The let destructuring example let [first, second, ..rest] = items is irrefutable when the array's length is known. The compiler calls every slice pattern refutable.
fn main:
let arr = [1, 2, 3]
let [a, b, c] = arr
print(f"{a} {b} {c}")
Actual: error: let ... else requires an else branch for refutable patterns.
Expected: prints 1 2 3. A length mismatch against a fixed array should be a compile error, not an else requirement.
Exact line: SemaCheck.pattern_is_refutable returns 1 for NK_PAT_SLICE whatever the subject type (it gets no type), and check_let_else calls it before the subject is known to be TY_ARRAY.
Workaround: let [a, b, c] = arr else: return (the else never runs).
Activity
Sema: a slice pattern that always matches a fixed-size array is irref…
Sema: a slice pattern that always matches a fixed-size array is irref…
ehartford commentedon Sep 26, 2026
Verified fixed on main 55739d4 (release binary): let [a, b, c] = arr accepted, prints 1 2 3.