Skip to content

Commit 164975d

Browse files
committed
add necessary parentheses for FunType as arguments when pretty printing
1 parent f9f552f commit 164975d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/main/scala/decaf/frontend/annot/Type.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ case class FunType(args: List[Type], ret: Type) extends Type {
198198
override def toString: String = {
199199
val ps = args match {
200200
case Nil => "()"
201+
case (t @ FunType(_, _)) :: Nil => s"($t)"
201202
case t :: Nil => t.toString
202203
case ts => s"(${ ts.mkString(", ") })"
203204
}

0 commit comments

Comments
 (0)