Skip to content

Commit

Permalink
chore: display module type (shortened) path
Browse files Browse the repository at this point in the history
  • Loading branch information
mtshiba committed Jan 24, 2024
1 parent c514d0d commit a56342c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions crates/erg_compiler/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, ", ")?;
Expand Down

0 comments on commit a56342c

Please sign in to comment.