@@ -96,17 +96,21 @@ trait Trace extends CachingPhase with IdentityFunctions with IdentitySorts { sel
9696 var funInv : Option [s.FunctionInvocation ] = None
9797 fd.flags.filter(elem => elem.name == " traceInduct" ).head match {
9898 case s.Annotation (" traceInduct" , fun) => {
99- s.exprOps.preTraversal {
100- case _ if funInv.isDefined => // do nothing
101- case fi @ s.FunctionInvocation (tfd, _, args) if symbols.isRecursive(tfd) && (fun.contains(StringLiteral (tfd.name)) || fun.contains(StringLiteral (" " )))
102- => {
103- val paramVars = fd.params.map(_.toVariable)
104- val argCheck = args.forall(paramVars.contains) && args.toSet.size == args.size
105- if (argCheck)
106- funInv = Some (fi)
107- }
99+ BodyWithSpecs (fd.fullBody).getSpec(PostconditionKind ) match {
100+ case Some (Postcondition (post)) =>
101+ s.exprOps.preTraversal {
102+ case _ if funInv.isDefined => // do nothing
103+ case fi @ s.FunctionInvocation (tfd, _, args) if symbols.isRecursive(tfd) && (fun.contains(StringLiteral (tfd.name)) || fun.contains(StringLiteral (" " )))
104+ => {
105+ val paramVars = fd.params.map(_.toVariable)
106+ val argCheck = args.forall(paramVars.contains) && args.toSet.size == args.size
107+ if (argCheck)
108+ funInv = Some (fi)
109+ }
110+ case _ =>
111+ }(post)
108112 case _ =>
109- }(fd.fullBody)
113+ }
110114 }
111115 }
112116
@@ -161,17 +165,11 @@ trait Trace extends CachingPhase with IdentityFunctions with IdentitySorts { sel
161165 val returnType = model.returnType
162166 val flags = Seq (s.Derived (lemma.id), s.Derived (model.id))
163167
164- val fi = FunctionInvocation (model.id, newParamTps, newParamVars)
165-
166- /* val body = FunctionInvocation(
167- ast.SymbolIdentifier("stainless.lang.specialize"),
168- fi.tps,
169- Seq(fi)
170- )*/
171-
172168 val body = FunctionInvocation (model.id, newParamTps, newParamVars)
173169 val indPattern = new s.FunDef (id, newParamTypes, newParams, returnType, body, flags)
174170
171+ val fi = FunctionInvocation (model.id, newParamTps, newParamVars)
172+
175173 class Specializer (
176174 origFd : FunDef ,
177175 newId : Identifier ,
0 commit comments