Skip to content

Commit bad32a4

Browse files
committed
APP: allow for possibility of missing ppo's and invariants
1 parent 16ec171 commit bad32a4

File tree

2 files changed

+34
-17
lines changed

2 files changed

+34
-17
lines changed

chc/app/CFunction.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -581,16 +581,28 @@ def get_spos(self) -> List[CFunctionPO]:
581581
return self.proofs.spolist
582582

583583
def get_open_ppos(self) -> List[CFunctionPO]:
584-
return self.proofs.open_ppos
584+
try:
585+
return self.proofs.open_ppos
586+
except UF.CHCFileNotFoundError:
587+
return []
585588

586589
def get_open_spos(self) -> List[CFunctionPO]:
587590
return self.proofs.open_spos
588591

589592
def get_ppos_violated(self) -> List[CFunctionPO]:
590-
return self.proofs.ppos_violated
593+
try:
594+
return self.proofs.ppos_violated
595+
except UF.CHCFileNotFoundError:
596+
return []
591597

592598
def get_spo_violations(self) -> List[CFunctionPO]:
593-
return self.proofs.get_spo_violations()
599+
try:
600+
return self.proofs.get_spo_violations()
601+
except UF.CHCFileNotFoundError:
602+
return []
594603

595604
def get_ppos_delegated(self) -> List[CFunctionPO]:
596-
return self.proofs.ppos_delegated
605+
try:
606+
return self.proofs.ppos_delegated
607+
except UF.CHCFileNotFoundError:
608+
return []

chc/reporting/ProofObligations.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
from typing import (
3333
Any, Callable, cast, Dict, List, Sequence, Set, Tuple, TYPE_CHECKING)
3434

35+
import chc.util.fileutil as UF
36+
3537
if TYPE_CHECKING:
3638
from chc.app.CApplication import CApplication
3739
from chc.app.CFile import CFile
@@ -802,7 +804,6 @@ def tag_file_function_pos_tostring(
802804
for ff in sorted(fundict[f]):
803805
lines.append(" Function: " + ff)
804806
for po in sorted(fundict[f][ff], key=lambda po: po.line):
805-
invd = po.cfun.invdictionary
806807
lines.append((" " * 6) + str(po))
807808
if po.is_closed:
808809
lines.append((" " * 14) + str(po.explanation))
@@ -820,18 +821,22 @@ def tag_file_function_pos_tostring(
820821
lines.append((" " * 14) + str(msg))
821822
lines.append(" ")
822823
keys = po.diagnostic.argument_indices
823-
for k in keys:
824-
invids = po.diagnostic.get_invariant_ids(k)
825-
for id in invids:
826-
inv = invd.get_invariant_fact(id)
827-
if inv.is_nrv_fact:
828-
inv = cast("CInvariantNRVFact", inv)
829-
nrv = inv.non_relational_value
830-
lines.append(
831-
(" " * 14)
832-
+ str(k)
833-
+ ": "
834-
+ str(nrv))
824+
try:
825+
invd = po.cfun.invdictionary
826+
for k in keys:
827+
invids = po.diagnostic.get_invariant_ids(k)
828+
for id in invids:
829+
inv = invd.get_invariant_fact(id)
830+
if inv.is_nrv_fact:
831+
inv = cast("CInvariantNRVFact", inv)
832+
nrv = inv.non_relational_value
833+
lines.append(
834+
(" " * 14)
835+
+ str(k)
836+
+ ": "
837+
+ str(nrv))
838+
except UF.CHCError:
839+
pass
835840

836841
lines.append(" ")
837842

0 commit comments

Comments
 (0)