The compiler panics with internal error: entered unreachable code: This type cannot be encoded in src/codegen/encoding/mod.rs:1453 when an internal function reference is passed to abi.encode or abi.encodePacked. Sema only rejects mapping and recursive argument types for the variadic abi.encode* family, so Type::InternalFunction slips through to the encoder where it is explicitly listed as unreachable.
MRE:
contract Foo {
function f() public {
abi.encodePacked(f);
}
}
Reproduce: save as mre.sol, run solang compile --target polkadot mre.sol.
Output:
thread 'main' panicked at src/codegen/encoding/mod.rs:1453:36:
internal error: entered unreachable code: This type cannot be encoded
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Expected behavior: sema rejects internal function references in abi.encode* arguments with a proper diagnostic.
Also reproduces on --target evm and --target solana. abi.encode(f) triggers the symmetric panic at src/codegen/encoding/mod.rs:291.
Git commit: 901bfb9
Build: release
rustc 1.96.0-nightly (562dee482 2026-03-21)
The compiler panics with
internal error: entered unreachable code: This type cannot be encodedinsrc/codegen/encoding/mod.rs:1453when an internal function reference is passed toabi.encodeorabi.encodePacked. Sema only rejects mapping and recursive argument types for the variadicabi.encode*family, soType::InternalFunctionslips through to the encoder where it is explicitly listed as unreachable.MRE:
Reproduce: save as
mre.sol, runsolang compile --target polkadot mre.sol.Output:
Expected behavior:
semarejects internal function references inabi.encode*arguments with a proper diagnostic.Also reproduces on
--target evmand--target solana.abi.encode(f)triggers the symmetric panic atsrc/codegen/encoding/mod.rs:291.Git commit: 901bfb9
Build: release
rustc 1.96.0-nightly (562dee482 2026-03-21)