//! 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/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/float-semantics.md"), "expected NoInstance message to cross-reference the float-semantics contract, got: {:?}", no_inst.message ); }