Skip to content

Compiler panic in sema: unreachable! in is_fixed_reference_type on Type::Value when comparing an array-literal subscript of msg.value #1882

@jubnzv

Description

@jubnzv

The compiler panics with internal error: entered unreachable code: Value in src/sema/types.rs:1427 (Type::is_fixed_reference_type's catch-all arm) when msg.value is placed inside an array literal and subscripted ([msg.value][0]), then used in a comparison.

MRE:

contract C {
    function f() public payable returns (bool) {
        return [msg.value][0] <= 0;
    }
}

Reproduce: save as mre.sol, run solang compile --target polkadot mre.sol.

Output:

thread 'main' panicked at src/sema/types.rs:1427:18:
internal error: entered unreachable code: Value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Expected behavior: the array-literal subscript coerces Type::Value to its underlying integer type (as bare msg.value does), or is_fixed_reference_type handles Type::Value (returning false).

Reproduces on all targets (polkadot, solana, evm).

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