✓
Passing This code compiles and runs correctly.
Code
// Test: refine enforcement rides a panic branch — std/list:push declares
// `| ?!violated string`; the guard produces into it (`port: 80` violates
// `port: i64 & >1024`) instead of trapping inline.
//
// Expected: the call site handles no panic branches, so `?!violated` gets the
// synthesized arm — stderr echoes the payload (the field name) and
// the process traps (EXPECT_TRAP, expected_patterns).
import std/proto
import std/refine
import std/list
import std/io
std/proto(Server) {
port: i64
host: string
}
std/refine(Server) {
port: i64 & >1024 & <=65535
host: string
}
std/list:new(Server)
| list xs |> std/list:push(xs, port: 80, host: "web-01") |> std/io:print.ln("never")
| err e |> std/io:print.ln("ERR {{ e:s }}")
Actual
input:push-Server: panic branch 'violated' fired — payload: port
thread 120956013 panic: input:push-Server: unhandled panic branch 'violated' fired at runtime
???:?:?: 0x1002dd9ff in _output_emitted.main_module.flow0 (???)
???:?:?: 0x1002dd74f in _output_emitted.main (???)
???:?:?: 0x1002dd66b in _main (???)
???:?:?: 0x1816a3dff in ??? (???)
???:?:?: 0x0 in ??? (???)
Expected patterns
Each line is a regex that must match the program output.
push-Server: panic branch 'violated' fired — payload: port
push-Server: unhandled panic branch 'violated' fired at runtimeFlows
flow ~std/proto click a branch to expand · @labels scroll to their anchor
std/proto (Server, source: port: i64
host: string)
flow ~std/refine click a branch to expand · @labels scroll to their anchor
std/refine (Server, source: port: i64 & >1024 & <=65535
host: string)
flow ~new click a branch to expand · @labels scroll to their anchor
new (Server)
Test Configuration
MUST_RUN