✓
Passing This code compiles and runs correctly.
Code
// Test: a module's emitted container identity is a property of the module,
// not of the import-path spelling the consumer used.
//
// `a` and `b` are two aliases for the same test_lib directory. The consumer
// imports `a/pump` — so the module's container materializes as `koru_a`.
// But pump's own decl spells its payload type `b/pump:Payload`, and the
// `?`-optional-arm noop the emitter synthesizes writes
// `koru_b.koru_pump.Payload` — a container that does not exist. One module,
// two aliases, two emitted names; the reference dangles.
//
// Surfaced by koru-libs/metal/tests/drift.k: `libs/metal` (consumer alias)
// vs `koru/metal:KeyData` (decl's own canonical spelling via the builtin
// `koru` alias) — `koru_koru.koru_metal` never materializes under a
// `libs/metal` import.
//
// Expected once fixed: done.
import std/io
import a/pump
a/pump:pump(n: 3)
! bump i -> i
| done |> std/io:print.ln("done")
Supporting Files
// Cross-module arm-firer that names its OWN payload type through a qualified
// alias — the way koru-libs packages self-qualify (`koru/metal:KeyData`,
// `koru/vaxis:Window`). `b` and `a` are two aliases for THIS directory; the
// decl spells `b/pump:Payload` while the consumer imports `a/pump`. The
// emitted container is named for the consumer's alias, so the optional-arm
// noop that writes `koru_b.koru_pump.Payload` must still resolve — the
// module's identity cannot depend on the spelling used to reach it.
pub const Payload = struct { code: u32 };
~pub tor pump { n: i64 }
! bump i64 -> i64
! ?tick b/pump:Payload
| done
~proc pump|zig {
var acc: i64 = 0;
var i: i64 = 0;
while (i < n) : (i += 1) acc += bump(i);
return .{ .done = .{} };
}
Actual
done
Expected output
done
Flows
flow ~pump click a branch to expand · @labels scroll to their anchor
pump (n: 3)
Test Configuration
MUST_RUN
koru.json:
{
"name": "alias-identity-container-dangle",
"version": "0.1.0",
"paths": {
"std": "../../../../../koru_std",
"app": "{{ ENTRY }}",
"a": "{{ ENTRY }}/test_lib",
"b": "{{ ENTRY }}/test_lib"
}
}