diff options
| author | gingerBill <bill@gingerbill.org> | 2024-08-04 14:58:12 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-08-04 14:58:12 +0100 |
| commit | 0bedd3357ae709c1d35e86ce6e883964fea13fdd (patch) | |
| tree | 741e230b64e5eb33ae3422218fad161333f6796b /src | |
| parent | 93fabf862891a6ac8915aed9094cecceaa3cc61b (diff) | |
Disallow `err != 0` with `os.Error` when `-strict-style` is enabled
Diffstat (limited to 'src')
| -rw-r--r-- | src/check_expr.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 06784a7f3..b291cbe70 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -4461,7 +4461,8 @@ gb_internal void convert_to_typed(CheckerContext *c, Operand *operand, Type *tar case Type_Union: // IMPORTANT NOTE HACK(bill): This is just to allow for comparisons against `0` with the `os.Error` type // as a kind of transition period - if (operand->mode == Addressing_Constant && + if (!build_context.strict_style && + operand->mode == Addressing_Constant && target_type->kind == Type_Named && (c->pkg == nullptr || c->pkg->name != "os") && target_type->Named.name == "Error") { |