diff --git a/crates/ailang-check/src/mono.rs b/crates/ailang-check/src/mono.rs index de3d4fe..00c21af 100644 --- a/crates/ailang-check/src/mono.rs +++ b/crates/ailang-check/src/mono.rs @@ -308,20 +308,17 @@ pub fn mono_symbol(method: &str, ty: &Type) -> String { format!("{method}__{}", &full_hash[..8]) } -/// Iter 22b.3: returns the surface name iff `ty` is a zero-arity -/// primitive `Type::Con`. Used by [`mono_symbol`] to gate the -/// human-readable form. The match is intentionally narrow: -/// `Int` (which is malformed but parser-accepting) is -/// treated as compound, so it falls to the hash form. +/// Returns the surface name iff `ty` is a zero-arity primitive +/// `Type::Con`. Used by [`mono_symbol`] to gate the human-readable +/// form. The match is intentionally narrow: `Int` (malformed +/// but parser-accepting) is treated as compound, so it falls to +/// the hash form. The primitive-set itself lives in +/// [`ailang_core::primitives::primitive_surface_name`]. fn primitive_surface_name(ty: &Type) -> Option<&'static str> { match ty { - Type::Con { name, args } if args.is_empty() => match name.as_str() { - "Int" => Some("Int"), - "Bool" => Some("Bool"), - "Str" => Some("Str"), - "Unit" => Some("Unit"), - _ => None, - }, + Type::Con { name, args } if args.is_empty() => { + ailang_core::primitives::primitive_surface_name(name) + } _ => None, } }