parent
85d1885375
commit
66f13ba807
|
@ -12210,7 +12210,8 @@ static IrInstruction *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp *
|
|||
return is_non_null;
|
||||
}
|
||||
} else if (op1->value.type->id == ZigTypeIdNull || op2->value.type->id == ZigTypeIdNull) {
|
||||
ir_add_error_node(ira, source_node, buf_sprintf("comparison against null can only be done with optionals"));
|
||||
ir_add_error_node(ira, source_node, buf_sprintf("only optionals (not '%s') can compare to null",
|
||||
buf_ptr(&(op1->value.type->id == ZigTypeIdNull ? op2->value.type->name : op1->value.type->name))));
|
||||
return ira->codegen->invalid_instruction;
|
||||
}
|
||||
|
||||
|
|
|
@ -839,7 +839,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
|
|||
\\ _ = &x == null;
|
||||
\\}
|
||||
,
|
||||
"tmp.zig:3:12: error: comparison against null can only be done with optionals",
|
||||
"tmp.zig:3:12: error: only optionals (not '*i32') can compare to null",
|
||||
);
|
||||
|
||||
cases.add(
|
||||
|
|
Loading…
Reference in New Issue