Repository navigation
D119 Amendment 1 (#2311): Vector[T, N] element-first + array-length generics - #2380
Merged
Merged
Conversation
…hs are generic parameters §4.3d (ruled 2026-10-12, #2376): Vector writes its element first like [T; N]; Mask[N, W] keeps its count first, as the ruling left it. The internal type (d0 lane, d1 count) is unchanged — every resolver, the frozen twins, the call-site binding walk, the declaration validator, and the printers (diagnostics, c_import, bundle interfaces) swap the two written arguments. The retired spelling with a literal count is refused by naming the order. One Lexer-accurate pass renamed the tree's 40 unambiguous sites in tests (plus hand fixes inside f-strings, which lex as one token); comments followed. Array-length generics by Vector's mechanism: [T; N] binds a generic N from the argument's array length in bind_type_params_from_type_expr (nested nodes bind [T; N, N] and [T; R, C], with a conflict diagnostic), as a TY_CONST_INT substitution. array_type_len and array_fill_count read that substitution per instantiation and keep the length node in d2 — each instance writes its own d1, the next re-reads d2; the frozen and substitution resolvers bind the same way. type_expr_mentions_type_param now counts a generic length as a mention: without it the expected-type probe resolved [i32; N] with N unbound (erroring and consuming the length node) before inference could bind it. A probe that resolves a generic length under a non-integer substitution (template probe, cascade suppression) is non-destructive and quiet — the one 'cannot infer' diagnostic owns the failure. Tests: behav_d119a1_vector_element_first (dot[N] over Vector[f32, N], aliases unchanged), behav_d119a1_array_length_generics (total[N], trace[N], transpose[R, C] incl. [0; C, R]), err fixtures for the retired spelling and a length conflict. A bracket literal still takes no generic array demand — pre-existing on main, filed as #2379.
…lling) The Amendment 1 comment sweep changed bytes in an ABI-defining source; the convention did not change, so the hash is re-recorded with no WITH_ABI_VERSION bump. Every .wo rebuilds once.
Contributor
Author
|
Gate GREEN on 975e66f (seed-driven |
Contributor
Author
|
Battery GREEN on stack top 975e66f (seed-driven, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements #2311 (D119 Amendment 1, ruled in #2376). Stack layer 2 on #2378.
Vector[T, N]— element first, like[T; N];Mask[N, W]keeps its count first as the ruling left it; aliases unchanged. The internal type (d0 lane, d1 count) does not move: resolvers, frozen twins, the binding walk, the decl validator, and every printer (diagnostics, c_import, bundle interface) swap the written arguments. The retired spelling with a literal count gets one diagnostic naming the order. Tree rename was one Lexer-accurate pass (40 sites) plus hand fixes inside f-strings; historical docs keep the old spelling as record.Array-length generics by Vector's mechanism:
[T; N]binds N from the argument's length as a TY_CONST_INT substitution ([T; N, N],[T; R, C]via nested nodes, conflict diagnosed); lengths resolve per instantiation from the retained length node in Sema, substitution, and frozen resolvers;[0; C, R]fills likewise. Two probe bugs fell out and are fixed at their roots:type_expr_mentions_type_paramignored array length nodes (so expected-type probes resolved[i32; N]unbound and consumed the length node before inference could bind it), andarray_type_lendestructively cleared that node under cascade-suppression probes.Fixtures:
behav_d119a1_vector_element_first,behav_d119a1_array_length_generics(total/trace/transpose),err_d119a1_vector_old_spelling,err_d119a1_array_length_conflict. Method generics and zero lengths verified by hand;audit:resolutionclean on the fixture. A bracket literal still takes no generic array demand — pre-existing on main, filed as #2379.Iterate evidence: stage1 runs all touched SIMD behavior files (13) and compile-error files (10) green; census --diff clean. Gate + one battery bless this stack top (487b12d).