solidity-lean/SolidCore/Witness/StringConcatCallVarDecl.lean
Daniel Robinson 4653654415
fix(lowering): string.concat/bytes.concat var-decl init nesting a call -> Panic(0) (solc succeeds) (#45)
A `bytes.concat`/`string.concat` variable-declaration initializer whose
argument nests a value-returning call (e.g.
`string memory s = string.concat("a", f());`) was over-/mis-lowered: the
var-decl list handler special-cased only `abi.*` for the
`argPositionHoistPrefix?` nested-call peel (#174) and routed concat to
`generic`, whose env-less concat lowering cannot lower a nested internal
call. The engine reverted Panic(0) (typeMismatch in the concat) where
solc+EVM runs to completion. The same concat in RETURN position, and a
manually pre-hoisted equivalent, already lowered correctly.

Fix: extend the abi-hoist arm to also cover the four concat heads so the
strictly-nested call is peeled into ordered sibling temps exactly as the
abi.encode case, then the residual concat re-lowers cleanly.

Witness: SolidCore.Witness.StringConcatCallVarDecl (run/runFirst now return
w:6, storage slot 0 == 4; return-position and manual-hoist variants stay green).

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-25 02:57:09 -04:00

181 lines
7.9 KiB