Skip to content

Compiler panic in codegen: Expression does not have a type when abi.encodePacked receives a void-returning call #1878

@jubnzv

Description

@jubnzv

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions