✓
Passing This code compiles and runs correctly.
Code
// Test 210_092: multi-arm effect-branch decl — INDENTED form (parse-accept).
//
// An effect's resume output generalizes from a single anonymous `-> T`
// (210_074: `! ask T -> U`) to a flat SUM of named arms. The arms are spelled
// as `|` branches indented exactly ONE level under the `!` line:
//
// ! ask i32
// | halved i32 <- resume-arm of `ask` (named, carries i32)
// | timeout <- resume-arm of `ask` (named, no payload)
// | done i32 <- terminal branch of the EVENT (base indent)
//
// Grammar rule being pinned: `|` arms attached to a `!` (indented one level)
// are that effect's resume sum; `|` arms at the event's base indent are
// terminal branches. "Never nest `!`" => the sum is flat; arms are ALWAYS
// exactly one level in, never deeper.
//
// `| done` is NOT a special branch — it's an ordinary terminal, named by
// convention. The discriminator is indentation, not the name.
//
// PINNED FAILING (parse-accept): today the decl loop (parser.zig:1801) collects
// all `!`/`|` lines into a FLAT sibling list, so `| halved`/`| timeout` parse as
// terminal branches of the event, not as `ask`'s resume sum. This snapshot
// captures the intended AST; it goes green when the parser binds indented `|`
// arms to the preceding `!` as `resume_arms`.
//
// Same AST (modulo source locations) as the single-line form, 210_093.
~pub event request { payload: i32 }
! ask i32
| halved i32
| timeout
| done i32
Expected AST
{
"module_annotations": [],
"items": [
{
"type": "import_decl",
"path": "std/compiler",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_092_effect_multi_arm_decl_indented/input.kz",
"line": 2,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_092_effect_multi_arm_decl_indented/input.kz",
"line": 2,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_092_effect_multi_arm_decl_indented/input.kz",
"line": 3,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_092_effect_multi_arm_decl_indented/input.kz",
"line": 4,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_092_effect_multi_arm_decl_indented/input.kz",
"line": 5,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_092_effect_multi_arm_decl_indented/input.kz",
"line": 6,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_092_effect_multi_arm_decl_indented/input.kz",
"line": 7,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_092_effect_multi_arm_decl_indented/input.kz",
"line": 8,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_092_effect_multi_arm_decl_indented/input.kz",
"line": 9,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_092_effect_multi_arm_decl_indented/input.kz",
"line": 10,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_092_effect_multi_arm_decl_indented/input.kz",
"line": 11,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_092_effect_multi_arm_decl_indented/input.kz",
"line": 12,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_092_effect_multi_arm_decl_indented/input.kz",
"line": 13,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_092_effect_multi_arm_decl_indented/input.kz",
"line": 14,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_092_effect_multi_arm_decl_indented/input.kz",
"line": 15,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_092_effect_multi_arm_decl_indented/input.kz",
"line": 16,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_092_effect_multi_arm_decl_indented/input.kz",
"line": 17,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_092_effect_multi_arm_decl_indented/input.kz",
"line": 18,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_092_effect_multi_arm_decl_indented/input.kz",
"line": 19,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_092_effect_multi_arm_decl_indented/input.kz",
"line": 20,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_092_effect_multi_arm_decl_indented/input.kz",
"line": 21,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_092_effect_multi_arm_decl_indented/input.kz",
"line": 22,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_092_effect_multi_arm_decl_indented/input.kz",
"line": 23,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_092_effect_multi_arm_decl_indented/input.kz",
"line": 24,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_092_effect_multi_arm_decl_indented/input.kz",
"line": 25,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_092_effect_multi_arm_decl_indented/input.kz",
"line": 26,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_092_effect_multi_arm_decl_indented/input.kz",
"line": 27,
"col": 0
}
},
{
"type": "event_decl",
"name": "request",
"path": [
"request"
],
"module": "input",
"input": {
"fields": [
{
"name": "payload",
"type": "i32",
"is_source": false,
"is_file": false,
"is_embed_file": false,
"is_expression": false,
"is_invocation_meta": false,
"phantom": null
}
]
},
"branches": [
{
"name": "ask",
"kind": "effect",
"resume": null,
"resume_phantom": null,
"resume_arms": [
{
"name": "halved",
"type": "i32",
"phantom": null
},
{
"name": "timeout",
"type": null,
"phantom": null
}
],
"is_optional": false,
"is_panic": false,
"payload": {
"fields": [
{
"name": "__type_ref",
"type": "i32",
"is_source": false,
"is_file": false,
"is_embed_file": false,
"is_expression": false,
"is_invocation_meta": false,
"phantom": null
}
]
}
},
{
"name": "done",
"kind": "terminal",
"resume": null,
"resume_phantom": null,
"is_optional": false,
"is_panic": false,
"payload": {
"fields": [
{
"name": "__type_ref",
"type": "i32",
"is_source": false,
"is_file": false,
"is_embed_file": false,
"is_expression": false,
"is_invocation_meta": false,
"phantom": null
}
]
}
}
],
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_092_effect_multi_arm_decl_indented/input.kz",
"line": 33,
"col": 0
}
}
]
}Test Configuration
PARSER_TEST