You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
analyzer: report a bitwise |, & or ^ on bool operands #1092
Filed from Ambiguous-Interactive/IshoBoy#1411, where the owner asked for boolean logic over bitwise logic wherever possible.
What to report
A |, & or ^ operator, or its compound form (|=, &=, ^=), whose operands are bool or bool?.
// report: reads as a bit operation, and hides which side had to runannounced|=ShowMarker(pickUp);returninteractMoved|holdDropMoved;inside^=Crosses(start,end);// the house formsboolpickUpAnnounced=ShowMarker(pickUp);announced=announced||pickUpAnnounced;returninteractMoved||holdDropMoved;if(Crosses(start,end)){inside=!inside;}
Why an analyzer
The operand type decides it, and a text scan cannot see the type. IshoBoy measured both:
instrument
sites found in 943 files
Roslyn, every operand typed
18
IshoBoy's text rule (lint_csharp_bitwise_bool.py: a name the same file declares bool)
18 today
The text rule found the same 18 today. It cannot see a bool from another file, such as other.IsReady | x. An int that shares a name with a bool in the same file reads as a finding.
What it should not report
An integer or enum operand, such as flags, masks or hashes.
A bool packed into an integer, such as (a ? 1 : 0) | (b ? 2 : 0). The operands are int.
A user-defined operator | on a type other than bool.
Message
Name the house form and the side-effect trap: x |= Call() must keep the call, so the fix is a named local, not x = x || Call().
When this ships, IshoBoy can delete its text rule.
WUH026 reports all six built-in boolean/nullable-boolean operator forms. It excludes integer masks, enum flags, packed booleans, and overloaded operators. It remains a suppressible warning and skips generated code. The message and guide explain required calls, evaluation order, and nullable truth tables; there is no automatic fix.
Local evidence:
50 focused analyzer cases and all 1,079 analyzer tests passed.
Every owned source gate and the excluded-source audit proved WUH026 reporting through real compiled controls.
The complete clean compilation matrix passed. Both affected shipped compiler DLLs match fresh Release builds.
Native Unity 6000.4.6f1 passed 268 editor and 416 runtime cases covering affected tools, sorting, and random contracts. A further 55 policy cases passed after the final example presentation edit.
Protobuf compatibility suites passed 2,168 v3 and 2,137 v2 cases after preserving generator propagation calls.
The PR adds the policy-window entry and examples, documentation, and changelog. CI and automated review are now running.
Activity
wallstop commentedon Oct 30, 2026
DISCLOSURE: LLM-GENERATED TEXT
Implemented in PR #1098, commit
45216ced.WUH026 reports all six built-in boolean/nullable-boolean operator forms. It excludes integer masks, enum flags, packed booleans, and overloaded operators. It remains a suppressible warning and skips generated code. The message and guide explain required calls, evaluation order, and nullable truth tables; there is no automatic fix.
Local evidence:
The PR adds the policy-window entry and examples, documentation, and changelog. CI and automated review are now running.