mirror of
https://github.com/paradigmxyz/solidity-lean.git
synced 2026-11-15 19:56:39 +00:00
A state-variable `.length` lowers to a HEADER read (`Expr.storage key`): for a dynamic array / bytes / string the slot value IS the length. But a fixed-size array has no length header slot, so the header read materialised the whole array (`Value.fixedArray`), which dead-ended in `typeMismatch` = Panic(0) when the scalar `.length` consumer coerced it (`uint256 r = a.length`). solc folds `T[N].length` to the compile-time constant N. Fix: header-mode reads route through the new `Runtime.loadStorageFieldHeader`, which yields the layout constant N for a `StorageLayout.fixedArray` and delegates to the ordinary field read for every other layout. Whole-fixed-array value reads (`ref`/`load` modes, not `header`) are unaffected. Witness: SolidCore/Witness/FixedStorageArrayLength.lean Co-authored-by: Lean Semantics Review Agent <agent@solidcore.local> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
100 lines
3.5 KiB
100 lines
3.5 KiB