feat[next]: Direct subscripting of variable-length tuples - #2838
Draft
tehrengruber wants to merge 1 commit into
Draft
feat[next]: Direct subscripting of variable-length tuples#2838tehrengruber wants to merge 1 commit into
tehrengruber wants to merge 1 commit into
Conversation
Allow indexing 'tuple[Field, ...]' parameters directly, e.g. 'tracers[0] * factor': the subscript type deduction accepts any literal index on a 'ts.VarArgType' and yields the element type. Extracted from #2833 pending a decision; likely to be skipped, since the field operator cannot be fully type checked at definition time (the tuple length is only known at call/compile time, so an out-of-range index only surfaces late, in 'unroll_map_tuple').
tehrengruber
force-pushed
the
vararg_subscript
branch
from
August 27, 2026 20:18
69f816b to
cba1047
Compare
tehrengruber
force-pushed
the
sf_n_tracer_support
branch
from
August 27, 2026 20:18
5b27cbe to
35bce19
Compare
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.
Allow indexing variable-length tuple parameters directly, e.g.
The subscript type deduction accepts any literal index on a
VarArgTypeand yields the element type; lowering and tests (test_tuple_vararg) included.Extracted from #2833 pending a decision on whether we want this at all.
Stacked on-top of: #2833
Concern (why this is likely to be skipped): subscripting a variable-length tuple is arguably an anti-pattern — the field operator cannot be fully verified/type checked at definition time, since the tuple length is only known at call/compile time. An out-of-range index therefore only surfaces late, in
unroll_map_tuple, instead of as a frontend diagnostic at the subscript.Disclaimer: This PR and its description were written largely with the help of AI. Code was not reviewed yet.