mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-30 12:51:10 +00:00
Fix type formatting
This commit is contained in:
parent
393ce2d94a
commit
8528096a31
2 changed files with 23 additions and 15 deletions
|
@ -255,14 +255,18 @@ impl<T: LimitedDisplay> LimitedDisplay for FreeKind<T> {
|
|||
constraint,
|
||||
} => {
|
||||
if *lev == GENERIC_LEVEL {
|
||||
write!(f, "{name}(")?;
|
||||
constraint.limited_fmt(f, limit - 1)?;
|
||||
write!(f, ")")?;
|
||||
} else {
|
||||
write!(f, "?{name}(")?;
|
||||
constraint.limited_fmt(f, limit - 1)?;
|
||||
write!(f, ")")?;
|
||||
write!(f, "{name}")?;
|
||||
if cfg!(feature = "debug") {
|
||||
write!(f, "(")?;
|
||||
constraint.limited_fmt(f, limit - 1)?;
|
||||
write!(f, ")")?;
|
||||
}
|
||||
} else {
|
||||
write!(f, "?{name}")?;
|
||||
if cfg!(feature = "debug") {
|
||||
write!(f, "(")?;
|
||||
constraint.limited_fmt(f, limit - 1)?;
|
||||
write!(f, ")")?;
|
||||
write!(f, "[{lev}]")?;
|
||||
}
|
||||
}
|
||||
|
@ -274,14 +278,18 @@ impl<T: LimitedDisplay> LimitedDisplay for FreeKind<T> {
|
|||
constraint,
|
||||
} => {
|
||||
if *lev == GENERIC_LEVEL {
|
||||
write!(f, "%{id}(")?;
|
||||
constraint.limited_fmt(f, limit - 1)?;
|
||||
write!(f, ")")?;
|
||||
} else {
|
||||
write!(f, "?{id}(")?;
|
||||
constraint.limited_fmt(f, limit - 1)?;
|
||||
write!(f, ")")?;
|
||||
write!(f, "%{id}")?;
|
||||
if cfg!(feature = "debug") {
|
||||
write!(f, "(")?;
|
||||
constraint.limited_fmt(f, limit - 1)?;
|
||||
write!(f, ")")?;
|
||||
}
|
||||
} else {
|
||||
write!(f, "?{id}")?;
|
||||
if cfg!(feature = "debug") {
|
||||
write!(f, "(")?;
|
||||
constraint.limited_fmt(f, limit - 1)?;
|
||||
write!(f, ")")?;
|
||||
write!(f, "[{lev}]")?;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1192,7 +1192,7 @@ impl LimitedDisplay for Type {
|
|||
write!(f, "|")?;
|
||||
for (i, (name, constr)) in qvars.iter().enumerate() {
|
||||
if i != 0 {
|
||||
write!(f, "; ")?;
|
||||
write!(f, ", ")?;
|
||||
}
|
||||
write!(f, "{name}")?;
|
||||
constr.limited_fmt(f, limit - 1)?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue