Skip to content

Go macros: the rule matches only //go: pragma comments, which are blanked before the rule runs (dead outside a raw string) #9429

Backlog

Description

@squid-protocol

Found by the SOP-002 gap-cell decoy work (protocol SOP-002-v1, epic #8863), batch c.

go.py macros is ^//go:(?:generate|build|noinline|nosplit|noescape|linkname)\b (re.M). Every one of those is a // line comment, and Prism blanks line comments before the rule loop, so the rule can never see a real pragma.

Snippet (through Prism(...).split_streams() + StructuralExtractor("go", ...).splice()):

//go:generate stringer -type=Color

Expected: macros >= 1 (contract: "a compile-time code-generation directive ... a compiler pragma -- in directive form").
Actual: 0. Also 0 for //go:noinline above a func, and with package main before it. The only input that fires the rule is a pragma-looking line inside a multi-line backtick raw string (a string, not a pragma).

Note #9343 solved the same shape for decorators by reading the raw lines in detector._go_leading_pragmas; macros has no such path. Without a fix the cell has no authentic positive control, so the decoy suite carries a strict xfail and no baseline row.

Activity

  1. added
    bug
    on Nov 26, 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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions