Skip to content

objective-c: bodyless C-style prototypes are only found by accident, with a wrong body span #1336

Closed

Description

@squid-protocol

What

PR #1332 fixed func_start's recall gap for objc's -/+-prefixed method alternative (bodyless @interface declarations, e.g. - setupWindow;). The regex's OTHER alternative -- plain C-style prototypes, e.g. extern void write_rtf_header(NXStream* rtfStream); -- was deliberately left on the original brace-only path, since (unlike the method alternative) it has no exclusion shield and can already match a bare two-token statement (return foo(x);); extending bodyless-; support there risked resurrecting that false-positive class.

Consequence: a real C-style prototype like write_rtf_header is currently found ONLY when a { happens to appear later in the search window/next-match boundary -- and when it IS found, the {...} it grabs is unrelated (in the corpus case, an @interface block's own instance-variable list { ... } several lines later), giving the function a completely wrong body span / LOC / structural-impact score. If no such accidental { exists nearby, the declaration is silently dropped instead.

Confirmed via language-crucible/data/objective-c/worldwideweb/HyperText.h line 19: extern void write_rtf_header(NXStream* rtfStream); is GitGalaxy's one remaining extra_functions entry in the current tree-sitter-accuracy baseline for this file -- present only by accident, with a bogus body.

Why not fixed alongside #1332

Properly supporting this alternative needs the same kind of care as #1335's args-extraction gap -- the C-style branch's identifier capture has no exclusion shield against bare call/return statements, so accepting ; as a terminator for it needs either a real Invocation Shield or very careful adversarial testing first, not a drive-by copy of the method-alternative's fix.

Suggested next step

Likely low priority/rare (only 1 instance observed across the whole objc corpus) -- but worth fixing properly since the current behavior is silently WRONG (bogus body/LOC) rather than just missing, which is worse for downstream risk-scoring. Consider whether prototypes even belong in func_start's scope at all (a prototype has no "function body" to score) vs. being explicitly excluded.

Related: #1314, #1332, #1335, #1261 (parent epic)

Activity

  1. added
    bug
    core-engine
    on Aug 12, 2026
  2. added this to the v2.4.8 milestone on Aug 16, 2026
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

    bugcore-engine

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions