From 6627f7348b04cc887dd02a86b80a60a7fd693543 Mon Sep 17 00:00:00 2001 From: agra Date: Tue, 16 Jun 2026 19:10:34 +0300 Subject: [PATCH] xfail(reify): RecvResult/TryResult channel result types over reify MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit REIFY Phase 3.0. Add examples/0617 using RecvResult(i64) / TryResult(i64) (construct + match, plus payload-less .closed / .empty). Seed an empty expected/*.exit marker. RED by design — the type-fns aren't defined yet ("unresolved RecvResult"); Phase 3.1 adds them to meta.sx as type-fns over reify and turns this green. --- examples/0617-comptime-reify-recvresult.sx | 37 +++++++++++++++++++ .../0617-comptime-reify-recvresult.exit | 0 2 files changed, 37 insertions(+) create mode 100644 examples/0617-comptime-reify-recvresult.sx create mode 100644 examples/expected/0617-comptime-reify-recvresult.exit diff --git a/examples/0617-comptime-reify-recvresult.sx b/examples/0617-comptime-reify-recvresult.sx new file mode 100644 index 00000000..af49d7f1 --- /dev/null +++ b/examples/0617-comptime-reify-recvresult.sx @@ -0,0 +1,37 @@ +// REIFY Phase 3: RecvResult($T) / TryResult($T) — the channel result types, +// built ENTIRELY in sx library code as type-fns over `reify` (no new compiler +// machinery beyond Phases 0–1). A blocking recv yields a value or a `closed` +// marker; a non-blocking try-recv adds `empty` — three states a bool can't +// express. This locks that they construct and match like any enum, and that +// `RecvResult(i64)` is one nominal type across sites (the type-fn identity path). +#import "modules/std.sx"; +#import "modules/std/meta.sx"; + +main :: () -> i32 { + r := RecvResult(i64).value(42); + if r == { + case .value: (v) { print("recv value {}\n", v); } + case .closed: { print("recv closed\n"); } + } + + rc : RecvResult(i64) = .closed; + if rc == { + case .value: (v) { print("recv value {}\n", v); } + case .closed: { print("recv closed\n"); } + } + + t := TryResult(i64).value(7); + if t == { + case .value: (v) { print("try value {}\n", v); } + case .empty: { print("try empty\n"); } + case .closed: { print("try closed\n"); } + } + + te : TryResult(i64) = .empty; + if te == { + case .value: (v) { print("try value {}\n", v); } + case .empty: { print("try empty\n"); } + case .closed: { print("try closed\n"); } + } + return 0; +} diff --git a/examples/expected/0617-comptime-reify-recvresult.exit b/examples/expected/0617-comptime-reify-recvresult.exit new file mode 100644 index 00000000..e69de29b