Skip to content

groovy func_start: paren-less builder call (raw _("x")) misdetected as function when no longer masked by a nested FP #2558

Closed

Description

@squid-protocol

Summary

Found while fixing #2530 (MarkupBuilder/Jenkins-DSL named-argument-map calls misdetected as
zero-prefix function declarations). Removing that false positive unmasked a second, unrelated
func_start defect in a different branch of the same regex.

Evidence

language-crucible/data/groovy/jenkins_view_groovy/hudson_triggers_SlowTriggerAdminMonitor_message.groovy:11-16:

div(class: "jenkins-alert jenkins-alert-warning") {
    form(method: "post", name: "clear", action: rootURL + "/" + tam.url + "/clear") {
        button(name: "clear", type: "submit", class: "jenkins-button jenkins-submit-button jenkins-button--primary") {
            raw _("Dismiss")
        }
    }

raw _("Dismiss") is a paren-less single-argument method call (Groovy allows omitting the
outer parens: raw(_("Dismiss"))), not a declaration. But func_start's branch 1 (the
>=1-prefix-token branch, needed to match real modifier/type-prefixed signatures) treats the
bare identifier raw as if it were a type/modifier prefix token (it matches the branch's
[a-zA-Z_][a-zA-Z0-9_<>\[\]?,\.]* prefix alternative), then captures _ as the "function name"
since _( immediately satisfies branch 1's lenient (?=[ \t\n]*\() lookahead (branch 1 doesn't
require a matching close-paren or trailing {, unlike branch 2).

Confirmed this raw-regex match already existed before #2530's fix too (verified via
git stash + direct finditer), but was silently absorbed/suppressed downstream because it fell
inside the line range of the (incorrectly detected) enclosing button(...) { ... } match. Once
#2530's fix correctly excludes button as a false positive, raw _(...) is no longer nested
inside anything, so it surfaces as its own top-level match — and its own body-boundary search
(finding the next unmatched { and walking to balance) then over-absorbs unrelated sibling
content, since there's no longer a smaller, earlier, correctly-bounded match to claim that span
first. Full-corpus diff (201 files) confirms this is isolated: exactly one new match, only in
this file.

_extract_name can't resolve a clean name for this shape either, so it surfaces as the generic
Unknown_Block fallback (same fallback already used for l.layout(...)/l.main_panel()
qualified-form matches noted in #2530).

Why this wasn't fixed alongside #2530

Different branch (branch 1, not branch 2), different mechanism (a paren-less call being treated
as a modifier-prefixed declaration, not a named-argument-map call matching a zero-prefix
declaration), and a pre-existing defect independently of that fix -- bundling it in would have
conflated two unrelated root causes in one PR/verification pass.

Suggested next step

Investigate whether branch 1's prefix-token alternation can exclude a bare identifier
immediately followed by whitespace then another bare identifier/underscore-name and ( with no
assignment/type context (i.e. word word(...) where the first word isn't a real
modifier/type keyword and there's no trailing {) without rejecting legitimate multi-word
signatures (public String name(...), Map<String,String> config(...)). May need its own
design pass similar to #2530's, since Groovy's optional-parens call syntax makes this a similar
class of lexical ambiguity, not a simple keyword-list gap.

Activity

  1. squid-protocol commented on Sep 4, 2026

    @squid-protocol
    OwnerAuthor

    Shipped in #2677 (B.3 wave 1 of #2669) together with #2676: groovy func_start no longer reads paren-less builder calls as declarations. Stayed open because #2677's Closes was a comma-list, which GitHub parses only for the first reference. Closing as done.

  2. added
    scope:frontier
    on Oct 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

    scope:frontier

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions