Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoeilers committed Nov 24, 2023
2 parents 5409bd4 + 8fa723a commit 525893c
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
11 changes: 10 additions & 1 deletion src/main/scala/rules/Evaluator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,16 @@ object evaluator extends EvaluationRules {
val snap1 = snap.convert(sorts.Snap)
val preFApp = App(functionSupporter.preconditionVersion(v3.symbolConverter.toFunction(func)), snap1 :: tArgs)
v3.decider.assume(preFApp)
val tFApp = App(v3.symbolConverter.toFunction(func), snap1 :: tArgs)
val funcAnn = func.info.getUniqueInfo[AnnotationInfo]
val tFApp = funcAnn match {
case Some(a) if a.values.contains("opaque") =>
val funcAppAnn = fapp.info.getUniqueInfo[AnnotationInfo]
funcAppAnn match {
case Some(a) if a.values.contains("reveal") => App(v3.symbolConverter.toFunction(func), snap1 :: tArgs)
case _ => App(functionSupporter.limitedVersion(v3.symbolConverter.toFunction(func)), snap1 :: tArgs)
}
case _ => App(v3.symbolConverter.toFunction(func), snap1 :: tArgs)
}
val fr5 =
s4.functionRecorder.changeDepthBy(-1)
.recordSnapshot(fapp, v3.decider.pcs.branchConditions, snap1)
Expand Down
8 changes: 6 additions & 2 deletions src/main/scala/supporters/functions/FunctionData.scala
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,13 @@ class FunctionData(val programFunction: ast.Function,
val pre = preconditionFunctionApplication
val nestedDefinitionalAxioms = generateNestedDefinitionalAxioms
val body = And(nestedDefinitionalAxioms ++ List(Implies(pre, And(BuiltinEquals(functionApplication, translatedBody)))))
val funcAnn = programFunction.info.getUniqueInfo[ast.AnnotationInfo]
val actualPredicateTriggers = funcAnn match {
case Some(a) if a.values.contains("opaque") => Seq()
case _ => predicateTriggers.values.map(pt => Trigger(Seq(triggerFunctionApplication, pt)))
}
val allTriggers = (
Seq(Trigger(functionApplication))
++ predicateTriggers.values.map(pt => Trigger(Seq(triggerFunctionApplication, pt))))
Seq(Trigger(functionApplication)) ++ actualPredicateTriggers)

Forall(arguments, body, allTriggers)})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import viper.silicon.rules.functionSupporter
import viper.silicon.state.{Identifier, SimpleIdentifier, SuffixedIdentifier, SymbolConverter}
import viper.silicon.state.terms._
import viper.silicon.supporters.ExpressionTranslator
import viper.silver.ast.AnnotationInfo
import viper.silver.reporter.{InternalWarningMessage, Reporter}

class HeapAccessReplacingExpressionTranslator(symbolConverter: SymbolConverter,
Expand Down Expand Up @@ -127,7 +128,16 @@ class HeapAccessReplacingExpressionTranslator(symbolConverter: SymbolConverter,

case eFApp: ast.FuncApp =>
val silverFunc = program.findFunction(eFApp.funcname)
val fun = symbolConverter.toFunction(silverFunc)
val funcAnn = silverFunc.info.getUniqueInfo[AnnotationInfo]
val fun = funcAnn match {
case Some(a) if a.values.contains("opaque") =>
val funcAppAnn = eFApp.info.getUniqueInfo[AnnotationInfo]
funcAppAnn match {
case Some(a) if a.values.contains("reveal") => symbolConverter.toFunction(silverFunc)
case _ => functionSupporter.limitedVersion(symbolConverter.toFunction(silverFunc))
}
case _ => symbolConverter.toFunction(silverFunc)
}
val args = eFApp.args map (arg => translate(arg))
val snap = getOrFail(data.fappToSnap, eFApp, sorts.Snap)
val fapp = App(fun, snap +: args)
Expand Down

0 comments on commit 525893c

Please sign in to comment.