| ... | ... | @@ -8271,12 +8271,13 @@ fn zirBoolNot(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 8271 | 8271 | |
| 8272 | 8272 | const bool_type = Type.initTag(.bool); |
| 8273 | 8273 | const operand = try sema.coerce(block, bool_type, uncasted_operand, operand_src); |
| 8274 | | if (try sema.resolveDefinedValue(block, operand_src, operand)) |val| { |
| 8275 | | if (val.toBool()) { |
| 8276 | | return Air.Inst.Ref.bool_false; |
| 8277 | | } else { |
| 8278 | | return Air.Inst.Ref.bool_true; |
| 8279 | | } |
| 8274 | if (try sema.resolveMaybeUndefVal(block, operand_src, operand)) |val| { |
| 8275 | return if (val.isUndef()) |
| 8276 | sema.addConstUndef(bool_type) |
| 8277 | else if (val.toBool()) |
| 8278 | Air.Inst.Ref.bool_false |
| 8279 | else |
| 8280 | Air.Inst.Ref.bool_true; |
| 8280 | 8281 | } |
| 8281 | 8282 | try sema.requireRuntimeBlock(block, src); |
| 8282 | 8283 | return block.addTyOp(.not, bool_type, operand); |