Open MasseGuillaume opened 6 years ago
Unhandled case
check("if (a) (if (b) c) else d")
java.lang.RuntimeException: AST changed
obtained: if (a) if (b) c else d
expected: if (a) (if (b) c) else d
This doesn't seem to be handled by precedence rules. Without the parens around if (b) c
it parses differently
ollie-scalafmt@ q"if (a) if (b) c else d"
res4: Term.If = Term.If(Term.Name("a"), Term.If(Term.Name("b"), Term.Name("c"), Term.Name("d")), Lit.Unit(()))
ollie-scalafmt@ q"if (a) (if (b) c) else d"
res5: Term.If = Term.If(Term.Name("a"), Term.If(Term.Name("b"), Term.Name("c"), Lit.Unit(())), Term.Name("d"))
Discovered by @japgolly in https://github.com/scalameta/scalafmt/pull/1122
2 failures remaining:
https://github.com/scalameta/scalameta/issues/1385 https://github.com/scalameta/scalameta/issues/1384