ac4d545570
Follow-up to bcd4181: the remaining ~530 inline `//` and `///`
comments still carrying opaque shorthand are now reformulated to
their content phrases. The only surviving `iter-<code>` reference
in source is the literal filename
`docs/journals/2026-05-13-iter-mq.3.md` (a real journal file).
Sweep covered:
- `// Iter X.Y: <text>` prefixes (Iter 13a / 14a / 14e / 15g-aux /
16b.x / 16d / 16e / 18b / 18c.x / 18d.x / 18e / 18g.x / 19a /
19a.1 / 19b / 20a / 20f / 22-floats.x / 22b.x / 22c / 23.x /
24.1 / cli-diag-human / hs.x / str-concat / etc.) — fully
removed; the descriptive text that followed each prefix stays.
- `// (Decision N)` and `per Decision N` and `Decision N axis 3` —
replaced with the content phrase plus the relevant contract
file (`design/contracts/tail-calls.md` for Decision 8,
`design/contracts/memory-model.md` for Decision 10,
`design/contracts/typeclasses.md` and `design/models/typeclasses.md`
for Decision 11, `design/contracts/authoring-surface.md` for
Decision 6, "the transitional dual-allocator" for Decision 9,
"Effect prose" for Decision 3).
- `// mq.X / mq.X (Task N) / mq.X journal / mq.X invariant` ->
"the canonical-class-form rule / Class-class repurpose /
method-dispatch-refactor journal / canonical-class-form
invariant".
- `// ct.X / ct.X (canonical-type-names) / ct.1.5a + ctt.2 /
ct.2 Task N` -> "the canonical-form rule for type references /
the canonical-form normalisation step / canonical-type-lookup
refactor".
- `// eob.X` -> "heap-Str-ABI" / "the Str carve-out".
- `// rpe.X` -> "the per-type-print-op retirement".
- `// post-mq.X / Pre-ct.X / pre-mq.X` -> "post-canonical-class-form" /
"Pre-canonical-type-form" etc.
- `/// Iter X regression: / /// Iter X.Y: / /// Iter A arm-close /
/// Iter ct.4 (...): / /// Iter rpe.1 ...` -> descriptive
phrases.
The journal filename in `crates/ailang-core/src/workspace.rs:573`
stays verbatim because it points at an actual file under
`docs/journals/`.
Tests: full `cargo test --workspace` green (80/80 test-result blocks
clean, no FAILED line). design_index_pin 5/5 + docs_honesty_pin 5/5
gating tests pass.
77 lines
3.3 KiB
Rust
77 lines
3.3 KiB
Rust
//! Repurposed pin tests for the post-`MethodNameCollision`-retirement
|
|
//! workspace-load path. The two on-disk fixtures that fired
|
|
//! `WorkspaceLoadError::MethodNameCollision` before the type-driven
|
|
//! dispatch refactor now load cleanly;
|
|
//! the assertion migrates from "expect collision diagnostic" to "load
|
|
//! successful + `Env.method_to_candidate_classes` carries the
|
|
//! expected multi-entry set" (class-class case) or "load successful +
|
|
//! class-fn coexistence is legal" (class-fn case).
|
|
//!
|
|
//! The relocation from `crates/ailang-core/src/workspace.rs` to this
|
|
//! file is required because the post-retirement assertions read
|
|
//! `Env.method_to_candidate_classes`, which is built by `ailang-check`
|
|
//! (`build_check_env`) and not visible from `ailang-core`.
|
|
|
|
use ailang_check::build_check_env;
|
|
use ailang_surface::load_workspace;
|
|
use std::path::Path;
|
|
|
|
fn examples_dir() -> std::path::PathBuf {
|
|
let manifest = env!("CARGO_MANIFEST_DIR");
|
|
Path::new(manifest)
|
|
.parent().expect("CARGO_MANIFEST_DIR has a parent (crates/ailang-check)")
|
|
.parent().expect("CARGO_MANIFEST_DIR has a grandparent (crates/)")
|
|
.join("examples")
|
|
}
|
|
|
|
/// Class-class repurpose: the fixture
|
|
/// `examples/test_22b2_method_name_collision_class_class.ail.json`
|
|
/// declares two classes `A` and `B` in the same module, each declaring
|
|
/// the method `foo`. Pre-canonical-class-form this fired
|
|
/// `WorkspaceLoadError::MethodNameCollision { kind: "class-class" }`.
|
|
/// Post-canonical-class-form the workspace loads cleanly and
|
|
/// `env.method_to_candidate_classes` carries both qualified classes as
|
|
/// candidates for the method name `foo`.
|
|
#[test]
|
|
fn mq3_class_class_collision_loads_clean_and_populates_candidates() {
|
|
let entry = examples_dir()
|
|
.join("test_22b2_method_name_collision_class_class.ail");
|
|
let ws = load_workspace(&entry)
|
|
.expect("post-canonical-class-form: workspace loads without collision diagnostic");
|
|
|
|
let env = build_check_env(&ws);
|
|
let candidates = env
|
|
.method_to_candidate_classes
|
|
.get("foo")
|
|
.expect("`foo` must be in method_to_candidate_classes");
|
|
assert!(
|
|
candidates.contains("test_22b2_method_name_collision_class_class.A"),
|
|
"candidates must include class A: {candidates:?}",
|
|
);
|
|
assert!(
|
|
candidates.contains("test_22b2_method_name_collision_class_class.B"),
|
|
"candidates must include class B: {candidates:?}",
|
|
);
|
|
assert_eq!(
|
|
candidates.len(),
|
|
2,
|
|
"exactly two candidate classes for `foo`: {candidates:?}",
|
|
);
|
|
}
|
|
|
|
/// Class-fn repurpose: the fixture
|
|
/// `examples/test_22b2_method_name_collision_class_fn.ail.json`
|
|
/// declares `class Greet { greet }` and `fn greet`. Pre-canonical-class-form this
|
|
/// fired `WorkspaceLoadError::MethodNameCollision { kind: "class-fn" }`.
|
|
/// Post-canonical-class-form the workspace loads cleanly — the method-vs-fn
|
|
/// coexistence is now legal at load time; the call-site emits a
|
|
/// `class-method-shadowed-by-fn` warning (covered by the multi-class E2E,
|
|
/// not this load-level pin).
|
|
#[test]
|
|
fn mq3_class_fn_collision_loads_clean() {
|
|
let entry = examples_dir()
|
|
.join("test_22b2_method_name_collision_class_fn.ail");
|
|
load_workspace(&entry)
|
|
.expect("post-canonical-class-form: workspace loads — class-vs-fn name overlap is no longer a load error");
|
|
}
|