The compiler panics with unreachable!("List and Type Operator shall not appear in the CFG") in src/codegen/expression.rs:1237 when a type(T) expression (whose sema type is Type::Void, per src/sema/expression/retrieve_type.rs) is used as the condition of a ternary operator.
MRE:
contract C {
function f() public returns (int) {
return type(bool) ? 1 : 2;
}
}
Reproduce: save as mre.sol, run solang compile --target polkadot mre.sol.
Output:
thread 'main' panicked at src/codegen/expression.rs:1237:13:
internal error: entered unreachable code: List and Type Operator shall not appear in the CFG
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Expected behavior: sema rejects a type(T) expression used in a value position / boolean context with a proper diagnostic.
Reproduces on all four targets (solana, polkadot, evm, soroban). Related to but distinct from #1865 — a different sentinel variant (Expression::TypeOperator) reaches codegen from the same missing sema check.
Git commit: 901bfb9
Build: release
rustc 1.96.0-nightly (562dee482 2026-03-21)
The compiler panics with
unreachable!("List and Type Operator shall not appear in the CFG")insrc/codegen/expression.rs:1237when atype(T)expression (whose sema type isType::Void, persrc/sema/expression/retrieve_type.rs) is used as the condition of a ternary operator.MRE:
Reproduce: save as
mre.sol, runsolang compile --target polkadot mre.sol.Output:
Expected behavior: sema rejects a
type(T)expression used in a value position / boolean context with a proper diagnostic.Reproduces on all four targets (
solana,polkadot,evm,soroban). Related to but distinct from #1865 — a different sentinel variant (Expression::TypeOperator) reaches codegen from the same missing sema check.Git commit: 901bfb9
Build: release
rustc 1.96.0-nightly (562dee482 2026-03-21)