iter ct.2.2-doctidy: refresh stale doc-comments on UnknownCtorInPattern and mono_xmod_ctor_pattern

This commit is contained in:
2026-05-11 09:16:20 +02:00
parent 0044467425
commit edb694fdce
2 changed files with 15 additions and 7 deletions
+10 -5
View File
@@ -48,14 +48,19 @@ fn examples_dir() -> PathBuf {
/// `head_or_zero : test_mono_ctor_listmod.List<Int> -> Int` that
/// matches on `Cons h _ | Nil`.
///
/// Pre-fix repro: `monomorphise_workspace` returns
/// Pre-ct.2 repro: `monomorphise_workspace` returned
/// `Err(CheckError::PatternTypeMismatch { ctor: "Cons", ty:
/// "test_mono_ctor_listmod.List<Int>" })`. The same workspace
/// typechecks cleanly because `check_in_workspace` clears the flat
/// `ctor_index` before running `Pattern::Ctor` resolution.
/// typechecked cleanly because the typecheck pass overlaid a
/// per-module `ctor_index` whose imports-fallback produced the
/// qualified `resolved_type_name`, while the mono pass kept the
/// workspace-flat index whose local hit produced the bare one.
///
/// Post-fix expectation: `monomorphise_workspace` returns `Ok` and the
/// `head_or_zero` fn body's match arm types correctly.
/// Post-ct.2 expectation: `monomorphise_workspace` returns `Ok`
/// because the Pattern::Ctor lookup no longer consults
/// `ctor_index` at all — it walks directly from the scrutinee's
/// canonical `Type::Con.name` to its TypeDef in
/// `env.module_types` and validates the ctor by name there.
#[test]
fn mono_pass_handles_xmod_ctor_pattern() {
let entry = examples_dir().join("test_mono_ctor_main.ail.json");
+5 -2
View File
@@ -345,8 +345,11 @@ pub enum CheckError {
#[error("type `{ty}` has no constructor `{ctor}`")]
UnknownCtor { ty: String, ctor: String },
/// A pattern referenced a ctor not in [`Env::ctor_index`]. Code:
/// `unknown-ctor-in-pattern`.
/// A pattern referenced a ctor that does not exist in the
/// scrutinee's resolved [`TypeDef`]. The Pattern::Ctor lookup
/// is type-driven (post-ct.2): it walks `td.ctors` for the
/// `expected` Type::Con's TypeDef and reports this code when
/// no ctor of that name is present. Code: `unknown-ctor-in-pattern`.
#[error("unknown constructor `{0}` in pattern")]
UnknownCtorInPattern(String),