Skip to content

Commit 861b62b

Browse files
Dale-Blackclaude
andcommitted
Fix not_int for Core.Const(false): use logical NOT, not bitwise
In unoptimized IR, the === comparison result type can be Core.Const(false) instead of Bool. Check both for logical NOT. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 637cc49 commit 861b62b

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/compiler/codegen.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1735,7 +1735,8 @@ function compile_intrinsic(ctx::JSCompilationContext, name::Symbol, args::Abstra
17351735
elseif name === :not_int
17361736
# Bool: use logical NOT; integers: use bitwise NOT
17371737
arg_type = _get_ssa_type(ctx, args[1])
1738-
if arg_type === Bool
1738+
is_bool = arg_type === Bool || (arg_type isa Core.Const && arg_type.val isa Bool)
1739+
if is_bool
17391740
return "!($(compiled_args[1]))"
17401741
end
17411742
return "(~$(compiled_args[1]))"

0 commit comments

Comments
 (0)