✓
Passing This code compiles and runs correctly.
Code
// Test (negative): a `[]const u8<unsanitized!>` value passed into any event
// that doesn't accept `<!unsanitized>` is rejected by the phantom checker.
//
// This is the taint-tracking shape: a tainted string flowing into a sink
// (like `std/io:print.ln`) without going through a sanitizer is a
// compile-time error. The phantom checker treats the obligation on the
// primitive payload exactly as it treats `*File<opened!>` — undischarged
// at scope exit is a rejection.
//
// Positive twin: 330_068.
~import std/io
~pub event get-input {}
| line []const u8<unsanitized!>
~get-input => line "user input data"
~get-input()
| line s |> std/io:print.ln(s)
Must fail at runtime:
Program must error when executed.
Error Verification
Actual Compiler Output
error[KORU030]: Resource 's' with phantom state <unsanitized!> was not discharged. No event accepts <!unsanitized>.
--> auto_discharge:20:0
❌ Compiler coordination error: Auto-discharge failed (multiple disposal options or no disposal event)
error: CompilerCoordinationFailed
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/330_PHANTOM_TYPES/330_069_reject_undischarged_string_obligation/backend.zig:94:13: 0x102bfa1b7 in emit (backend)
return error.CompilerCoordinationFailed;
^
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/330_PHANTOM_TYPES/330_069_reject_undischarged_string_obligation/backend.zig:190:28: 0x102bfaea3 in main (backend)
const generated_code = try RuntimeEmitter.emit(compile_allocator, final_ast);
^Test Configuration
MUST_FAIL
Expected Error:
Resource 's' with phantom state <unsanitized!> was not discharged. No event accepts <!unsanitized>.