commit b0995cb9f9540a6d463dcc2722cb3b8918a61e8e (tree)
parent cc26cb9b2366723a8149e9f79e8252936cb69b73
Author: Andrew Kelley <andrew@ziglang.org>
Date: Wed, 26 Aug 2020 19:53:36 -0700
stage2: correct logic for analyzeIsNull
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src-self-hosted/Module.zig b/src-self-hosted/Module.zig
@@ -2572,7 +2572,8 @@ pub fn analyzeIsNull(
) InnerError!*Inst {
if (operand.value()) |opt_val| {
const is_null = opt_val.isNull();
- return self.constBool(scope, src, invert_logic);
+ const bool_value = if (invert_logic) !is_null else is_null;
+ return self.constBool(scope, src, bool_value);
}
const b = try self.requireRuntimeBlock(scope, src);
const inst_tag: Inst.Tag = if (invert_logic) .isnonnull else .isnull;