Skip to content
Snippets Groups Projects
Commit e95b7dc4 authored by Etienne Kneuss's avatar Etienne Kneuss
Browse files

Extract leon.Utils.error[T] calls correctly

parent cc87ca9e
No related branches found
No related tags found
No related merge requests found
...@@ -534,8 +534,8 @@ trait CodeExtraction extends Extractors { ...@@ -534,8 +534,8 @@ trait CodeExtraction extends Extractors {
val tupleType = TupleType(tupleExprs.map(expr => bestRealType(expr.getType))) val tupleType = TupleType(tupleExprs.map(expr => bestRealType(expr.getType)))
Tuple(tupleExprs).setType(tupleType) Tuple(tupleExprs).setType(tupleType)
} }
case ExErrorExpression(str) => case ExErrorExpression(str, tpe) =>
Error(str).setType(scalaType2PureScala(unit, silent)(nextExpr.tpe)) Error(str).setType(scalaType2PureScala(unit, silent)(tpe))
case ExTupleExtract(tuple, index) => { case ExTupleExtract(tuple, index) => {
val tupleExpr = rec(tuple) val tupleExpr = rec(tuple)
......
...@@ -183,9 +183,9 @@ trait Extractors { ...@@ -183,9 +183,9 @@ trait Extractors {
} }
object ExErrorExpression { object ExErrorExpression {
def unapply(tree: Apply) : Option[String] = tree match { def unapply(tree: Apply) : Option[(String, Type)] = tree match {
case a @ Apply(Select(Select(Select(ExIdNamed("scala"), ExNamed("sys")), ExNamed("package")), ExNamed("error")), List(lit : Literal)) => case a @ Apply(TypeApply(Select(Select(ExIdNamed("leon"), ExNamed("Utils")), ExNamed("error")), List(tpe)), List(lit : Literal)) =>
Some(lit.value.stringValue) Some((lit.value.stringValue, tpe.tpe))
case _ => case _ =>
None None
} }
......
import leon.Utils._
object Errors {
def a(a: Int): Int = error[Int]("This is an error")
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment