custom coordinator bug

✗ Failing This test is currently failing.

Failed: frontend

Failure Output

Showing last 10 of 13 lines
 19 | |> std.compiler:context_create(program_ast: program_ast, allocator: allocator)
    | ^^
  hint: '|>' is inline glue only — it joins a body to its branch handler, or chains void events on one line. Three legal layouts: (1) fold inline `~A() |> B()`; (2) split into separate top-level statements `~A()` then `~B()`; (3) delete the redundant `|> _` if the head suffices.

error[KORU010]: '|>' cannot start a line
  --> tests/regression/400_RUNTIME_FEATURES/430_COORDINATION/8401_custom_coordinator_bug/input.kz:48:0
    |
 48 | |> _
    | ^^
  hint: '|>' is inline glue only — it joins a body to its branch handler, or chains void events on one line. Three legal layouts: (1) fold inline `~A() |> B()`; (2) split into separate top-level statements `~A()` then `~B()`; (3) delete the redundant `|> _` if the head suffices.

Code

// Test: Custom Compiler Coordinator Override
//
// Validates that users can override the abstract coordinate event
// with their own pipeline implementation using cross-module overrides (~mod:event = ...).
//
// The custom coordinator prints a marker, then delegates to standard pipeline.

~import "$std/compiler"
~import "$std/optimizer"

const std = @import("std");
const ast = @import("ast");
const Program = ast.Program;

// Custom coordinator that wraps the default pipeline
// All compiler events must be module-qualified
~std.compiler:coordinate =
    custom_marker()
|> std.compiler:context_create(program_ast: program_ast, allocator: allocator)
  | created c0 |> std.compiler:frontend(ctx: c0)
    | ctx c1 |> std.compiler:transform_taps(ctx: c1)
      | ctx c2 |> std.compiler:analysis(ctx: c2)
        | ctx c3 |> std.compiler:test_generation(ctx: c3)
          | ctx c4 |> std.optimizer:optimize(ctx: c4)
            | ctx c5 |> std.compiler:emission(ctx: c5)
              | ctx c6 |> coordinated {
                  ast: c6.ctx.ast,
                  code: c6.code,
                  metrics: "Custom coordinator ran!"
              }
        | failed f |> error f.message

// Helper event to print marker (must be comptime since it's called from coordinate handler)
~[comptime] event custom_marker {}

~proc custom_marker {
    std.debug.print("CUSTOM COORDINATOR: Pipeline override active!\n", .{});
}

// Simple test event
~pub event hello {}

~proc hello {
    std.debug.print("Hello from custom-compiled code!\n", .{});
}

~hello()
|> _
input.kz

Test Configuration

MUST_RUN