002 branch constructor multiline

✓ Passing This code compiles and runs correctly.

Code

// ============================================================================
// Regression test: multi-line branch constructor inside pipeline
// Ensures parser tolerates whitespace when branch constructor body spans lines
// ============================================================================

~event validate { val: i32 }
| positive { val: i32 }
| negative { val: i32 }
| zero {}

~event compute { value: i32 }
| result { doubled: i32 }

~proc compute {
    const output = ~validate(val: value)
        | positive p |> result { doubled: p.val * 2 }
        | negative |> result { doubled: 0 }
        | zero |> result {
            doubled: 0
        }

    return output;
}
input.kz

Expected AST

{
  "module_annotations": [],
  "items": [
    {
      "type": "import_decl",
      "path": "$std/compiler",
      "location": {
        "file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_002_branch_constructor_multiline/input.kz",
        "line": 2,
        "col": 0
      }
    },
    {
      "type": "host_line",
      "module": "input",
      "location": {
        "file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_002_branch_constructor_multiline/input.kz",
        "line": 2,
        "col": 0
      }
    },
    {
      "type": "host_line",
      "module": "input",
      "location": {
        "file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_002_branch_constructor_multiline/input.kz",
        "line": 3,
        "col": 0
      }
    },
    {
      "type": "host_line",
      "module": "input",
      "location": {
        "file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_002_branch_constructor_multiline/input.kz",
        "line": 4,
        "col": 0
      }
    },
    {
      "type": "host_line",
      "module": "input",
      "location": {
        "file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_002_branch_constructor_multiline/input.kz",
        "line": 5,
        "col": 0
      }
    },
    {
      "type": "event_decl",
      "name": "validate",
      "path": [
        "validate"
      ],
      "module": "input",
      "input": {
        "fields": [
          {
            "name": "val",
            "type": "i32",
            "is_source": false,
            "is_file": false,
            "is_embed_file": false,
            "is_expression": false,
            "is_invocation_meta": false
          }
        ]
      },
      "branches": [
        {
          "name": "positive",
          "payload": {
            "fields": [
              {
                "name": "val",
                "type": "i32",
                "is_source": false,
                "is_file": false,
                "is_embed_file": false,
                "is_expression": false,
                "is_invocation_meta": false
              }
            ]
          }
        },
        {
          "name": "negative",
          "payload": {
            "fields": [
              {
                "name": "val",
                "type": "i32",
                "is_source": false,
                "is_file": false,
                "is_embed_file": false,
                "is_expression": false,
                "is_invocation_meta": false
              }
            ]
          }
        },
        {
          "name": "zero",
          "payload": {
            "fields": []
          }
        }
      ],
      "location": {
        "file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_002_branch_constructor_multiline/input.kz",
        "line": 11,
        "col": 0
      }
    },
    {
      "type": "event_decl",
      "name": "compute",
      "path": [
        "compute"
      ],
      "module": "input",
      "input": {
        "fields": [
          {
            "name": "value",
            "type": "i32",
            "is_source": false,
            "is_file": false,
            "is_embed_file": false,
            "is_expression": false,
            "is_invocation_meta": false
          }
        ]
      },
      "branches": [
        {
          "name": "result",
          "payload": {
            "fields": [
              {
                "name": "doubled",
                "type": "i32",
                "is_source": false,
                "is_file": false,
                "is_embed_file": false,
                "is_expression": false,
                "is_invocation_meta": false
              }
            ]
          }
        }
      ],
      "location": {
        "file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_002_branch_constructor_multiline/input.kz",
        "line": 14,
        "col": 0
      }
    },
    {
      "type": "proc_decl",
      "event_name": "compute",
      "path": [
        "compute"
      ],
      "module": "input",
      "target": "zig",
      "inline_flows": [
        {
          "invocation": {
            "event": [
              "validate"
            ],
            "args": [
              {
                "name": "val",
                "value": "value"
              }
            ],
            "variant": null
          },
          "continuations": [
            {
              "branch": "positive",
              "binding": "p",
              "binding_type": "branch_payload",
              "step": {
                "type": "branch_constructor",
                "branch_constructor": {
                  "branch_name": "result",
                  "fields": [
                    {
                      "name": "doubled",
                      "type": "auto",
                      "expression_str": "p.val * 2"
                    }
                  ],
                  "plain_value": null,
                  "has_expressions": true
                }
              },
              "continuations": []
            },
            {
              "branch": "negative",
              "binding": null,
              "binding_type": "branch_payload",
              "step": {
                "type": "branch_constructor",
                "branch_constructor": {
                  "branch_name": "result",
                  "fields": [
                    {
                      "name": "doubled",
                      "type": "auto",
                      "expression_str": "0"
                    }
                  ],
                  "plain_value": null,
                  "has_expressions": true
                }
              },
              "continuations": []
            },
            {
              "branch": "zero",
              "binding": null,
              "binding_type": "branch_payload",
              "step": {
                "type": "branch_constructor",
                "branch_constructor": {
                  "branch_name": "result",
                  "fields": [
                    {
                      "name": "doubled",
                      "type": "auto",
                      "expression_str": "0"
                    }
                  ],
                  "plain_value": null,
                  "has_expressions": true
                }
              },
              "continuations": []
            }
          ],
          "pre_label": null,
          "post_label": null,
          "location": {
            "file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_002_branch_constructor_multiline/input.kz",
            "line": 1,
            "col": 0
          }
        }
      ],
      "is_pure": false,
      "location": {
        "file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_002_branch_constructor_multiline/input.kz",
        "line": 25,
        "col": 0
      }
    }
  ]
}

Test Configuration

PARSER_TEST