✗
Failing This test is currently failing.
Failed: frontend
Failure Output
error[KORU118]: 'File' is call-site syntax — it produces no runtime value and cannot appear in a return or resume type
--> /Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/330_PHANTOM_TYPES/330_033_phantom_state_mismatch/lib/fs.kz:9:1
hint: capture kinds (Expression, Source, File, EmbedFile, InvocationMeta) exist only as tor parameters; produce a runtime type instead
error[KORU118]: 'File' is call-site syntax — it produces no runtime value and cannot appear in a return or resume type
--> /Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/330_PHANTOM_TYPES/330_033_phantom_state_mismatch/lib/mipmap.kz:9:1
hint: capture kinds (Expression, Source, File, EmbedFile, InvocationMeta) exist only as tor parameters; produce a runtime type instead Code
~import app/lib/fs
~import app/lib/mipmap
const std = @import("std");
const File = struct {
handle: i32,
};
~tor needs-fs-file { file: *File<app/lib/fs:open> }
~proc needs-fs-file|zig {
}
~app/lib/mipmap:load(path: "texture.png"): m |> needs-fs-file(file: m)
Supporting Files
// File system module with phantom state
const std = @import("std");
const File = struct {
handle: i32,
};
// Opens a file, returns with fs:open phantom state
~pub tor open { path: string } -> *File<open>
~proc open|zig {
const allocator = std.heap.page_allocator;
const f = allocator.create(File) catch unreachable;
f.* = File{ .handle = 42 };
return f;
}
// Mipmap module with its own phantom state
const std = @import("std");
const File = struct {
handle: i32,
};
// Loads a mipmap, returns with mipmap:open phantom state
~pub tor load { path: string } -> *File<open>
~proc load|zig {
const allocator = std.heap.page_allocator;
const f = allocator.create(File) catch unreachable;
f.* = File{ .handle = 42 };
return f;
}
Error output must contain
Phantom state mismatchFlows
flow ~load click a branch to expand · @labels scroll to their anchor
load (path: "texture.png")