Skip to content

Commit 99b1c22

Browse files
rtfeldmanclaude
andcommitted
Remove NumKind.numeral from backend code
The numeral variant was a placeholder for unresolved numeric types that should never make it to code generation. By the time code reaches the backend, all numeric types should be resolved to concrete types (u8, i64, dec, etc.). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 7a4d2b3 commit 99b1c22

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/backend/dev/CodeGen.zig

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ pub const NumKind = enum {
4444
f32,
4545
f64,
4646
dec,
47-
numeral,
4847

4948
pub fn isFloat(self: NumKind) bool {
5049
return self == .f32 or self == .f64;
@@ -54,7 +53,7 @@ pub const NumKind = enum {
5453
return switch (self) {
5554
.i8, .i16, .i32, .i64, .i128 => true,
5655
.u8, .u16, .u32, .u64, .u128 => false,
57-
.f32, .f64, .dec, .numeral => true, // floats are signed
56+
.f32, .f64, .dec => true, // floats are signed
5857
};
5958
}
6059

@@ -63,7 +62,7 @@ pub const NumKind = enum {
6362
.u8, .i8 => 1,
6463
.u16, .i16 => 2,
6564
.u32, .i32, .f32 => 4,
66-
.u64, .i64, .f64, .numeral => 8,
65+
.u64, .i64, .f64 => 8,
6766
.u128, .i128, .dec => 16,
6867
};
6968
}

src/backend/llvm/emit.zig

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,15 @@ pub const NumKind = enum {
3232
f32,
3333
f64,
3434
dec,
35-
numeral,
3635

3736
/// Compile-time validation that this enum matches the expected structure.
3837
pub fn validate() void {
3938
comptime {
4039
const fields = @typeInfo(NumKind).@"enum".fields;
41-
if (fields.len != 14) @compileError("NumKind must have exactly 14 variants");
40+
if (fields.len != 13) @compileError("NumKind must have exactly 13 variants");
4241
if (!std.mem.eql(u8, fields[0].name, "u8")) @compileError("NumKind[0] must be u8");
4342
if (!std.mem.eql(u8, fields[1].name, "i8")) @compileError("NumKind[1] must be i8");
44-
if (!std.mem.eql(u8, fields[13].name, "numeral")) @compileError("NumKind[13] must be numeral");
43+
if (!std.mem.eql(u8, fields[12].name, "dec")) @compileError("NumKind[12] must be dec");
4544
}
4645
}
4746
};
@@ -141,7 +140,6 @@ pub const LlvmEmitter = struct {
141140
.f32 => .float,
142141
.f64 => .double,
143142
.dec => .i128, // Dec is stored as i128
144-
.numeral => .i64, // Default unspecialized numeric type
145143
};
146144
}
147145

0 commit comments

Comments
 (0)