Skip to content

Groovy: branch counts the ?. operator and misses && and ||; bitwise_ops counts =~ and ==~ #8912

Closed

Description

@squid-protocol

What is wrong

Groovy branch and bitwise_ops count things that are not decisions or bit operations. Found with a Groovy oracle on the pinned language-crucible (709 functions matched; args 0.98 / 1.00; branch recall 0.89, precision 0.60; without the shapes below precision is 0.98). Note the Groovy tree-sitter grammar is weak (about 10% of the corpus lands in error nodes), so this oracle is a lexer plus function heads.

Reproduce (pinned scanner; counts read from function_data)

def chain(a) { return a?.b?.c }          // struct_branch == 2, should be 0
def bools(a, b, c) { return a && b || c }   // 0 (a boolean-operator decision, #8905)
def rx(s) { return s ==~ /a-b/ }         // bitwise_ops == 1, should be 0
def realIf(a) { if (a) { return 1 }; return 0 }   // branch 1, correct

Expected

Anchor the ? on ternary position (and count Elvis ?: once as the value-selection operator the contract names); do not count ?.. Leave the boolean-operator question to #8905. Exclude =~, ==~ and ~ in a regex-operator position from bitwise_ops.

Part of #8863. Time the change; rosetta:rebless-owed if counts move; add each case as a test.

Activity

  1. added
    bug
    core-engine
    on Nov 21, 2026
  2. squid-protocol commented on Nov 22, 2026

    @squid-protocol
    OwnerAuthor

    Partly covered by #8939: boolean operators are now the separate short_circuit family (Groovy gets a rule), so &&/|| do NOT belong in branch. PR #9018 (which added them to branch) was closed as superseded at the owner's direction. Still open here, to redo on top of the split after #8939 lands: ?. leaving branch, and =~ ==~ leaving bitwise_ops.

  3. squid-protocol commented on Nov 22, 2026

    @squid-protocol
    OwnerAuthor

    Claimed by promoter-bot host melek, lease renewed 2026-11-23T12:31Z. It lapses after 6 h without a renewal. To take it back, assign someone or remove the claim:melek label.

  4. squid-protocol commented on Nov 23, 2026

    @squid-protocol
    OwnerAuthor

    Fixed by #9111 (merged as fcc440b), which carried this issue's PR (rebuilt with eight others to re-bless the golden snapshots once).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugclaim:melekcore-enginepriority: medium

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions