Skip to content

Commit

Permalink
Merge pull request #1146 from asymmetric/type-vars
Browse files Browse the repository at this point in the history
Fix printing of higher-order funcs with type vars
  • Loading branch information
yannham authored Feb 27, 2023
2 parents 5941884 + d715b3b commit 8f1752f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ impl Display for Types {
TypeF::Record(row) => write!(f, "{{{row}}}"),
TypeF::Dict(ty) => write!(f, "{{_: {ty}}}"),
TypeF::Arrow(dom, codom) => match dom.0 {
TypeF::Arrow(_, _) => write!(f, "({dom}) -> {codom}"),
TypeF::Arrow(_, _) | TypeF::Forall { .. } => write!(f, "({dom}) -> {codom}"),
_ => write!(f, "{dom} -> {codom}"),
},
TypeF::Wildcard(_) => write!(f, "_"),
Expand Down Expand Up @@ -1079,6 +1079,7 @@ mod test {
assert_format_eq("Num -> Num");
assert_format_eq("(Num -> Num) -> (Num -> Num) -> Num -> Num");
assert_format_eq("((Num -> Num) -> Num) -> Num");
assert_format_eq("Num -> (forall a. a -> Str) -> Str");

assert_format_eq("{_: Str}");
assert_format_eq("{_: (Str -> Str) -> Str}");
Expand Down

0 comments on commit 8f1752f

Please sign in to comment.