120 kernel body typed var inline if

✗ Failing This test is currently failing.

Failed: cs-compile

Failure Output

🎯 Compiler coordination: Passes: 20 (flow-based: elaborate, analysis, emission)

Code

input.k

Actual · Zig

✓ pass
x 1
x 101
x 105

Actual · JavaScript

✓ pass
x 1
x 101
x 105

Actual · C#

✗ cs-compile

Expected output

✓ Zig✓ JavaScript✗ C#
x 1
x 101
x 105
Emitted JavaScript source
(() => {
const __koru_len = { get() { return this.length; }, configurable: true };
Object.defineProperty(String.prototype, "len", __koru_len);
Object.defineProperty(Array.prototype, "len", __koru_len);
const __koru_stdout_write = (typeof process !== "undefined" && process.stdout)
    ? (s) => process.stdout.write(s)
    : (s) => console.log(s.endsWith("\n") ? s.slice(0, -1) : s);
const __koru_stderr_write = (typeof process !== "undefined" && process.stderr)
    ? (s) => process.stderr.write(s)
    : (s) => console.error(s.endsWith("\n") ? s.slice(0, -1) : s);
// std/store: plural store 'world' created (SoA cell + insert/query/write/take/stripe units); fields x: f64, kind: f64
let __koru_store_world = {
  x: new Array(8).fill(0),
  kind: new Array(8).fill(0),
  len: 0,
};


const main_module = {
  __store_insert_world_event: {
    handler(__koru_input) {
      const x = __koru_input.x;
      const kind = __koru_input.kind;
      const __site_line = __koru_input.__site_line;
      if (__koru_store_world.len >= 8) throw new Error("std/store: store 'world' is full (capacity 8) - declared capacity and the `| full` branch are pinned at 690_011");
      const __koru_new_row = __koru_store_world.len;
      __koru_store_world.x[__koru_new_row] = x;
      __koru_store_world.kind[__koru_new_row] = kind;
      __koru_store_world.len += 1;
      return;
    },
  },
  __store_apply_world_event: {
    handler(__koru_input) {
      const row = __koru_input.row;
      const field = __koru_input.field;
      const value_0 = __koru_input.value_0;
      const value_1 = __koru_input.value_1;
      const __koru_r = row;
      switch (field) {
      case 0: { __koru_store_world.x[__koru_r] = value_0; return { tag: "x", x: value_0 }; }
      case 1: { __koru_store_world.kind[__koru_r] = value_1; return { tag: "kind", kind: value_1 }; }
      }
      throw new Error("__store_apply_world: field index " + field + " is not a column of store 'world'");
    },
  },
  kernel_init_1954844753_event: {
    handler(__koru_input) {
      for (let i = 0; i < __koru_store_world.len; i++) {
      var bonus= 0.0;
      bonus = ((__koru_store_world.kind[i] > 0.5 ? (100.0)  :  (1.0)));
      __koru_store_world.x[i] += bonus;
      }
      return { tag: "kernel", kernel: {} };
    },
  },
  __store_sweepbody_world_L33_390_120_kernel_body_typed_var_inline_if_input_a9ed08_event: {
    handler(__koru_input) {
      const __koru_srf_r_L33_x = __koru_input.__koru_srf_r_L33_x;
      const __koru_sdix_r_L33 = __koru_input.__koru_sdix_r_L33;
__koru_stdout_write("x " + (__koru_srf_r_L33_x) + "\n");
    },
  },
  __store_sweeprun_world_L33_390_120_kernel_body_typed_var_inline_if_input_a9ed08_event: {
    handler(__koru_input) {
      {
      for (let __koru_si = 0; __koru_si < __koru_store_world.len; __koru_si++) {
      const __koru_srf_r_L33_x = __koru_store_world.x[__koru_si];
      main_module.__store_sweepbody_world_L33_390_120_kernel_body_typed_var_inline_if_input_a9ed08_event.handler({ __koru_srf_r_L33_x: __koru_srf_r_L33_x, __koru_sdix_r_L33: __koru_si });
      }
      }
      return;
    },
  },
  ln_event: {
    handler(__koru_input) {
      const expr = __koru_input.expr;
      const invocation = __koru_input.invocation;
      const item = __koru_input.item;
      const program = __koru_input.program;
      const reporter = __koru_input.reporter;
      const allocator = __koru_input.allocator;
      throw new Error("ln: [transform] tor is lowered at compile time and must never be called");

    },
  },
  flow0() {
    main_module.__store_insert_world_event.handler({ x: 0.0, kind: 0.0, __site_line: 21 });
  },
  flow1() {
    main_module.__store_insert_world_event.handler({ x: 1.0, kind: 1.0, __site_line: 22 });
  },
  flow2() {
    main_module.__store_insert_world_event.handler({ x: ((1.0 > 0.0 ? (5.0)  :  (9.0))), kind: 1.0, __site_line: 23 });
  },
  flow3() {
    const result_0 = main_module.kernel_init_1954844753_event.handler({});
    const _auto_6 = result_0.kernel;
  },
  flow4() {
    main_module.__store_sweeprun_world_L33_390_120_kernel_body_typed_var_inline_if_input_a9ed08_event.handler({});
  },
};
main_module.flow0();
main_module.flow1();
main_module.flow2();
main_module.flow3();
main_module.flow4();
})();

Flows

flow ~new click a branch to expand · @labels scroll to their anchor
new (world, capacity: 8, source: x: f64, kind: f64)
flow ~insert click a branch to expand · @labels scroll to their anchor
insert (world, source: x: 0.0, kind: 0.0)
flow ~insert click a branch to expand · @labels scroll to their anchor
insert (world, source: x: 1.0, kind: 1.0)
flow ~insert click a branch to expand · @labels scroll to their anchor
insert (world, source: x: (if (1.0 > 0.0) @as(f64, 5.0) else @as(f64, 9.0)), kind: 1.0)
flow ~init click a branch to expand · @labels scroll to their anchor
init (expr: world, source: )
flow ~query click a branch to expand · @labels scroll to their anchor
query (world)

Test Configuration

MUST_RUN LANGUAGES: zig js cs