From 8357b94b055c772a7b17a436a5c0bbcbb1233e15 Mon Sep 17 00:00:00 2001 From: Daniel Morris Date: Thu, 21 May 2026 17:07:13 +0100 Subject: [PATCH] fix(vm): resolve OP_SEED/OP_TAILCALL opcode collision PR #503 (seed builtin) assigned OP_SEED = 189 and PR #518 (VM tail-call optimisation) later assigned OP_TAILCALL = 189. In the dispatch match OP_SEED is listed first and silently shadows OP_TAILCALL, so VM tail-call dispatch has been broken on main since the TCO landed. Clippy also promotes the resulting unreachable-pattern warning to an error, blocking every PR's lint check. Renumber OP_SEED to 190 (next free byte). OP_TAILCALL keeps 189 since it's on the hot dispatch path and has been wired up longer. No other references to OP_SEED need updating - the constant is named, not spelled-out, in the compile/jit/cranelift sites. --- src/vm/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vm/mod.rs b/src/vm/mod.rs index 2ece53d5..2045b7b0 100644 --- a/src/vm/mod.rs +++ b/src/vm/mod.rs @@ -173,7 +173,7 @@ pub(crate) const OP_SRT: u8 = 54; // R[A] = srt(R[B]) (sort list or text) pub(crate) const OP_SLC: u8 = 55; // R[A] = slc(R[B], R[C], R[D]) (slice; D in data word A field) pub(crate) const OP_RND0: u8 = 57; // R[A] = random float in [0,1) pub(crate) const OP_RND2: u8 = 58; // R[A] = random int in [R[B], R[C]] -pub(crate) const OP_SEED: u8 = 189; // seed(R[B]) — set shared PRNG state; R[A] = Nil +pub(crate) const OP_SEED: u8 = 190; // seed(R[B]) — set shared PRNG state; R[A] = Nil pub(crate) const OP_NOW: u8 = 59; // R[A] = current unix timestamp (seconds, float) pub(crate) const OP_NOWMS: u8 = 177; // R[A] = current unix timestamp (milliseconds, float) pub(crate) const OP_ENV: u8 = 60; // R[A] = env(R[B]) (returns R t t)