Keep the compiler's kind and code methods direct (#1317)

This commit is contained in:
Chris Tate
2026-10-18 14:43:02 -05:00
committed by GitHub
@@ -429,11 +429,14 @@ export function resolveInferredReturn(
if (ice.length > 0) lowerer.diags.push(...ice);
lowerer.runtimeFences.push(...captured.filter((d) => d.code !== "SC9001"));
const first = captured.find((d) => d.code !== "SC9001");
// Property writes, not literal element writes: the class method
// census reads `x["kind"] = …` as a possible write to every method
// named `kind`, which would make those methods dynamic in native builds.
const mutable = e.stmt as unknown as Record<string, unknown>;
delete mutable["value"];
mutable["kind"] = "runtimeFence";
mutable["code"] = first?.code ?? "SC1090";
mutable["message"] = first
delete mutable.value;
mutable.kind = "runtimeFence";
mutable.code = first?.code ?? "SC1090";
mutable.message = first
? `${first.message} [${first.code}]`
: "this return value has no lowering onto the instance's settled return type [SC1090]";
}