Files
AILang/crates/ail/tests/eq_float_noinstance.rs
T
Brummel 832375f2ac convention: counter-prefix file naming across docs/specs/, docs/plans/, design/contracts/, design/models/
All 176 files in the four accumulating directories now use a
zero-padded 4-digit counter prefix that reflects creation order
(`NNNN-slug.md`). The counter is assigned per directory in strict
git-log creation order; ties broken alphabetically by original name.
The old `YYYY-MM-DD-` prefix on docs/specs/ and docs/plans/ files is
dropped — the date is recoverable from git log and the counter
carries the ordering.

A file's counter is stable for the life of the file: never reassigned,
never reused, never compacted. Deleted files retire their counter;
subsequent files do not fill the gap. This is the property that lets
cross-references stay literal — refs use the full filename including
the counter (`design/contracts/0007-honesty-rule.md`) so they grep
cleanly and resolve directly without a glob step.

313 cross-references updated across .md/.rs/.toml/.c/.json files
(test pins, include_str! paths, design-INDEX entries, baseline notes,
runtime C comments, inter-contract markdown links incl. bare basename
and `../models/foo.md` forms).

CLAUDE.md gets a new "File-naming convention" section spelling out
the rule and rationale. skills/brainstorm/SKILL.md and
skills/planner/SKILL.md updated so new spec/plan creation produces
counter-prefixed names from the start.

The full test suite (cargo test --workspace) passes.
2026-05-28 13:31:31 +02:00

55 lines
2.1 KiB
Rust

//! Pins the Float-aware `NoInstance` diagnostic added in milestone 23.
//!
//! Property protected: a polymorphic Eq/Ord helper invoked at Float
//! fires `no-instance` (since Float has neither Eq nor Ord instance
//! per design/contracts/0005-float-semantics.md) AND the diagnostic message
//! cross-references the canonical float-semantics contract so the
//! LLM author immediately learns the partial-Float story rather
//! than seeing a bare "no instance" message.
use ailang_check::check_workspace;
use ailang_surface::load_workspace;
use std::path::PathBuf;
fn fixture(name: &str) -> PathBuf {
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("../../examples")
.join(name)
}
#[test]
fn eq_at_float_fires_float_aware_noinstance() {
let ws = load_workspace(&fixture("eq_float_noinstance.ail")).expect("load");
let diags = check_workspace(&ws);
assert!(!diags.is_empty(), "expected NoInstance diagnostic, got none");
let no_inst = diags
.iter()
.find(|d| d.code == "no-instance")
.unwrap_or_else(|| panic!("expected diagnostic with code 'no-instance', got: {diags:#?}"));
assert!(
no_inst.message.contains("Float"),
"expected Float-aware NoInstance diagnostic, got message: {:?}",
no_inst.message
);
// Cross-ref to the float-semantics contract — the LLM author should
// be pointed at the canonical explanation of partial Float orderability.
assert!(
no_inst.message.contains("design/contracts/0005-float-semantics.md"),
"expected NoInstance message to cross-reference the float-semantics contract, got: {:?}",
no_inst.message
);
// 2026-05-21 operator-routing-eq-ord: the addendum names the
// explicit IEEE-aware alternative `float_eq` (and siblings)
// alongside the contract cross-reference, so the LLM author
// learns the named-fn surface from the diagnostic itself.
assert!(
no_inst.message.contains("float_eq"),
"expected NoInstance message to name `float_eq` as the explicit IEEE-aware alternative, got: {:?}",
no_inst.message
);
}