✓
Passing This code compiles and runs correctly.
Code
// Test 058: Parse Tap with Nested Continuation
// MUST_COMPILE_ONLY
//
// This test verifies that the parser correctly nests continuations
// based on indentation, not flattening them into a single array.
//
// When we write:
// ~source -> * | Transition t |> log() | done |> _
//
// The parser should create:
// tap.continuations[0] = { branch: "Transition", nested: [...] }
// tap.continuations[0].nested[0] = { branch: "done", ... }
//
// NOT:
// tap.continuations[0] = { branch: "Transition", ... }
// tap.continuations[1] = { branch: "done", ... } // WRONG - should be nested!
const std = @import("std");
~import "$std/taps"
~event log { data: ?[]const u8 }
| done {}
~proc log {
return .{ .done = .{} };
}
// THE TAP TO ANALYZE:
// This has a nested continuation: | Transition |> log() | done |> _
// The | done |> line is INDENTED, so it should be NESTED under Transition
~tap(* -> *)
| Profile p |> log(data: p.destination)
| done |> _
Expected AST
{
"module_annotations": [],
"items": [
{
"type": "import_decl",
"path": "$std/compiler",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_008_tap_nested_continuation/input.kz",
"line": 2,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_008_tap_nested_continuation/input.kz",
"line": 2,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_008_tap_nested_continuation/input.kz",
"line": 3,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_008_tap_nested_continuation/input.kz",
"line": 4,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_008_tap_nested_continuation/input.kz",
"line": 5,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_008_tap_nested_continuation/input.kz",
"line": 6,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_008_tap_nested_continuation/input.kz",
"line": 7,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_008_tap_nested_continuation/input.kz",
"line": 8,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_008_tap_nested_continuation/input.kz",
"line": 9,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_008_tap_nested_continuation/input.kz",
"line": 10,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_008_tap_nested_continuation/input.kz",
"line": 11,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_008_tap_nested_continuation/input.kz",
"line": 12,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_008_tap_nested_continuation/input.kz",
"line": 13,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_008_tap_nested_continuation/input.kz",
"line": 14,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_008_tap_nested_continuation/input.kz",
"line": 15,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_008_tap_nested_continuation/input.kz",
"line": 16,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_008_tap_nested_continuation/input.kz",
"line": 17,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_008_tap_nested_continuation/input.kz",
"line": 19,
"col": 0
}
},
{
"type": "import_decl",
"path": "$std/taps",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_008_tap_nested_continuation/input.kz",
"line": 21,
"col": 0
}
},
{
"type": "event_decl",
"name": "log",
"path": [
"log"
],
"module": "input",
"input": {
"fields": [
{
"name": "data",
"type": "?[]const u8",
"is_source": false,
"is_file": false,
"is_embed_file": false,
"is_expression": false,
"is_invocation_meta": false
}
]
},
"branches": [
{
"name": "done",
"payload": {
"fields": []
}
}
],
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_008_tap_nested_continuation/input.kz",
"line": 24,
"col": 0
}
},
{
"type": "proc_decl",
"event_name": "log",
"path": [
"log"
],
"module": "input",
"target": "zig",
"inline_flows": [],
"is_pure": false,
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_008_tap_nested_continuation/input.kz",
"line": 28,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_008_tap_nested_continuation/input.kz",
"line": 29,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_008_tap_nested_continuation/input.kz",
"line": 30,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_008_tap_nested_continuation/input.kz",
"line": 31,
"col": 0
}
},
{
"type": "flow",
"invocation": {
"event": [
"tap"
],
"args": [
{
"name": "* -> *",
"value": "* -> *"
}
],
"variant": null
},
"continuations": [
{
"branch": "Profile",
"binding": "p",
"binding_type": "branch_payload",
"step": {
"type": "invocation",
"invocation": {
"event": [
"log"
],
"args": [
{
"name": "data",
"value": "p.destination"
}
],
"variant": null
}
},
"continuations": [
{
"branch": "done",
"binding": null,
"binding_type": "branch_payload",
"step": {
"type": "terminal"
},
"continuations": []
}
]
}
],
"pre_label": null,
"post_label": null,
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_008_tap_nested_continuation/input.kz",
"line": 32,
"col": 0
}
}
]
}Test Configuration
PARSER_TEST