Skip to content

Commit

Permalink
Fixes vincenthz#9 print square brackets for array init
Browse files Browse the repository at this point in the history
  • Loading branch information
dvekeman committed Oct 8, 2016
1 parent 119b1c2 commit 0083f37
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Language/Java/Pretty.hs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ instance Pretty VarDecl where

instance Pretty VarDeclId where
prettyPrec p (VarId ident) = prettyPrec p ident
prettyPrec p (VarDeclArray vId) = prettyPrec p vId
prettyPrec p (VarDeclArray vId) = prettyPrec p vId <> text "[]"

instance Pretty VarInit where
prettyPrec p (InitExp e) = prettyPrec p e
Expand Down
13 changes: 13 additions & 0 deletions tests/java/good/TestArray.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
public class TestArray {
public static void main(String[] args) {
while (true) { int x = 1; }
if (1 + 1 == 2) {
} else {
int y = 2, z = 4;
while (y > 0) y--;
System.out.println(y);
int w[][] = {{1,2}, {3}};
}

}
}

0 comments on commit 0083f37

Please sign in to comment.