@samitouri / QOS-React-2 / commits / d9c61bac70

[hir][be] Improve debug printing of invariant

Sathya Gunasekaran committed Oct 27, 2022 at 16:43 UTC d9c61bac70217841e9ec35d765fd9cba83079ce4
1 file changed +5 -2
compiler/forget/src/HIR/InferReferenceEffects.ts
+5 -2
@@ -20,7 +20,7 @@ import {
20 ValueKind,
21 } from "./HIR";
22 import { mapTerminalSuccessors } from "./HIRBuilder";
23 -import { printMixedHIR } from "./PrintHIR";
23 +import { printMixedHIR, printPlace } from "./PrintHIR";
24
25 /**
26 * For every usage of a value in the given function, infers the effect or action
@@ -196,7 +196,10 @@ class Environment {
196 const kind = this.#values.get(value)!;
197 mergedKind = mergedKind !== null ? mergeValues(mergedKind, kind) : kind;
198 }
199 - invariant(mergedKind !== null, "Expected at least value");
199 + invariant(
200 + mergedKind !== null,
201 + `Expected at least one value at ${printPlace(place)}`
202 + );
203 return mergedKind;
204 }
205