From 5c7f1947f5774b6648e3949fd8d1ae0cc180d4f1 Mon Sep 17 00:00:00 2001
From: Etienne Kneuss <colder@php.net>
Date: Wed, 17 Jul 2013 02:10:54 +0200
Subject: [PATCH] Fix interface of PrettyPrinter causing ScalaPrinter to
 fall-back

---
 src/main/scala/leon/purescala/PrettyPrinter.scala |  5 ++---
 src/main/scala/leon/purescala/ScalaPrinter.scala  | 15 ++-------------
 2 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/src/main/scala/leon/purescala/PrettyPrinter.scala b/src/main/scala/leon/purescala/PrettyPrinter.scala
index ebe8260c8..d13fd83e5 100644
--- a/src/main/scala/leon/purescala/PrettyPrinter.scala
+++ b/src/main/scala/leon/purescala/PrettyPrinter.scala
@@ -285,7 +285,7 @@ class PrettyPrinter(sb: StringBuffer = new StringBuffer) {
 
   // TYPE TREES
   // all type trees are printed in-line
-  def ppNaryType(tpes: Seq[TypeTree], pre: String, op: String, post: String, lvl: Int): StringBuffer = {
+  def ppNaryType(tpes: Seq[TypeTree], pre: String, op: String, post: String, lvl: Int): Unit = {
     sb.append(pre)
     val sz = tpes.size
     var c = 0
@@ -295,10 +295,9 @@ class PrettyPrinter(sb: StringBuffer = new StringBuffer) {
     })
 
     sb.append(post)
-    sb
   }
 
-  def pp(tpe: TypeTree, lvl: Int): StringBuffer = tpe match {
+  def pp(tpe: TypeTree, lvl: Int): Unit = tpe match {
     case Untyped => sb.append("???")
     case UnitType => sb.append("Unit")
     case Int32Type => sb.append("Int")
diff --git a/src/main/scala/leon/purescala/ScalaPrinter.scala b/src/main/scala/leon/purescala/ScalaPrinter.scala
index 75f5e37f3..c0dbb34cf 100644
--- a/src/main/scala/leon/purescala/ScalaPrinter.scala
+++ b/src/main/scala/leon/purescala/ScalaPrinter.scala
@@ -291,19 +291,8 @@ class ScalaPrinter(sb: StringBuffer = new StringBuffer) extends PrettyPrinter(sb
 
   // TYPE TREES
   // all type trees are printed in-line
-  private def ppNaryType(sb: StringBuffer, tpes: Seq[TypeTree], pre: String, op: String, post: String, lvl: Int) = {
-    sb.append(pre)
-    val sz = tpes.size
-    var c = 0
 
-    tpes.foreach(t => {
-      pp(t, lvl) ; c += 1 ; if(c < sz) sb.append(op)
-    })
-
-    sb.append(post)
-  }
-
-  private def pp(tpe: TypeTree, sb: StringBuffer, lvl: Int): Unit = tpe match {
+  override def pp(tpe: TypeTree, lvl: Int): Unit = tpe match {
     case Untyped => sb.append("???")
     case UnitType => sb.append("Unit")
     case Int32Type => sb.append("Int")
@@ -333,7 +322,7 @@ class ScalaPrinter(sb: StringBuffer = new StringBuffer) extends PrettyPrinter(sb
 
   // DEFINITIONS
   // all definitions are printed with an end-of-line
-  private def pp(defn: Definition, sb: StringBuffer, lvl: Int): Unit = {
+  override def pp(defn: Definition, lvl: Int): Unit = {
 
     defn match {
       case Program(id, mainObj) => {
-- 
GitLab