From f9b0ce4e5ba3f1087b7bfdda6090ef0c0fc88e67 Mon Sep 17 00:00:00 2001
From: Manos Koukoutos <emmanouil.koukoutos@epfl.ch>
Date: Tue, 1 Sep 2015 16:00:34 +0200
Subject: [PATCH] Make sure to handle all literals in valueToJVM

---
 .../scala/leon/codegen/CompilationUnit.scala  | 21 ++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/src/main/scala/leon/codegen/CompilationUnit.scala b/src/main/scala/leon/codegen/CompilationUnit.scala
index c852e50b6..a4dc5c0e3 100644
--- a/src/main/scala/leon/codegen/CompilationUnit.scala
+++ b/src/main/scala/leon/codegen/CompilationUnit.scala
@@ -9,7 +9,8 @@ import purescala.Expressions._
 import purescala.Types._
 import purescala.Extractors._
 import purescala.Constructors._
-import codegen.runtime.LeonCodeGenRuntimeMonitor
+
+import runtime.LeonCodeGenRuntimeMonitor
 import utils.UniqueCounter
 
 import cafebabe._
@@ -130,12 +131,21 @@ class CompilationUnit(val ctx: LeonContext,
     case IntLiteral(v) =>
       new java.lang.Integer(v)
 
-    case InfiniteIntegerLiteral(v) =>
-      new leon.codegen.runtime.BigInt(v.toString)
-
     case BooleanLiteral(v) =>
       new java.lang.Boolean(v)
 
+    case UnitLiteral() =>
+      new java.lang.Boolean(true)
+
+    case CharLiteral(c) =>
+      new Character(c)
+
+    case InfiniteIntegerLiteral(v) =>
+      new runtime.BigInt(v.toString)
+
+    case RealLiteral(v) =>
+      new runtime.Real(v.toString)
+
     case GenericValue(tp, id) =>
       e
 
@@ -278,15 +288,12 @@ class CompilationUnit(val ctx: LeonContext,
       throw CompilationException("Unsupported return value : " + e.getClass +" while expecting "+tpe)
   }
 
-  var compiledN = 0
 
   def compileExpression(e: Expr, args: Seq[Identifier])(implicit ctx: LeonContext): CompiledExpression = {
     if(e.getType == Untyped) {
       throw new Unsupported(e, s"Cannot compile untyped expression.")
     }
 
-    compiledN += 1
-
     val id = exprCounter.nextGlobal
 
     val cName = "Leon$CodeGen$Expr$"+id
-- 
GitLab