aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Sema.zig6
-rw-r--r--test/behavior/math.zig2
2 files changed, 3 insertions, 5 deletions
diff --git a/src/Sema.zig b/src/Sema.zig
index b35408a7a6..b25bdf0db4 100644
--- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -9244,9 +9244,9 @@ fn cmpSelf(
const resolved_type = sema.typeOf(casted_lhs);
const runtime_src: LazySrcLoc = src: {
if (try sema.resolveMaybeUndefVal(block, lhs_src, casted_lhs)) |lhs_val| {
- if (lhs_val.isUndef()) return sema.addConstUndef(resolved_type);
+ if (lhs_val.isUndef()) return sema.addConstUndef(Type.initTag(.bool));
if (try sema.resolveMaybeUndefVal(block, rhs_src, casted_rhs)) |rhs_val| {
- if (rhs_val.isUndef()) return sema.addConstUndef(resolved_type);
+ if (rhs_val.isUndef()) return sema.addConstUndef(Type.initTag(.bool));
if (lhs_val.compare(op, rhs_val, resolved_type)) {
return Air.Inst.Ref.bool_true;
@@ -9265,7 +9265,7 @@ fn cmpSelf(
// bool eq/neq more efficiently.
if (resolved_type.zigTypeTag() == .Bool) {
if (try sema.resolveMaybeUndefVal(block, rhs_src, casted_rhs)) |rhs_val| {
- if (rhs_val.isUndef()) return sema.addConstUndef(resolved_type);
+ if (rhs_val.isUndef()) return sema.addConstUndef(Type.initTag(.bool));
return sema.runtimeBoolCmp(block, op, casted_lhs, rhs_val.toBool(), lhs_src);
}
}
diff --git a/test/behavior/math.zig b/test/behavior/math.zig
index 88f1b458ae..77820ac0fb 100644
--- a/test/behavior/math.zig
+++ b/test/behavior/math.zig
@@ -1024,8 +1024,6 @@ test "vector comparison" {
}
test "compare undefined literal with comptime_int" {
- if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
-
var x = undefined == 1;
// x is now undefined with type bool
x = true;