Float-NoInstance diagnostic should branch on method name (compare vs eq/lt/le/gt/ge) #25

Closed
opened 2026-05-21 01:35:55 +02:00 by Brummel · 0 comments
Owner

Surfaced by fieldtest 2026-05-21 (operator-routing-eq-ord milestone, commit 505eb84). The Float-aware NoInstance addendum at crates/ailang-check/src/lib.rs:856-880 currently emits the same hint for any Eq/Ord method at Float — use float_eq / float_lt (and siblings) for explicit IEEE-aware comparison.

For (app eq …) / (app lt …) / (app gt …) etc. this is informative. For (app compare …) it is incomplete: compare returns Ordering (three-way LT/EQ/GT), but no float_compare ships and the spec deliberately decided not to ship one (docs/specs/2026-05-20-operator-routing-eq-ord.md:433-436). The LLM-author who reached for compare because they need three-way is left guessing whether to reconstruct it from float_lt + float_eq themselves.

Fix: branch the addendum on the called method name. The eq/ne/lt/le/gt/ge arm keeps the current wording. The compare arm gets a one-sentence addendum: 'no float_compare ships — build a three-way Ordering from float_lt + float_eq if you need it'.

Scope: one diagnostic-text branch in crates/ailang-check/src/lib.rs:856-880, plus the existing crates/ail/tests/eq_float_noinstance.rs extended with a compare-at-Float case asserting the new wording.

Out of scope: shipping a float_compare fn (the spec's deliberate non-ship; the friction is the diagnostic doesn't acknowledge the deliberate omission).

context: fieldtest spec at docs/specs/2026-05-21-fieldtest-operator-routing-eq-ord.md (§[friction]).

Surfaced by fieldtest 2026-05-21 (operator-routing-eq-ord milestone, commit 505eb84). The Float-aware NoInstance addendum at `crates/ailang-check/src/lib.rs:856-880` currently emits the same hint for any Eq/Ord method at Float — `use float_eq / float_lt (and siblings) for explicit IEEE-aware comparison`. For `(app eq …)` / `(app lt …)` / `(app gt …)` etc. this is informative. For `(app compare …)` it is incomplete: `compare` returns Ordering (three-way LT/EQ/GT), but no `float_compare` ships and the spec deliberately decided not to ship one (docs/specs/2026-05-20-operator-routing-eq-ord.md:433-436). The LLM-author who reached for `compare` because they need three-way is left guessing whether to reconstruct it from `float_lt` + `float_eq` themselves. **Fix:** branch the addendum on the called method name. The `eq`/`ne`/`lt`/`le`/`gt`/`ge` arm keeps the current wording. The `compare` arm gets a one-sentence addendum: 'no float_compare ships — build a three-way Ordering from float_lt + float_eq if you need it'. **Scope:** one diagnostic-text branch in `crates/ailang-check/src/lib.rs:856-880`, plus the existing `crates/ail/tests/eq_float_noinstance.rs` extended with a `compare`-at-Float case asserting the new wording. **Out of scope:** shipping a `float_compare` fn (the spec's deliberate non-ship; the friction is *the diagnostic doesn't acknowledge the deliberate omission*). **context:** fieldtest spec at `docs/specs/2026-05-21-fieldtest-operator-routing-eq-ord.md` (§[friction]).
Sign in to join this conversation.