Credence.Syntax.PreferSpecArrowOperator (credence v0.8.0)

Copy Markdown

Fixes @spec declarations where the :: arrow operator is missing before the return type.

LLMs repeatedly generate @spec fn(args) return_type() missing the :: arrow before the return type — a syntax parse failure.

Bad (won't parse)

@spec get_days_between_dates(String.t(), String.t()) integer()

Good

@spec get_days_between_dates(String.t(), String.t()) :: integer()

Detection

Finds @spec lines where the matching ) for the opening ( is followed by a type expression but no :: separator. Lines with a guard clause (when ...) are not flagged — the missing-arrow after a guard is a different, more complex fault.