✓
Passing This code compiles and runs correctly.
Code
// TEST: Nested continuations with when-guards should parse without parse-error nodes.
~tor run {} -> i32
~tor poll { t: i32 } -> u8
~tor cleanup {}
~tor handle-key { code: u8 }
~run(): t |> poll(t.t)
| key k when k.code == 'q' |> cleanup()
| key k |> handle-key(k.code)
Flows
flow ~run click a branch to expand · @labels scroll to their anchor
run
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": [],
"location": {
"file": "tests/regression/100_PARSER/100_080_nested_when_guards/input.kz",
"line": 3,
"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": [],
"location": {
"file": "tests/regression/100_PARSER/100_080_nested_when_guards/input.kz",
"line": 5,
"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": 7,
"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": 9,
"col": 0
}
},
{
"type": "flow",
"invocation": {
"event": [
"run"
],
"args": [],
"variant": null
},
"continuations": [
{
"branch": "",
"kind": "terminal",
"is_catchall": false,
"binding": null,
"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,
"impl_of": null,
"location": {
"file": "tests/regression/100_PARSER/100_080_nested_when_guards/input.kz",
"line": 12,
"col": 0
}
}
]
}Test Configuration
PARSER_TEST