✓
Passing Passing: the compiler rejects this program as expected.
Code
// WALL: destructure must account for every obligation field. Naming only { h }
// of {h!, g!} leaves g un-bound and therefore un-discharged -> KORU030 on g.
// This is NOT a destructure-specific rule: an un-named obligation field is just
// an un-discharged obligation, caught by the ordinary discharge rule.
~import std/io
const std = @import("std");
const Handle = struct { n: i32 };
~tor make2 { id: usize } -> { h: *Handle<owned!>, g: *Handle<owned!> }
~proc make2|zig {
const h = std.heap.page_allocator.create(Handle) catch unreachable;
const g = std.heap.page_allocator.create(Handle) catch unreachable;
h.* = .{ .n = 1 }; g.* = .{ .n = 2 };
return .{ .h = h, .g = g };
}
~tor dispose { x: *Handle<!owned> }
~proc dispose|zig { std.heap.page_allocator.destroy(x); }
~make2(id: 1): { h } |> std/io:print.ln("bound only h, ignored g")
Actual compiler output
error[KORU030]: Resource 'g' obligation <owned!> was not discharged. Call one of: dispose
--> tests/regression/300_ADVANCED_FEATURES/330_PHANTOM_TYPES/330_103_partial_destructure_omits_obligation/input.kz:19:0
❌ Compiler coordination error: Auto-discharge failed (multiple disposal options or no disposal event)
(set KORU_BACKEND_TRACE=1 for the backend return trace)Backend must reject with:
CONTAINS error[KORU030]
CONTAINS was not dischargedFlows
flow ~make2 click a branch to expand · @labels scroll to their anchor
make2 (id: 1)
Test Configuration
MUST_ERROR