From 6d9d8dd54381c9c8c9a9a86b9d6d1c6bbce96c45 Mon Sep 17 00:00:00 2001 From: Etienne Kneuss <colder@php.net> Date: Tue, 3 Dec 2013 17:27:46 +0100 Subject: [PATCH] Fix pretty-printer indenting and braces --- src/main/scala/leon/purescala/PrettyPrinter.scala | 4 ++-- src/main/scala/leon/purescala/ScalaPrinter.scala | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/scala/leon/purescala/PrettyPrinter.scala b/src/main/scala/leon/purescala/PrettyPrinter.scala index acc091cef..c03798d62 100644 --- a/src/main/scala/leon/purescala/PrettyPrinter.scala +++ b/src/main/scala/leon/purescala/PrettyPrinter.scala @@ -254,7 +254,7 @@ class PrettyPrinter(sb: StringBuffer = new StringBuffer) { pp(pat, p) sb.append(" =>\n") ind(lvl+1) - pp(rhs, p)(lvl+2) + pp(rhs, p)(lvl+1) case GuardedCase(pat, guard, rhs) => sb.append("case ") pp(pat, p) @@ -262,7 +262,7 @@ class PrettyPrinter(sb: StringBuffer = new StringBuffer) { pp(guard, p) sb.append(" =>\n") ind(lvl+1) - pp(rhs, p)(lvl+2) + pp(rhs, p)(lvl+1) // Patterns case CaseClassPattern(bndr, ccd, subps) => diff --git a/src/main/scala/leon/purescala/ScalaPrinter.scala b/src/main/scala/leon/purescala/ScalaPrinter.scala index 348e2ef14..bc186b293 100644 --- a/src/main/scala/leon/purescala/ScalaPrinter.scala +++ b/src/main/scala/leon/purescala/ScalaPrinter.scala @@ -393,7 +393,7 @@ class ScalaPrinter(sb: StringBuffer = new StringBuffer) extends PrettyPrinter(sb private def requiresBraces(ex: Tree, within: Option[Tree]): Boolean = (ex, within) match { case (_, None) => false case (_, Some(_: Definition)) => false - case (_, Some(_: MatchExpr | _: Let | _: LetTuple | _: LetDef)) => false + case (_, Some(_: MatchExpr | _: MatchCase | _: Let | _: LetTuple | _: LetDef)) => false case (_, _) => true } @@ -411,7 +411,7 @@ class ScalaPrinter(sb: StringBuffer = new StringBuffer) extends PrettyPrinter(sb private def requiresParentheses(ex: Tree, within: Option[Tree]): Boolean = (ex, within) match { case (_, None) => false case (_, Some(_: Definition)) => false - case (_, Some(_: MatchExpr | _: Let | _: LetTuple | _: LetDef | _: IfExpr)) => false + case (_, Some(_: MatchExpr | _: MatchCase | _: Let | _: LetTuple | _: LetDef | _: IfExpr)) => false case (_, Some(_: FunctionInvocation)) => false case (ie: IfExpr, _) => true case (e1: Expr, Some(e2: Expr)) if precedence(e1) > precedence(e2) => false -- GitLab