fix(0117): pointer-to-array indexing auto-derefs

A '*[N]T' receiver in an index expression reached LLVM emission with an
unresolved element type and tripped the panic sentinel — no read or
write spelling worked. ptrToArrayElem on Lowering recognises the shape;
the index READ path GEPs the pointee array through the pointer value
and loads the element; the write / compound-assign / lvalue /
addr-of-element paths and the expression typer resolve the element type
through the same helper (their GEP machinery already handled a pointer
base). Kept out of getElementType so slice paths don't half-accept a
raw pointer base.

Regression: examples/0176 (read, write, compound, element ptr + deref).
This commit is contained in:
agra
2026-06-11 12:15:45 +03:00
parent 57979ed8e6
commit 82d6b8da0e
9 changed files with 63 additions and 5 deletions

View File

@@ -1,5 +1,15 @@
# 0117 — indexing through a pointer-to-array panics at LLVM emission
> **RESOLVED** (2026-06-11). `ptrToArrayElem` on Lowering recognises the
> `*[N]T` receiver; the index READ path GEPs the pointee array through the
> pointer value and loads the element; the WRITE / compound-assign /
> lvalue / addr-of-element paths and the expression typer resolve the
> element type through the same helper (their GEP machinery already
> handled a pointer base). Postfix deref (`p.*`) was always the deref
> spelling — the issue's `(*p)[2]` note was a wrong-syntax red herring.
> Regression test: examples/0176-types-pointer-to-array-index.sx
> (read, write, compound, element pointer + deref).
**Symptom.** Indexing through a `*[N]T` pointer is neither lowered nor
diagnosed: the index expression reaches the LLVM emitter with the
`.unresolved` type sentinel and trips the panic tripwire.