Repository navigation
Description
What is wrong
bitwise_ops is wrong in both directions, in every language checked. The contract (signal_contracts.py, declared) is: a bitwise operator applied between value operands -- shift, and, or, xor, or the unary complement -- in operator position. Scored against that, on real repositories:
| language | repository | oracle sees a bitwise operator in | family fires in | recall | precision |
|---|---|---|---|---|---|
| Java | retrofit | 4 functions | 291 | 0.75 | 0.01 |
| Rust | tokio | 177 | 1,071 | 0.40 | 0.07 |
| TypeScript | vue | 3 | 40 | 1.00 | 0.07 |
| Python | GitGalaxy | 2,294 | 6,700 | 0.43 | 0.15 |
| Go | prometheus | 140 | 115 | 0.61 | 0.74 |
| JavaScript | express | 2 | 3 | 1.00 | 0.67 |
| C | redis | 1,129 | 597 | 0.46 | 0.88 |
Three mechanisms, reproduced on tiny files (the string one is documented behaviour, see below):
- Closing generics are counted as a right shift (precision).
Map<String, List<String>>contains>>. A Java, Rust or TypeScript function that only mentions a nested generic type scores 2 and has no shift anywhere. This is why the generic-heavy languages sit at 0.01-0.07. - Characters inside string literals are counted (precision). This one is documented engine behaviour, not a regression: prism/detector: string-literal shielding is selective by signal family (if/try/open count inside a literal, eval does not) #2535 was closed as not-a-bug because the engine has no string-literal shielding for structural signals (only comments are stripped), and keyword-rosetta's string decoy expects the +1. It conflicts with the contract's "in operator position", so it is a decision, not a fix: either strings are shielded for operator families, or the contract says text in a literal counts.
printf("a >> b ^ c ~ d << e")scores 4 in C;fmt.Println("a >> b ^ c ~ d << e")scores 3 in Go. Python's 0.15 precision is partly this (the engine is full of regex strings); how much is not yet separated from the generics and other mechanisms. &and|are not counted (recall), though the contract names "and, or". The Python rule is<<|>>|\^|~on purpose (set and dict operators), but the contract does not exempt them. In C the family misses&in 977 functions and|in 312; in Python|in 1,014 and&in 925; in Rust&,|,|=in 63, 37 and 37.
Reproduce
class A {
Map<String, List<String>> generics(Map<String, List<String>> m) { return m; } // bitwise_ops == 2, should be 0
int shifts(int a) { return a << 2; } // 1, correct
}fn generics(m: HashMap<String, Vec<String>>) -> HashMap<String, Vec<String>> { m } // 2, should be 0function generics(m: Map<string, Array<string>>): Map<string, Array<string>> { return m; } // 2, should be 0int plain(int a) { printf("a >> b ^ c ~ d << e\n"); return a; } // 4, should be 0func plain() { fmt.Println("a >> b ^ c ~ d << e") } // 3, should be 0Expected
bitwise_ops counts bitwise operators in operator position and not a >> that closes a generic argument list. Either & and | count (as the contract says) or the contract says why they do not. For text in strings, decide between shielding it (comment parity) and amending the contract (#2535's position). The same text-rule shape is in many language files, so this is a class: audit every language's bitwise_ops rule, starting with the generic-heavy ones (Java, C#, Kotlin, Scala, Swift, TypeScript, Rust, C++).
How this was found, and a correction
The keyword-family validity tool (#8864) scores each family against tree-sitter (Python: ast). Oracle caveats: type unions (str | None) are not counted in Python, and a closure's |x| parameters are not binary operators in the tree-sitter grammars. Correction (2026-11-21): this issue first posted precision figures (0.01-0.67) from an oracle that read the contract too narrowly (left out & and |); the table above is the contract-aligned reading, which also exposes mechanism 3.
Part of #8863. Time every keyword change (CPU seconds on keyword-rosetta and language-crucible); rosetta:rebless-owed if counts move; add each case above as a test.
Activity
[-]bitwise_ops counts closing generics (Java, Rust, TypeScript) and string text (C, Go, JavaScript): precision 0.01-0.67 in six languages[/-][+]bitwise_ops: counts closing generics and string text, and ignores & and | that its contract names (seven languages; Java precision 0.01)[/+][-]bitwise_ops: counts closing generics and string text, and ignores & and | that its contract names (seven languages; Java precision 0.01)[/-][+]bitwise_ops: counts closing generics as a shift and ignores & and | that its contract names; string text counts by design (#2535) against the contract[/+]squid-protocol commentedon Nov 21, 2026
Claimed by promoter-bot host
melek, lease renewed 2026-11-21T15:45Z. It lapses after 6 h without a renewal. To take it back, assign someone or remove theclaim:meleklabel.squid-protocol commentedon Nov 21, 2026
PR #8901 fixes mechanism 1 (closing generics counted as a shift) for Java, Rust, TypeScript and C#. Left over: (a) the same generic
>>hazard in Swift, Scala, Dart, Apex, Zig (one-line fix each); (b) mechanism 3,&and|not counted, in C, Python, Rust, Java (needs a per-language design for&&,||,&mut, closure|x|, type unions); (c) mechanism 2, text in strings: owner decision, untouched. No burned-estate program needs any of these.squid-protocol commentedon Nov 21, 2026
More languages for this class (found by the validity tool, verified on tiny files): Dart
List<List<int>>scores bitwise 2 (the closing-generics mechanism; see the Dart issue); Objective-C counts the block caret^{and address-of&aas bitwise (precision 0.01); C++ goes the other way:(a << 2) | (b & 3)scores bitwise 0 (recall 0.30 on opencv), so its rule appears to leave out<<,>>,&and|, possibly on purpose because<<is stream insertion; the contract counts shifts in operator position, so that is a decision for the maintainers.squid-protocol commentedon Nov 21, 2026
One more language for the closing-generics class (verified on a tiny file): Apex
Map<String, Map<String, String>> m = new Map<String, Map<String, String>>();scores bitwise 2 (the nested>>read as a shift).fix(python): .filter( is not a comprehension; bitwise string test doc…
bitwise_ops: a >> closing a generic list is not a shift (Java, Rust, …