Skip to content

The redundant-annotation gate enforces return types only, not parameters or lambdas #220

Description

@MelbourneDeveloper

CLAUDE.md bans every inferable annotation, naming parameters and lambda parameters explicitly:

Never annotate function parameters, return types or lambda parameters when inferable: fn add(a, b) = a + b, not fn add(a: int, b: int) = a + b; |x| => x * 2, not |x: int| => x * 2.

crates/osprey-cli/tests/redundant_annotations.rs enforces the return half only. Its reader finds the arrow before the body and deletes the type after it; a parameter annotation is never examined, so obvious ones survive every gate.

Confirmed removable today: examples/db_postgres/pg_smoke.osp:19 — rewriting status(v: int) as status(v) still parses, still type-checks, still lowers to IR, and reports byte-identical symbols. The corpus has many more of this shape.

The existing oracle transfers unchanged and should be reused rather than reinvented: strip the candidate, then require the program to parse, type-check, lower, produce no undefined symbols, and report a byte-identical outline. Parameters need one extra care the return case does not — deleting one annotation can change what a sibling parameter infers, so candidates must be judged one at a time against the same baseline, never stripped in a batch.

Tracked alongside #215 (the same gate does not sweep ML sources).

Found during review of the enforce-inferable-annotations branch.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions