✓
Passing This code compiles and runs correctly.
Code
// Test 210_126: panic branch on the EFFECT side (`! ?!oom`) + glyph collision.
//
// `?!` must read as ONE "panic branch" marker, NOT as `?` (optional) + `!`
// (effect introducer). Today `!` only appears as an effect introducer at the
// start of a line, and `?` only as an optional marker right after the
// introducer — so `?!` is free to mean "panic" as a unit on both sides:
// `| ?!oom` — terminal panic branch
// `! ?!oom` — effect panic branch
//
// This test pins:
// 1. an effect panic branch decl parses with `is_panic: true`,
// `is_optional: false`, `kind: "effect"`;
// 2. the collision invariant: `?!` is one marker (a single panic branch),
// not "optional effect" — i.e. it does NOT parse as `?` + `!`.
~pub event tokenize { source: []const u8 }
! token []const u8
! ?!oom usize
| done usize
Expected AST
{
"module_annotations": [],
"items": [
{
"type": "import_decl",
"path": "std/compiler",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_126_panic_effect_branch_decl/input.kz",
"line": 2,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_126_panic_effect_branch_decl/input.kz",
"line": 2,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_126_panic_effect_branch_decl/input.kz",
"line": 3,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_126_panic_effect_branch_decl/input.kz",
"line": 4,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_126_panic_effect_branch_decl/input.kz",
"line": 5,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_126_panic_effect_branch_decl/input.kz",
"line": 6,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_126_panic_effect_branch_decl/input.kz",
"line": 7,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_126_panic_effect_branch_decl/input.kz",
"line": 8,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_126_panic_effect_branch_decl/input.kz",
"line": 9,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_126_panic_effect_branch_decl/input.kz",
"line": 10,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_126_panic_effect_branch_decl/input.kz",
"line": 11,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_126_panic_effect_branch_decl/input.kz",
"line": 12,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_126_panic_effect_branch_decl/input.kz",
"line": 13,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_126_panic_effect_branch_decl/input.kz",
"line": 14,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/210_126_panic_effect_branch_decl/input.kz",
"line": 15,
"col": 0
}
},
{
"type": "event_decl",
"name": "tokenize",
"path": [
"tokenize"
],
"module": "input",
"input": {
"fields": [
{
"name": "source",
"type": "[]const u8",
"is_source": false,
"is_file": false,
"is_embed_file": false,
"is_expression": false,
"is_invocation_meta": false,
"phantom": null
}
]
},
"branches": [
{
"name": "token",
"kind": "effect",
"resume": null,
"resume_phantom": null,
"is_optional": false,
"is_panic": false,
"payload": {
"fields": [
{
"name": "__type_ref",
"type": "[]const u8",
"is_source": false,
"is_file": false,
"is_embed_file": false,
"is_expression": false,
"is_invocation_meta": false,
"phantom": null
}
]
}
},
{
"name": "oom",
"kind": "effect",
"resume": null,
"resume_phantom": null,
"is_optional": false,
"is_panic": true,
"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,
"resume_phantom": null,
"is_optional": false,
"is_panic": 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_126_panic_effect_branch_decl/input.kz",
"line": 21,
"col": 0
}
}
]
}Test Configuration
PARSER_TEST