From d9c61bac70217841e9ec35d765fd9cba83079ce4 Mon Sep 17 00:00:00 2001 From: Sathya Gunasekaran Date: Thu, 27 Oct 2022 16:43:31 +0100 Subject: [PATCH] [hir][be] Improve debug printing of invariant --- compiler/forget/src/HIR/InferReferenceEffects.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/compiler/forget/src/HIR/InferReferenceEffects.ts b/compiler/forget/src/HIR/InferReferenceEffects.ts index 96f293456a..34985dbaed 100644 --- a/compiler/forget/src/HIR/InferReferenceEffects.ts +++ b/compiler/forget/src/HIR/InferReferenceEffects.ts @@ -20,7 +20,7 @@ import { ValueKind, } from "./HIR"; import { mapTerminalSuccessors } from "./HIRBuilder"; -import { printMixedHIR } from "./PrintHIR"; +import { printMixedHIR, printPlace } from "./PrintHIR"; /** * For every usage of a value in the given function, infers the effect or action @@ -196,7 +196,10 @@ class Environment { const kind = this.#values.get(value)!; mergedKind = mergedKind !== null ? mergeValues(mergedKind, kind) : kind; } - invariant(mergedKind !== null, "Expected at least value"); + invariant( + mergedKind !== null, + `Expected at least one value at ${printPlace(place)}` + ); return mergedKind; }