pointer indexing lowering requires an identifier
Status: Open.
Reproducer
An annotated TIndexExpr accepts any expression whose type is a pointer, but
lowering rejects a computed pointer collection such as an explicit cast:
(index (cast raw <ptr i32>) row)
The error is COLLECTION_NOT_ARRAY. Assigning the cast to a temporary and
indexing the identifier works:
(var values <ptr i32>)
(= values (cast raw <ptr i32>))
(index values row)
Cause
TAstLowerer::LowerLValueAddress and the TIndexExpr lowering path require
index->Collection to be TIdentExpr, even after type annotation has accepted
the collection as a pointer.
workaround
emit typed temporary pointer variables before all pointer indexing
pointer indexing lowering requires an identifier
Status: Open.
Reproducer
An annotated
TIndexExpraccepts any expression whose type is a pointer, butlowering rejects a computed pointer collection such as an explicit cast:
The error is
COLLECTION_NOT_ARRAY. Assigning the cast to a temporary andindexing the identifier works:
Cause
TAstLowerer::LowerLValueAddressand theTIndexExprlowering path requireindex->Collectionto beTIdentExpr, even after type annotation has acceptedthe collection as a pointer.
workaround
emit typed temporary pointer variables before all pointer indexing