✓
Passing This code compiles and runs correctly.
Code
// TEST: Nested continuations with when-guards should parse without parse_error nodes.
~event run {}
| ready i32
~event poll { t: i32 }
| key u8
~event cleanup {}
~event handle_key { code: u8 }
~run()
| ready t |> poll(t: t.t)
| key k when k.code == 'q' |> cleanup()
| key k |> handle_key(code: k.code)
Expected AST
{
"module_annotations": [],
"items": [
{
"type": "import_decl",
"path": "$std/compiler",
"location": {
"file": "tests/regression/100_PARSER/100_080_nested_when_guards/input.kz",
"line": 2,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/100_PARSER/100_080_nested_when_guards/input.kz",
"line": 2,
"col": 0
}
},
{
"type": "event_decl",
"name": "run",
"path": [
"run"
],
"module": "input",
"input": {
"fields": []
},
"branches": [
{
"name": "ready",
"kind": "terminal",
"resume": null,
"is_optional": 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/100_PARSER/100_080_nested_when_guards/input.kz",
"line": 6,
"col": 0
}
},
{
"type": "event_decl",
"name": "poll",
"path": [
"poll"
],
"module": "input",
"input": {
"fields": [
{
"name": "t",
"type": "i32",
"is_source": false,
"is_file": false,
"is_embed_file": false,
"is_expression": false,
"is_invocation_meta": false,
"phantom": null
}
]
},
"branches": [
{
"name": "key",
"kind": "terminal",
"resume": null,
"is_optional": false,
"payload": {
"fields": [
{
"name": "__type_ref",
"type": "u8",
"is_source": false,
"is_file": false,
"is_embed_file": false,
"is_expression": false,
"is_invocation_meta": false,
"phantom": null
}
]
}
}
],
"location": {
"file": "tests/regression/100_PARSER/100_080_nested_when_guards/input.kz",
"line": 9,
"col": 0
}
},
{
"type": "event_decl",
"name": "cleanup",
"path": [
"cleanup"
],
"module": "input",
"input": {
"fields": []
},
"branches": [],
"location": {
"file": "tests/regression/100_PARSER/100_080_nested_when_guards/input.kz",
"line": 11,
"col": 0
}
},
{
"type": "event_decl",
"name": "handle_key",
"path": [
"handle_key"
],
"module": "input",
"input": {
"fields": [
{
"name": "code",
"type": "u8",
"is_source": false,
"is_file": false,
"is_embed_file": false,
"is_expression": false,
"is_invocation_meta": false,
"phantom": null
}
]
},
"branches": [],
"location": {
"file": "tests/regression/100_PARSER/100_080_nested_when_guards/input.kz",
"line": 13,
"col": 0
}
},
{
"type": "flow",
"invocation": {
"event": [
"run"
],
"args": [],
"variant": null
},
"continuations": [
{
"branch": "ready",
"kind": "terminal",
"is_catchall": false,
"binding": "t",
"binding_type": "branch_payload",
"condition": null,
"step": {
"type": "invocation",
"invocation": {
"event": [
"poll"
],
"args": [
{
"name": "t",
"value": "t.t"
}
],
"variant": null
}
},
"continuations": [
{
"branch": "key",
"kind": "terminal",
"is_catchall": false,
"binding": "k",
"binding_type": "branch_payload",
"condition": "k.code == 'q'",
"step": {
"type": "invocation",
"invocation": {
"event": [
"cleanup"
],
"args": [],
"variant": null
}
},
"continuations": []
},
{
"branch": "key",
"kind": "terminal",
"is_catchall": false,
"binding": "k",
"binding_type": "branch_payload",
"condition": null,
"step": {
"type": "invocation",
"invocation": {
"event": [
"handle_key"
],
"args": [
{
"name": "code",
"value": "k.code"
}
],
"variant": null
}
},
"continuations": []
}
]
}
],
"pre_label": null,
"post_label": null,
"impl_of": null,
"location": {
"file": "tests/regression/100_PARSER/100_080_nested_when_guards/input.kz",
"line": 14,
"col": 0
}
}
]
}Test Configuration
PARSER_TEST