From 0d4837d5fba746e88582aa92fa0e5a24917ed26d Mon Sep 17 00:00:00 2001 From: Peter Li Date: Sun, 1 Nov 2026 20:16:21 -0800 Subject: [PATCH] Static locals read from another static's initializer A function-local static whose initializer reads another local static (static const int n = min((order + 1) * (order + 1), 9)) failed with "this variable is not supported yet": initializers are lowered in functions of their own, where the other static is not a local. It is its private global there, as a file-scope static is. --- src/ir/lower.zig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ir/lower.zig b/src/ir/lower.zig index 6f39d20..bf02060 100644 --- a/src/ir/lower.zig +++ b/src/ir/lower.zig @@ -1693,7 +1693,10 @@ const Lowerer = struct { const t = l.types(); if (l.vars.get(v)) |p| return p; switch (v.storage) { - .local, .param, .local_static => return l.fail(e, "this variable"), + .local, .param => return l.fail(e, "this variable"), + // Not yet in `vars` only inside another static's initializer: + // its global, as for a file-scope static. + .local_static => {}, .global_uniform, .cbuffer => { if (isObject(&l.s.types, v.type)) { l.unsupported(e.loc, "resource '{s}' declared as a uniform is not supported yet", .{v.name});