The compiler panics with internal error: entered unreachable code: Expression does not have a type in src/codegen/mod.rs:992 (the Expression::Poison => unreachable!(...) arm of RetrieveType::ty) when a void-returning call (require(...), a user-defined function g() public {}, etc.) is passed as an argument to abi.encodePacked / abi.encode.
MRE:
contract C {
function f() public {
abi.encodePacked(require(true));
}
}
Reproduce: save as mre.sol, run solang compile --target polkadot mre.sol.
Output:
thread 'main' panicked at src/codegen/mod.rs:992:51:
internal error: entered unreachable code: Expression does not have a type
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Expected behavior: sema rejects passing a void-typed expression as an argument to the variadic abi.encode* family with a proper diagnostic.
Reproduces on solana, polkadot, evm. Also triggered by user-defined void functions (abi.encodePacked(g()) where function g() public {}). Same root cause as #1865, but a distinct panic site reached via the encoder rather than constant-folding.
Git commit: 901bfb9
Build: release
rustc 1.96.0-nightly (562dee482 2026-03-21)
The compiler panics with
internal error: entered unreachable code: Expression does not have a typeinsrc/codegen/mod.rs:992(theExpression::Poison => unreachable!(...)arm ofRetrieveType::ty) when a void-returning call (require(...), a user-definedfunction g() public {}, etc.) is passed as an argument toabi.encodePacked/abi.encode.MRE:
Reproduce: save as
mre.sol, runsolang compile --target polkadot mre.sol.Output:
Expected behavior: sema rejects passing a void-typed expression as an argument to the variadic
abi.encode*family with a proper diagnostic.Reproduces on
solana,polkadot,evm. Also triggered by user-defined void functions (abi.encodePacked(g())wherefunction g() public {}). Same root cause as #1865, but a distinct panic site reached via the encoder rather than constant-folding.Git commit: 901bfb9
Build: release
rustc 1.96.0-nightly (562dee482 2026-03-21)