Skip to content

Commit 4b0ada1

Browse files
committed
Get rid of is_ne again
1 parent 07aa38a commit 4b0ada1

File tree

6 files changed

+7
-159
lines changed

6 files changed

+7
-159
lines changed

docs/DEBUG_STORE_TRACKING.md

Lines changed: 0 additions & 138 deletions
This file was deleted.

src/PROFILING/bench_repeated_check.roc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Minimal test file - original benchmark temporarily disabled
22
# See bench_repeated_check_ORIGINAL.roc for the full version
3-
# TODO: Re-enable once `is_ne` is supported for all numeric types
3+
# TODO: Re-enable once `!=` (which desugars to is_eq().not()) is fully working
44

55
app [main] { pf: platform "../../test/str/platform/main.roc" }
66

src/canonicalize/Can.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10580,7 +10580,7 @@ fn exposeAssociatedItems(self: *Self, parent_name: Ident.Idx, type_decl: std.met
1058010580
.type_anno => |type_anno| {
1058110581
// Get the annotation name (for annotation-only definitions like compiler intrinsics)
1058210582
if (self.parse_ir.tokens.resolveIdentifier(type_anno.name)) |anno_ident| {
10583-
// Build qualified name (e.g., "Bool.is_ne")
10583+
// Build qualified name (e.g., "Bool.not")
1058410584
const parent_text = self.env.getIdent(parent_name);
1058510585
const anno_text = self.env.getIdent(anno_ident);
1058610586
const qualified_idx = try self.env.insertQualifiedIdent(parent_text, anno_text);

src/canonicalize/ModuleEnv.zig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ pub const CommonIdents = extern struct {
112112
is_gt: Ident.Idx,
113113
is_gte: Ident.Idx,
114114
is_eq: Ident.Idx,
115-
is_ne: Ident.Idx,
116115

117116
// Type/module names
118117
@"try": Ident.Idx,
@@ -175,7 +174,6 @@ pub const CommonIdents = extern struct {
175174
.is_gt = try common.insertIdent(gpa, Ident.for_text("is_gt")),
176175
.is_gte = try common.insertIdent(gpa, Ident.for_text("is_gte")),
177176
.is_eq = try common.insertIdent(gpa, Ident.for_text("is_eq")),
178-
.is_ne = try common.insertIdent(gpa, Ident.for_text("is_ne")),
179177
.@"try" = try common.insertIdent(gpa, Ident.for_text("Try")),
180178
.out_of_range = try common.insertIdent(gpa, Ident.for_text("OutOfRange")),
181179
.builtin_module = try common.insertIdent(gpa, Ident.for_text("Builtin")),
@@ -235,7 +233,6 @@ pub const CommonIdents = extern struct {
235233
.is_gt = common.findIdent("is_gt") orelse unreachable,
236234
.is_gte = common.findIdent("is_gte") orelse unreachable,
237235
.is_eq = common.findIdent("is_eq") orelse unreachable,
238-
.is_ne = common.findIdent("is_ne") orelse unreachable,
239236
.@"try" = common.findIdent("Try") orelse unreachable,
240237
.out_of_range = common.findIdent("OutOfRange") orelse unreachable,
241238
.builtin_module = common.findIdent("Builtin") orelse unreachable,

src/compile/test/module_env_test.zig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,14 @@ test "ModuleEnv.Serialized roundtrip" {
113113

114114
// Verify original data before serialization was correct
115115
// initCIRFields inserts the module name ("TestModule") into the interner, so we have 3 total: hello, world, TestModule
116-
// ModuleEnv.init() also interns 19 well-known identifiers: from_int_digits, from_dec_digits, Try, OutOfRange, Builtin, plus, minus, times, div_by, div_trunc_by, rem_by, negate, not, is_lt, is_lte, is_gt, is_gte, is_eq, is_ne
116+
// ModuleEnv.init() also interns 18 well-known identifiers: from_int_digits, from_dec_digits, Try, OutOfRange, Builtin, plus, minus, times, div_by, div_trunc_by, rem_by, negate, not, is_lt, is_lte, is_gt, is_gte, is_eq
117117
// Plus 18 type identifiers: Builtin.Try, Builtin.Num.Numeral, Builtin.Str, List, Box, Builtin.Num.{U8, I8, U16, I16, U32, I32, U64, I64, U128, I128, F32, F64, Dec}
118118
// Plus 3 field/tag identifiers: before_dot, after_dot, ProvidedByCompiler
119119
// Plus 7 more identifiers: tag, payload, is_negative, digits_before_pt, digits_after_pt, box, unbox
120120
// Plus 2 Try tag identifiers: Ok, Err
121121
// Plus 1 method identifier: from_numeral
122122
// Plus 2 Bool tag identifiers: True, False
123-
try testing.expectEqual(@as(u32, 54), original.common.idents.interner.entry_count);
123+
try testing.expectEqual(@as(u32, 53), original.common.idents.interner.entry_count);
124124
try testing.expectEqualStrings("hello", original.getIdent(hello_idx));
125125
try testing.expectEqualStrings("world", original.getIdent(world_idx));
126126

@@ -129,9 +129,9 @@ test "ModuleEnv.Serialized roundtrip" {
129129
try testing.expectEqual(@as(usize, 2), original.imports.imports.len()); // Should have 2 unique imports
130130

131131
// First verify that the CommonEnv data was preserved after deserialization
132-
// Should have same 54 identifiers as original: hello, world, TestModule + 19 well-known identifiers + 17 type identifiers + 3 field/tag identifiers + 7 more identifiers + 2 Try tag identifiers + 1 method identifier + 2 Bool tag identifiers from ModuleEnv.init()
132+
// Should have same 53 identifiers as original: hello, world, TestModule + 18 well-known identifiers + 17 type identifiers + 3 field/tag identifiers + 7 more identifiers + 2 Try tag identifiers + 1 method identifier + 2 Bool tag identifiers from ModuleEnv.init()
133133
// (Note: "Try" is now shared with well-known identifiers, reducing total by 1)
134-
try testing.expectEqual(@as(u32, 54), env.common.idents.interner.entry_count);
134+
try testing.expectEqual(@as(u32, 53), env.common.idents.interner.entry_count);
135135

136136
try testing.expectEqual(@as(usize, 1), env.common.exposed_items.count());
137137
try testing.expectEqual(@as(?u16, 42), env.common.exposed_items.getNodeIndexById(gpa, @as(u32, @bitCast(hello_idx))));

src/eval/interpreter.zig

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6038,7 +6038,7 @@ pub const Interpreter = struct {
60386038
.ident = nom.ident.ident_idx,
60396039
},
60406040
.record, .tuple, .tag_union, .empty_record, .empty_tag_union => blk: {
6041-
// Anonymous structural types have implicit is_eq and is_ne
6041+
// Anonymous structural types have implicit is_eq
60426042
// Use root_env.idents for consistency with method dispatch
60436043
if (method_ident == self.root_env.idents.is_eq) {
60446044
const result = self.valuesStructurallyEqual(lhs, lhs_rt_var, rhs, rhs_rt_var) catch |err| {
@@ -6051,17 +6051,6 @@ pub const Interpreter = struct {
60516051
};
60526052
return try self.makeBoolValue(result);
60536053
}
6054-
if (method_ident == self.root_env.idents.is_ne) {
6055-
const result = self.valuesStructurallyEqual(lhs, lhs_rt_var, rhs, rhs_rt_var) catch |err| {
6056-
// If structural equality is not implemented for this type, return false
6057-
if (err == error.NotImplemented) {
6058-
self.triggerCrash("DEBUG: dispatchBinaryOpMethod NotImplemented", false, roc_ops);
6059-
return error.Crash;
6060-
}
6061-
return err;
6062-
};
6063-
return try self.makeBoolValue(!result);
6064-
}
60656054
break :blk null;
60666055
},
60676056
else => null,

0 commit comments

Comments
 (0)