Skip to content

pointer indexing lowering requires an identifier #41

Description

@resetius

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions