Skip to content

haskell func_start: guard-only defining equations (no '=' on the naming line) are structurally invisible #1616

Closed

Description

@squid-protocol

Summary

A local binding whose defining equation puts its guards (| cond = expr) on separate, more-indented lines — with no = anywhere on the line that introduces the name and its pattern — is never matched by func_start. This is a distinct shape from #1615 (single-line where): here where/let is on its own line (or absent), but the name+pattern line itself has no = at all.

Root Cause

func_start's equation-anchored alternative requires an = on the SAME line as the captured name, via the trailing lookahead (?=[ \t]+[^\s=][^\n=]*(?<![!<>/])=(?![=>])) (the [^\n=]* is explicitly bounded to the current line). Idiomatic Haskell routinely omits the = from the naming line entirely when the equation uses guards instead of a bare RHS:

isAllowedPunct c
  | extensionEnabled Ext_gfm_auto_identifiers exts = c == '-' || c == '_' || ...
  | otherwise = c == '_' || c == '-' || c == '.'

isAllowedPunct c (the naming/pattern line) has no = on it — the = only appears on the guard lines below — so the lookahead never has anything to match on that line, and the whole definition is invisible.

Verification

Confirmed real-world misses in the pinned language-crucible/data/haskell/pandoc corpus (found via the clause-collapsed recall check in #1614 — these are genuine misses, not clause-counting artifacts):

  • isAllowedPunct (Shared.hs:500) — isAllowedPunct c then two |-guard lines
  • stripBeginSpace (Shared.hs:202, nested where inside trimMath) — stripBeginSpace t then three |-guard lines
  • ensureNl (App.hs:329) — let ensureNl t then three |-guard lines (also combines with the let shape, but let alone is already skippable via haskell func_start: single-line let name args = expr local bindings are structurally invisible #1564 — the guard-only naming line is the actual blocker here)
  • adjustNum (Shared.hs:535) — let adjustNum lev numComponent then three |-guard lines (same combination as ensureNl)

Proposed Fix

Extend the equation-anchored alternative to also recognize a naming/pattern line with no = when it's immediately followed by one or more indented guard lines (| ... = ...) at a deeper indent, ending the block at the first line that dedents back to the naming line's own indent (same dedent-scan mechanism _slice_by_indentation already uses elsewhere) — analogous in spirit to #1435's fix for bodyless typeclass method signatures (also a "no = on the anchoring line" shape, there because the definition doesn't exist yet rather than because of guards).

Important: This is a detector.py/language_standards.py regex change and needs the Differential Scan protocol (crucible_check.py) before merging per CLAUDE.md.

Related Work

Activity

  1. added
    bug
    testing
    core-engine
    threat: false-negative
    on Aug 14, 2026
  2. added a commit that references this issue on Aug 15, 2026
    9e57ad2
  3. 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-enginepriority: mediumtestingthreat: false-negative

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions