Skip to content

Commit

Permalink
Add necessary parentheses for FunType as arguments in FunType.toString()
Browse files Browse the repository at this point in the history
  • Loading branch information
equation314 committed Nov 1, 2019
1 parent 5023b54 commit eeedd66
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/decaf/frontend/type/FunType.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ public String toString() {
if (argTypes.isEmpty()) {
sb.append("()");
} else if (argTypes.size() == 1) {
sb.append(argTypes.get(0));
var arg = argTypes.get(0).toString();
if (argTypes.get(0).isFuncType()) {
arg = "(" + arg + ")";
}
sb.append(arg);
} else {
sb.append('(');
for (int i = 0; i < argTypes.size(); i++) {
Expand Down

0 comments on commit eeedd66

Please sign in to comment.