feat(lowering): support tuple element access via t.0 syntax - #10153
Conversation
9d86e35 to
b57a97e
Compare
18033fe to
5d78973
Compare
orizi
left a comment
There was a problem hiding this comment.
@orizi reviewed 2 files and all commit messages, and made 1 comment.
Reviewable status: 2 of 6 files reviewed, 1 unresolved discussion (waiting on TomerStarkware).
crates/cairo-lang-lowering/src/test_data/tuple line 131 at r1 (raw file):
//! > ========================================================================== //! > Test tuple index access - ref argument.
have a similar one - testing:
fn foo(ref t: (felt252, u8)) {
t.1 = 3;
}
Code quote:
//! > Test tuple index access - ref argument.
b57a97e to
18e7f93
Compare
5d78973 to
1bfc617
Compare
TomerStarkware
left a comment
There was a problem hiding this comment.
@TomerStarkware made 1 comment.
Reviewable status: 2 of 6 files reviewed, 1 unresolved discussion (waiting on orizi).
crates/cairo-lang-lowering/src/test_data/tuple line 131 at r1 (raw file):
Previously, orizi wrote…
have a similar one - testing:
fn foo(ref t: (felt252, u8)) { t.1 = 3; }
Done.
18e7f93 to
68342c1
Compare
1bfc617 to
628cab4
Compare
orizi
left a comment
There was a problem hiding this comment.
@orizi reviewed 4 files and all commit messages, made 1 comment, and resolved 1 discussion.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on TomerStarkware).
68342c1 to
43cf84b
Compare
628cab4 to
fd1b04c
Compare
orizi
left a comment
There was a problem hiding this comment.
@orizi reviewed 18 files and all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on TomerStarkware).
43cf84b to
9cb2c32
Compare
0770cbe to
4306e5f
Compare
orizi
left a comment
There was a problem hiding this comment.
@orizi reviewed 17 files and all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on TomerStarkware).
Adds positional tuple element access by index using dot notation (e.g. `t.0`,
`t.1`), resolved in the semantic model. Member access is generalized via a new
`MemberAccessKind` enum (`Struct{..}` | `Index{..}`) threaded through
`ExprMemberAccess`, `ExprVarMemberPath` and `usage::MemberPath`, so a member is
identified either by a struct member id or by a numeric tuple index.
The index must be a plain non-negative decimal literal (no base prefix or type
suffix); out-of-bounds and non-tuple accesses are reported. Lowering of tuple
index access is not yet implemented and currently reports an "Unsupported"
error; it will be added in a follow-up.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
4306e5f to
1a45667
Compare
orizi
left a comment
There was a problem hiding this comment.
@orizi reviewed 1 file and all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on TomerStarkware).
Implements the lowering half of
t.0tuple-index member access, stacked on top of #10111 (the semantic half).What
Generalizes the member-access lowering machinery from struct-only to any aggregate (struct or tuple):
concrete_struct_id-keyedScatteredwith aTypeId-keyed one, keyed byMemberAccessKindinstead ofMemberId.refs.rsthat handle both structs and tuples uniformly:aggregate_ty— the type an access reads a member of.aggregate_members— ordered(MemberAccessKind, member_ty)pairs of an aggregate.member_access_components— snapshot-wrapped member types + selected index.MemberAccessKind::Indexin member-access lowering, ref-binding, and struct deconstruct/reconstruct (previouslyunreachable!/Unsupported).Tests
test_data/tuplecases.tuple_test.cairo: index read, nested access, assignment, nested assignment,refarguments, and access through snapshots.Note
Stacked on #10111 — review/merge that first. The base will need to be retargeted to
mainonce #10111 lands.🤖 Generated with Claude Code