075 effect branch consumer dispatch

✓ Passing This code compiles and runs correctly.

Code

// Test 210_075: consumer dispatch with `!` and `|` handlers.
// `! each` handler runs 0..N times, `| done` handler runs exactly once.

~pub event for { start: usize, end: usize }
! each usize
| done usize

~pub event tick {}

~for(start: 0, end: 3)
! each _ |> tick()
| done _ |> tick()
input.kz

Expected AST

{
  "module_annotations": [],
  "items": [
    {
      "type": "import_decl",
      "path": "$std/compiler",
      "location": {
        "file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_075_effect_branch_consumer_dispatch/input.kz",
        "line": 2,
        "col": 0
      }
    },
    {
      "type": "host_line",
      "module": "input",
      "location": {
        "file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_075_effect_branch_consumer_dispatch/input.kz",
        "line": 2,
        "col": 0
      }
    },
    {
      "type": "host_line",
      "module": "input",
      "location": {
        "file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_075_effect_branch_consumer_dispatch/input.kz",
        "line": 3,
        "col": 0
      }
    },
    {
      "type": "event_decl",
      "name": "for",
      "path": [
        "for"
      ],
      "module": "input",
      "input": {
        "fields": [
          {
            "name": "start",
            "type": "usize",
            "is_source": false,
            "is_file": false,
            "is_embed_file": false,
            "is_expression": false,
            "is_invocation_meta": false,
            "phantom": null
          },
          {
            "name": "end",
            "type": "usize",
            "is_source": false,
            "is_file": false,
            "is_embed_file": false,
            "is_expression": false,
            "is_invocation_meta": false,
            "phantom": null
          }
        ]
      },
      "branches": [
        {
          "name": "each",
          "kind": "effect",
          "resume": null,
          "is_optional": false,
          "payload": {
            "fields": [
              {
                "name": "__type_ref",
                "type": "usize",
                "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": [
              {
                "name": "__type_ref",
                "type": "usize",
                "is_source": false,
                "is_file": false,
                "is_embed_file": false,
                "is_expression": false,
                "is_invocation_meta": false,
                "phantom": null
              }
            ]
          }
        }
      ],
      "location": {
        "file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_075_effect_branch_consumer_dispatch/input.kz",
        "line": 8,
        "col": 0
      }
    },
    {
      "type": "event_decl",
      "name": "tick",
      "path": [
        "tick"
      ],
      "module": "input",
      "input": {
        "fields": []
      },
      "branches": [],
      "location": {
        "file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_075_effect_branch_consumer_dispatch/input.kz",
        "line": 10,
        "col": 0
      }
    },
    {
      "type": "flow",
      "invocation": {
        "event": [
          "for"
        ],
        "args": [
          {
            "name": "start",
            "value": "0"
          },
          {
            "name": "end",
            "value": "3"
          }
        ],
        "variant": null
      },
      "continuations": [
        {
          "branch": "each",
          "kind": "effect",
          "is_catchall": false,
          "binding": "_",
          "binding_type": "branch_payload",
          "condition": null,
          "step": {
            "type": "invocation",
            "invocation": {
              "event": [
                "tick"
              ],
              "args": [],
              "variant": null
            }
          },
          "continuations": []
        },
        {
          "branch": "done",
          "kind": "terminal",
          "is_catchall": false,
          "binding": "_",
          "binding_type": "branch_payload",
          "condition": null,
          "step": {
            "type": "invocation",
            "invocation": {
              "event": [
                "tick"
              ],
              "args": [],
              "variant": null
            }
          },
          "continuations": []
        }
      ],
      "pre_label": null,
      "post_label": null,
      "impl_of": null,
      "location": {
        "file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_075_effect_branch_consumer_dispatch/input.kz",
        "line": 11,
        "col": 0
      }
    }
  ]
}

Test Configuration

PARSER_TEST