✓
Passing This code compiles and runs correctly.
Code
// Test 210_079: parser produces an `.expression` Node for a Zig expression
// at body position of an effect-branch handler.
//
// Today this misparses: bare `"Alice"` becomes a malformed Invocation with
// path segments = [`"\"Alice\""`]. The right shape: an `.expression` Node
// carrying the Zig source string, regardless of branch kind.
//
// Invocations always have parens (`thing()`); a body without trailing parens
// after the path is an expression, not an invocation.
~pub event prompt_user { question: []const u8 }
! ask []const u8 -> []const u8
| done
~prompt_user(question: "X?")
! ask _ |> "Alice"
| done |> _
Expected AST
{
"module_annotations": [],
"items": [
{
"type": "import_decl",
"path": "$std/compiler",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_079_effect_branch_resume_expression/input.kz",
"line": 2,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_079_effect_branch_resume_expression/input.kz",
"line": 2,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_079_effect_branch_resume_expression/input.kz",
"line": 3,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_079_effect_branch_resume_expression/input.kz",
"line": 4,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_079_effect_branch_resume_expression/input.kz",
"line": 5,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_079_effect_branch_resume_expression/input.kz",
"line": 6,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_079_effect_branch_resume_expression/input.kz",
"line": 7,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_079_effect_branch_resume_expression/input.kz",
"line": 8,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_079_effect_branch_resume_expression/input.kz",
"line": 9,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_079_effect_branch_resume_expression/input.kz",
"line": 10,
"col": 0
}
},
{
"type": "event_decl",
"name": "prompt_user",
"path": [
"prompt_user"
],
"module": "input",
"input": {
"fields": [
{
"name": "question",
"type": "[]const u8",
"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": "[]const u8",
"is_optional": false,
"payload": {
"fields": [
{
"name": "__type_ref",
"type": "[]const u8",
"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,
"is_optional": false,
"payload": {
"fields": []
}
}
],
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_079_effect_branch_resume_expression/input.kz",
"line": 15,
"col": 0
}
},
{
"type": "flow",
"invocation": {
"event": [
"prompt_user"
],
"args": [
{
"name": "question",
"value": "\"X?\""
}
],
"variant": null
},
"continuations": [
{
"branch": "ask",
"kind": "effect",
"is_catchall": false,
"binding": "_",
"binding_type": "branch_payload",
"condition": null,
"step": {
"type": "expression",
"expression": "\"Alice\""
},
"continuations": []
},
{
"branch": "done",
"kind": "terminal",
"is_catchall": false,
"binding": null,
"binding_type": "branch_payload",
"condition": null,
"step": {
"type": "terminal"
},
"continuations": []
}
],
"pre_label": null,
"post_label": null,
"impl_of": null,
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_079_effect_branch_resume_expression/input.kz",
"line": 16,
"col": 0
}
}
]
}Test Configuration
PARSER_TEST