The compiler panics with called Option::unwrap() on a None value in src/sema/eval.rs (eval_const_rational) when a constant with a large scientific-notation exponent (e.g. 0e1000) is used in a rational arithmetic expression within a type context (such as an array dimension). eval_const_rational returns None for the oversized literal, and the caller in the subtract path unwraps the result.
MRE:
contract C {
uint public constant Y = 0e1000;
constructor(int[Y - .1] memory w) {}
}
Reproduce: save as mre.sol, run solang compile --target polkadot mre.sol.
Output:
thread 'main' panicked at src/sema/eval.rs:NNN:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Expected behavior: sema rejects the over-sized exponent or the non-integer array dimension with a proper diagnostic instead of panicking.
Reproduces on all targets (solana, polkadot, evm). Threshold is around exponent >= 1000; 0e100 compiles cleanly.
Git commit: 901bfb9
Build: release
rustc 1.96.0-nightly (562dee482 2026-03-21)
The compiler panics with
called Option::unwrap() on a None valueinsrc/sema/eval.rs(eval_const_rational) when a constant with a large scientific-notation exponent (e.g.0e1000) is used in a rational arithmetic expression within a type context (such as an array dimension).eval_const_rationalreturnsNonefor the oversized literal, and the caller in thesubtractpath unwraps the result.MRE:
Reproduce: save as
mre.sol, runsolang compile --target polkadot mre.sol.Output:
Expected behavior: sema rejects the over-sized exponent or the non-integer array dimension with a proper diagnostic instead of panicking.
Reproduces on all targets (
solana,polkadot,evm). Threshold is around exponent >= 1000;0e100compiles cleanly.Git commit: 901bfb9
Build: release
rustc 1.96.0-nightly (562dee482 2026-03-21)