Skip to content

Commit

Permalink
Fix boolean not
Browse files Browse the repository at this point in the history
  • Loading branch information
wtholliday committed Sep 22, 2023
1 parent 96a9921 commit 4c6d407
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/jit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,8 @@ impl<'a> FunctionTranslator<'a> {
}
Expr::Unop(expr_id) => {
let v = self.translate_expr(*expr_id, decl, decls);
self.builder.ins().bnot(v)
let bnot = self.builder.ins().bnot(v);
self.builder.ins().band_imm(bnot, 1)
}
Expr::Call(fn_id, arg_ids) => {
let f = self.translate_expr(*fn_id, decl, decls);
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/booleans.lyte
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ main {
assert(t && t)
assert(!(f || f))
assert(!(t == f))
// assert(not f == t)
assert(!f == t)
// assert(t == not f)
}

0 comments on commit 4c6d407

Please sign in to comment.