Skip to content

Compiler panic in typing pass: ICE in inferred_numerical_value() for non-numeric type #25451

@jubnzv

Description

@jubnzv

The compiler panics with an ICE in typing/expand.rs:361 when a numeric literal appears in a pattern position where the expected type is bool.

MRE:

module 0x0::M {
    public enum E has drop { W(bool) }
    fun f(e: E): u64 {
        match (e) { E::W(0) => 1 }
    }
}

Reproduce steps:

cd external-crates/move
cargo +nightly run --release -p move-compiler --bin move-check -- mre/mre_expand_inferred_num.move

Output:

thread '<unnamed>' panicked at crates/move-compiler/src/typing/expand.rs:361:14:
ICE inferred num failed Type_(Apply(Some(AbilitySet(...)), Builtin(Bool), []))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Expected behavior: a type error diagnostic ("expected bool, found integer literal").

Git commit: 1a27af4
Build: release
cargo 1.91.0-nightly (840b83a10 2025-07-30)
rustc 1.91.0-nightly (3672a55b7 2025-08-13)

Metadata

Metadata

Assignees

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