Skip to content

kotlin func_start/args missing backtick-identifier support (found during #825) #899

Description

@squid-protocol

Follow-up from #825 (scala extraction hardening, part of epic #813). #823 (kotlin extraction hardening) already closed without catching this — filing separately rather than reopening it.

The gap

Kotlin, like Scala, allows backtick-quoted arbitrary identifiers as an escape hatch for reserved-word or space-containing names — most commonly used for test method names (fun `should return true when input is valid`() { ... }, a very common JUnit5/Kotlin idiom).

LANGUAGE_DEFINITIONS["kotlin"]["rules"]["func_start"] and ["args"] both require a plain [a-zA-Z_]\w* for the name, so a backtick-quoted identifier never matches at all:

from gitgalaxy.standards.language_standards import LANGUAGE_DEFINITIONS
r = LANGUAGE_DEFINITIONS["kotlin"]["rules"]["func_start"]
r.search("fun `should do something`() {")  # -> None (should match)

This is the same doc's-Rule-16 identifier-grammar shape confirmed as a real bug for scala in #825, fixed there as an alternative capture group (`([^`\n]{1,200})`|([a-zA-Z_]\w*)) resolved downstream via match.lastindex — no new pipeline infrastructure needed, detector.py already resolves multi-alternative name captures this way (see java's (init)|(constructor) groups).

Suggested fix

Mirror scala's #825 fix shape for kotlin's func_start and args rules. Check class_start too for completeness (backtick-quoted type names are far rarer in practice, so may not be worth it — use the same "realism triage" judgment call #825 used to skip a couple of low-value seams).

Full methodology: tests/extraction/how_to_harden_extraction.md, recurring bug class 33.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUnintended behavior or logic failure in the enginecore-engineModifications to the central physics and parsing enginepriority: highCore feature broken, but workarounds exist

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions