Skip to content

Commit 1829fdf

Browse files
Merge pull request #9611 from roc-lang/jared/range-syntax
Range syntax: `..<` (exclusive) and `..=` (inclusive)
2 parents ccc9b16 + cab47bc commit 1829fdf

67 files changed

Lines changed: 1551 additions & 1029 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ src/snapshots/**/*.html
140140

141141
# Local claude-code settings
142142
.claude/
143+
.claude
143144

144145
*.bak
145146
kcov-output/

src/backend/dev/LirCodeGen.zig

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3719,14 +3719,20 @@ pub fn LirCodeGen(comptime target: RocTarget) type {
37193719
};
37203720
},
37213721

3722+
// Resolved before backend codegen: builtin `from_numeral` is
3723+
// folded to a constant during Monotype lowering, so the op must
3724+
// never reach a backend. Reaching here is an invariant failure,
3725+
// not a missing feature.
3726+
.num_from_numeral => {
3727+
std.debug.panic("num_from_numeral reached the dev backend; it must be folded to a constant during Monotype lowering", .{});
3728+
},
37223729
// Unimplemented ops
37233730
.num_pow,
37243731
.num_sqrt,
37253732
.num_log,
37263733
.num_round,
37273734
.num_floor,
37283735
.num_ceiling,
3729-
.num_from_numeral,
37303736
.compare,
37313737
=> {
37323738
std.debug.panic("UNIMPLEMENTED low-level op: {s}", .{@tagName(ll.op)});

src/backend/wasm/WasmCodeGen.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10384,7 +10384,7 @@ fn generateLowLevel(self: *Self, ll: anytype) Allocator.Error!void {
1038410384
.{@tagName(self.procLocalLayoutIdx(args[0]))},
1038510385
),
1038610386
},
10387-
.num_from_numeral => unreachable, // Resolved before backend codegen
10387+
.num_from_numeral => unreachable, // Folded to a constant during Monotype lowering
1038810388

1038910389
// Box operations
1039010390
.box_box => {

src/base/mod.zig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ pub const CalledVia = enum {
8282
/// Try.parallel(get("a"), get("b"), (|foo, bar | { foo, bar }))
8383
/// ```
8484
record_builder,
85+
/// This call is the result of desugaring range syntax,
86+
/// e.g. `1..<5` becomes `Iter.exclusive_range(1, 5)`.
87+
range,
8588
};
8689

8790
/// Represents a value written as-is in a Roc source file.

0 commit comments

Comments
 (0)