@@ -181,13 +181,14 @@ public override Block VisitBlock(Block node)
181181 public override Cmd VisitAssertCmd ( AssertCmd node )
182182 {
183183 var assertCmd = ( AssertCmd ) base . VisitAssertCmd ( node ) ;
184- if ( doRefinementCheck && node . Layers . Contains ( layerNum ) )
185- {
186- return new AssumeCmd ( node . tok , assertCmd . Expr , node . Attributes ) ;
187- }
188184 if ( ! node . Layers . Contains ( layerNum ) )
189185 {
190186 assertCmd . Expr = Expr . True ;
187+ return assertCmd ;
188+ }
189+ if ( ! doRefinementCheck )
190+ {
191+ return new AssumeCmd ( node . tok , assertCmd . Expr , node . Attributes ) ;
191192 }
192193 return assertCmd ;
193194 }
@@ -245,12 +246,17 @@ private void ProcessCallCmd(CallCmd newCall)
245246 {
246247 var pureAction = civlTypeChecker . Action ( actionDecl ) ;
247248 newCall . Proc = pureAction . Impl . Proc ;
248- InjectGate ( pureAction , newCall ) ;
249+ InjectGate ( pureAction , newCall , ! doRefinementCheck ) ;
249250 newCmdSeq . Add ( newCall ) ;
250251 }
251252 else if ( CivlPrimitives . IsPrimitive ( newCall . Proc ) )
252253 {
253- newCmdSeq . AddRange ( linearRewriter . RewriteCallCmd ( newCall ) ) ;
254+ var cmds = linearRewriter . RewriteCallCmd ( newCall ) . Select ( cmd =>
255+ cmd is AssertCmd assertCmd && ! doRefinementCheck
256+ ? new AssumeCmd ( assertCmd . tok , assertCmd . Expr , assertCmd . Attributes )
257+ : cmd
258+ ) ;
259+ newCmdSeq . AddRange ( cmds ) ;
254260 }
255261 else
256262 {
@@ -464,7 +470,7 @@ private void InjectPreconditions(Action action, CallCmd callCmd)
464470 newCmdSeq . AddRange ( action . Preconditions ( layerNum , subst ) ) ;
465471 }
466472
467- private void InjectGate ( Action action , CallCmd callCmd , bool assume = false )
473+ private void InjectGate ( Action action , CallCmd callCmd , bool assume )
468474 {
469475 if ( action . Gate . Count == 0 )
470476 {
0 commit comments