Wave icon indicating copy to clipboard operation
Wave copied to clipboard

Lower frontend-accepted wide enum representations in LLVM without an internal error

Open LunaStev opened this issue 3 weeks ago • 0 comments

Problem

Typed HIR resolves wide scalar enum values using ConstInt, but LLVM reinterprets the declaration through a separate <=64-bit/i128 path and panics even when the declaration is unused.

Reproduction and evidence

Audited canonical master 69a67c6e0fb700f37ee6114f5a66d37ee13771a5 (0.0.1-alpha-dev). Matching checkout-built compiler/std were used for compiler probes on Linux amd64 with Rust 1.89.0 and LLVM 21.1.8. Artifact inspection, mocked/projection checks and foreign-target object emission are identified below and are not native execution on those operating systems.

enum E -> u128 { A=1 } fun main() {}
target/debug/wavec --std-root "$PWD/std" build repro.wave --emit=check
target/debug/wavec --std-root "$PWD/std" build repro.wave --emit=ir --out-dir out

Observed: check exits 0; IR exits 1/E9001 with repr bit-width unsupported: 128. i128, u256 and a u128::MAX variant reproduce; the frontend already has a passing u128::MAX HIR regression.

Scope

Consume frontend-resolved underlying types and values rather than choosing or reparsing enum meaning in LLVM. Preserve the accepted integer-width range and existing source errors.

Starting points: llvm/src/codegen/ir.rs:1461, front/hir/src/enums.rs:35.

Completion criteria

  • [ ] Accepted wide enum declarations/values lower without a panic.
  • [ ] Cover signed/unsigned boundaries, explicit/automatic/negative values and conversions.
  • [ ] Keep LLVM and existing Whale scalar enum semantics consistent; this does not extend payload enum support.

Related: #1031, #409. Related broad trackers or completed implementations are context, not claims that their entire scope is unfinished.

LunaStev avatar Nov 12 '26 12:11 LunaStev