Skip to content

Commit e188f40

Browse files
committed
Add better oneLineDoc to DecidePredicateUnknown
1 parent 40c912b commit e188f40

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

kore/src/Kore/Log/DecidePredicateUnknown.hs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import Kore.Internal.Predicate qualified as Predicate
3232
import Kore.Internal.TermLike qualified as TermLike
3333
import Kore.Internal.Variable
3434
import Kore.Syntax.Json qualified as PatternJson
35+
import Kore.Unparser (unparse)
3536
import Language.Haskell.TH.Syntax (Exp, Loc (..), Q, qLocation)
3637
import Log
3738
import Prelude.Kore
@@ -101,7 +102,23 @@ instance Entry DecidePredicateUnknown where
101102
where
102103
prettyHsLoc Loc{loc_module, loc_start = (row, col)} =
103104
Pretty.pretty loc_module <> ":" <> Pretty.pretty row <> ":" <> Pretty.pretty col
104-
oneLineDoc _ = "DecidePredicateUnknown"
105+
oneLineDoc (DecidePredicateUnknown{message, predicates}) =
106+
Pretty.hsep
107+
[ Pretty.brackets "smt"
108+
, Pretty.pretty description
109+
, unparse
110+
( Predicate.fromPredicate
111+
sortBool
112+
predicate
113+
)
114+
]
115+
where
116+
predicate = Predicate.makeMultipleAndPredicate . toList $ predicates
117+
description =
118+
"solver returned unknwon ("
119+
<> message
120+
<> ") for predicate "
121+
105122
helpDoc _ =
106123
"error or a warning when the solver cannot decide the satisfiability of a formula"
107124

@@ -125,6 +142,10 @@ externaliseDecidePredicateUnknown :: DecidePredicateUnknown -> (Text, PatternJso
125142
externaliseDecidePredicateUnknown err@DecidePredicateUnknown{message} =
126143
( message
127144
, PatternJson.fromPredicate
128-
(TermLike.SortActualSort $ TermLike.SortActual (TermLike.Id "SortBool" TermLike.AstLocationNone) [])
145+
sortBool
129146
(Predicate.makeMultipleAndPredicate . toList $ predicates err)
130147
)
148+
149+
sortBool :: TermLike.Sort
150+
sortBool =
151+
(TermLike.SortActualSort $ TermLike.SortActual (TermLike.Id "SortBool" TermLike.AstLocationNone) [])

0 commit comments

Comments
 (0)