From df9a5a9bebc3e011fb20d66432dbe0160c3bce85 Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Sat, 3 Oct 2026 09:07:04 +0800 Subject: [PATCH] =?UTF-8?q?fix(expr):=20=E4=BF=AE=E5=A4=8D=20not=20?= =?UTF-8?q?=E4=B8=80=E5=85=83=E8=BF=90=E7=AE=97=E6=9C=AA=E5=8F=96=E5=8F=8D?= =?UTF-8?q?=EF=BC=88i1=20=E6=9D=A1=E4=BB=B6=E4=B8=8E=200=20=E6=AF=94?= =?UTF-8?q?=E8=BE=83=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit not x 的降级此前写成 (bool(x) == 1),在 i1 上与恒等等价,导致 not r2 不取反(FuncTest Test 7 bool return 失败)。注释本意即 not x = (bool(x) == 0),改为与 i1 常量 0 比较。 --- App/lib/core/Gen/Expr/ExprGenOps.vp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/App/lib/core/Gen/Expr/ExprGenOps.vp b/App/lib/core/Gen/Expr/ExprGenOps.vp index 767d25f..f59336a 100644 --- a/App/lib/core/Gen/Expr/ExprGenOps.vp +++ b/App/lib/core/Gen/Expr/ExprGenOps.vp @@ -791,8 +791,8 @@ novirtual class ExprGenOps(ExprGenBase.ExprGenBase): not_cond: llvmlite.Value* = self.coerce_cond_to_bool(pool, builder, mod, operand, trans) if not_cond is None: return None - true_val: llvmlite.Value* = llvmlite.const_int(pool, 1, 1) - return llvmlite.build_icmp(builder, llvmlite.ICMP_EQ, not_cond, true_val) + false_val: llvmlite.Value* = llvmlite.const_int(pool, 0, 1) + return llvmlite.build_icmp(builder, llvmlite.ICMP_EQ, not_cond, false_val) elif uo.op == ast.OpKind.Invert: # ~x = x ^ -1 operand_bits_inv: int = self.get_llvm_type_bits(operand.Ty)