Skip to content
Snippets Groups Projects
Commit d3f14b31 authored by Régis Blanc's avatar Régis Blanc
Browse files

Better return results when it is impossible to compute the model

parent 8f859490
Branches
Tags
No related merge requests found
...@@ -24,7 +24,7 @@ object Evaluator { ...@@ -24,7 +24,7 @@ object Evaluator {
case class InfiniteComputation() extends EvaluationResult { case class InfiniteComputation() extends EvaluationResult {
val finalResult = None val finalResult = None
} }
case class PostconditionViolationFunctionFromModel() extends EvaluationResult { case class ImpossibleComputation() extends EvaluationResult {
val finalResult = None val finalResult = None
} }
...@@ -33,7 +33,7 @@ object Evaluator { ...@@ -33,7 +33,7 @@ object Evaluator {
case class RuntimeErrorEx(msg: String) extends Exception case class RuntimeErrorEx(msg: String) extends Exception
case class InfiniteComputationEx() extends Exception case class InfiniteComputationEx() extends Exception
case class TypeErrorEx(typeError: TypeError) extends Exception case class TypeErrorEx(typeError: TypeError) extends Exception
case class PostconditionViolationFunctionFromModelEx() extends Exception case class ImpossibleComputationEx() extends Exception
var left: Int = maxSteps var left: Int = maxSteps
...@@ -101,7 +101,7 @@ object Evaluator { ...@@ -101,7 +101,7 @@ object Evaluator {
val postBody = replace(Map(ResultVariable() -> Variable(freshResID)), matchToIfThenElse(fd.postcondition.get)) val postBody = replace(Map(ResultVariable() -> Variable(freshResID)), matchToIfThenElse(fd.postcondition.get))
rec(frame + ((freshResID -> callResult)), postBody) match { rec(frame + ((freshResID -> callResult)), postBody) match {
case BooleanLiteral(true) => ; case BooleanLiteral(true) => ;
case BooleanLiteral(false) if !fd.hasImplementation => throw PostconditionViolationFunctionFromModelEx() case BooleanLiteral(false) if !fd.hasImplementation => throw ImpossibleComputationEx()
case BooleanLiteral(false) => throw RuntimeErrorEx("Postcondition violation for " + fd.id.name + " reached in evaluation.") case BooleanLiteral(false) => throw RuntimeErrorEx("Postcondition violation for " + fd.id.name + " reached in evaluation.")
case other => throw TypeErrorEx(TypeError(other, BooleanType)) case other => throw TypeErrorEx(TypeError(other, BooleanType))
} }
...@@ -313,7 +313,7 @@ object Evaluator { ...@@ -313,7 +313,7 @@ object Evaluator {
case RuntimeErrorEx(msg) => RuntimeError(msg) case RuntimeErrorEx(msg) => RuntimeError(msg)
case InfiniteComputationEx() => InfiniteComputation() case InfiniteComputationEx() => InfiniteComputation()
case TypeErrorEx(te) => te case TypeErrorEx(te) => te
case PostconditionViolationFunctionFromModelEx() => PostconditionViolationFunctionFromModel() case ImpossibleComputationEx() => ImpossibleComputation()
} }
} }
} }
......
...@@ -827,8 +827,8 @@ class FairZ3Solver(reporter: Reporter) extends Solver(reporter) with AbstractZ3S ...@@ -827,8 +827,8 @@ class FairZ3Solver(reporter: Reporter) extends Solver(reporter) with AbstractZ3S
reporter.info("- Invalid model.") reporter.info("- Invalid model.")
(false, asMap) (false, asMap)
} }
case PostconditionViolationFunctionFromModel() => { case ImpossibleComputation() => {
reporter.info("- Invalid Model: postcondition violation of a function that whose implementation was specified by the model") reporter.info("- Invalid Model: the model could not be verified because of insufficient information.")
(false, asMap) (false, asMap)
} }
case other => { case other => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment