Repository navigation
Description
Summary
Haskell's idiomatic "prime" naming convention (f/f', go/go', convertWithOpts/convertWithOpts') is not preserved through the detection pipeline. Primed siblings are incorrectly deduplicated and merged with their unprimed counterparts, resulting in false negatives (missing primed function) and false positives (bogus entries under wrong names at wrong line numbers).
Details
The func_start regex correctly captures primed names: tested in isolation, convertWithOpts' :: ... \n convertWithOpts' scriptingEngine istty datadir opts = do matches with group "convertWithOpts'" intact, and the name-capture character class ([a-zA-Z_][a-zA-Z0-9_\']*) includes ' as expected.
However, in the actual engine output, the primed sibling is lost downstream. Concrete repro using pinned language-crucible/data/haskell/pandoc corpus:
-
Real definitions:
convertWithOpts(line 83-84, 2 args)convertWithOpts'(line 138-144, 4 args, the real workhorse the first one delegates to)
-
Actual database state after scan (via
galaxyscope language-crucible/data/haskell/pandoc --config .galaxyscope.yaml --db-onlyand queryingfunction_data):- Only 2 rows for this name-family, both stored as
convertWithOpts(no prime) - First row: correct at start_line≈84 with args=2
- Second row: bogus at start_line≈128 with args=4
- Line 128 is neither definition's real line (83-84 vs 138-144) — it's in the Haskell: detector.py's start_line looks shifted by roughly one prior function when short definitions are stacked #1532 shift range
- Only 2 rows for this name-family, both stored as
-
Result: The real
convertWithOpts'function name never appears in the database. Its identity (trailing') was dropped and it got folded into theconvertWithOptsname family, with a start_line landing in between the two real definitions.
Root Cause
Most likely not a regex capture problem, but detector.py's "same-name continuation walk" / _slice_by_indentation dedup logic (the same subsystem referenced in the func_start regex's own inline comment about deduping same-name-same-indent clauses) is comparing names in a way that treats convertWithOpts and convertWithOpts' as the same key — losing the prime distinction.
Impact
Double fault:
- Real primed function's args-count and identity are never recorded (false negative — "missing")
- Bogus entry appears under wrong (unprimed) name at a line belonging to neither real definition (false positive — misattribution)
Related Work
- Haskell: detector.py's start_line looks shifted by roughly one prior function when short definitions are stacked #1532 (open) — similar downstream dedup issues
- haskell func_start: typeclass instance methods and where-clause locals without an explicit '::' signature are structurally invisible #1442 (closed)
- haskell func_start: hardcoded '< 2 lines' floor in _slice_by_indentation drops every abstract typeclass method signature #1435 (closed)
- haskell func_start matches point-free VALUE bindings (no arrow in type) as if they were functions #1312 (closed)
Activity
fix(haskell): correct line-shift, let-binding blindness, and prime-na…