From a56342c6956df94b0e2c9863582b530324f8f6e9 Mon Sep 17 00:00:00 2001 From: Shunsuke Shibayama Date: Wed, 24 Jan 2024 22:51:12 +0900 Subject: [PATCH] chore: display module type (shortened) path --- crates/erg_compiler/ty/mod.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/crates/erg_compiler/ty/mod.rs b/crates/erg_compiler/ty/mod.rs index 5b7a5a4dc..faf0b6efd 100644 --- a/crates/erg_compiler/ty/mod.rs +++ b/crates/erg_compiler/ty/mod.rs @@ -1236,6 +1236,21 @@ impl LimitedDisplay for Type { } Self::Poly { name, params } => { write!(f, "{name}(")?; + if self.is_module() { + // Module("path/to/module.er") -> Module("module.er") + let name = params.first().unwrap().to_string_unabbreviated(); + let name = name.replace("__init__.d.er", "").replace("__init__.er", ""); + write!( + f, + "\"{}\")", + name.trim_matches('\"') + .trim_end_matches('/') + .split('/') + .last() + .unwrap() + )?; + return Ok(()); + } for (i, tp) in params.iter().enumerate() { if i > 0 { write!(f, ", ")?;