✓
Passing Passing: the compiler rejects this program as expected.
Code
// A destructure may drop plain fields, never an obligation field it cannot
// name. Peeling only original_size leaves data under the unreachable `_.data`
// key; the arm must refuse the dropped debt instead of letting runtime leak
// checking be the only witness.
import std/io
import std/compress
std/compress:gzip(data: "hello koru")
| error e |> std/io:print.ln("ERR {{ e:s }}")
| compressed { original_size }
|> std/io:print.ln("{{ original_size:d }}")
Actual compiler output
error[KORU030]: Resource 'data' carries obligation <allocated!> was not discharged. Call: std/io:free
--> tests/regression/300_ADVANCED_FEATURES/335_OBLIGATION_STRESS/335_059_nonpeeled_obligation_field_leaks/input.k:10:1Must contain:
KORU030Flows
flow ~gzip click a branch to expand · @labels scroll to their anchor
gzip (data: "hello koru")
Test Configuration
MUST_ERROR