diff options
| author | gingerBill <bill@gingerbill.org> | 2025-02-24 14:07:39 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2025-02-24 14:07:39 +0000 |
| commit | c2cafcbe14566f4de4829dce95a5e5c95ec78d52 (patch) | |
| tree | 75f0ae6dba68751a2a3e30943404fa0318afaacb /src/llvm_backend_expr.cpp | |
| parent | 0781526b35434086e4350bf9d9dd2aec1f8a953e (diff) | |
Fix #4819
Diffstat (limited to 'src/llvm_backend_expr.cpp')
| -rw-r--r-- | src/llvm_backend_expr.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/llvm_backend_expr.cpp b/src/llvm_backend_expr.cpp index 9e115b9ca..b4e5c2a44 100644 --- a/src/llvm_backend_expr.cpp +++ b/src/llvm_backend_expr.cpp @@ -1554,7 +1554,7 @@ gb_internal lbValue lb_build_binary_expr(lbProcedure *p, Ast *expr) { lbValue cmp = lb_emit_comp_against_nil(p, be->op.kind, right); Type *type = default_type(tv.type); return lb_emit_conv(p, cmp, type); - } else if (lb_is_empty_string_constant(be->right)) { + } else if (lb_is_empty_string_constant(be->right) && !is_type_union(be->left->tav.type)) { // `x == ""` or `x != ""` lbValue s = lb_build_expr(p, be->left); s = lb_emit_conv(p, s, t_string); @@ -1562,7 +1562,7 @@ gb_internal lbValue lb_build_binary_expr(lbProcedure *p, Ast *expr) { lbValue cmp = lb_emit_comp(p, be->op.kind, len, lb_const_int(p->module, t_int, 0)); Type *type = default_type(tv.type); return lb_emit_conv(p, cmp, type); - } else if (lb_is_empty_string_constant(be->left)) { + } else if (lb_is_empty_string_constant(be->left) && !is_type_union(be->right->tav.type)) { // `"" == x` or `"" != x` lbValue s = lb_build_expr(p, be->right); s = lb_emit_conv(p, s, t_string); |