Skip to content

Commit b9127fb

Browse files
committed
Merge remote-tracking branch 'origin/master' into release
2 parents 86987d1 + a96eba0 commit b9127fb

File tree

5 files changed

+27
-40
lines changed

5 files changed

+27
-40
lines changed

booster/library/Booster/CLOptions.hs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@ allowedLogLevels =
232232
, ("Depth", "Log the current depth of the state")
233233
, ("SMT", "Log the SMT-solver interactions")
234234
, ("ErrorDetails", "Log error conditions with extensive details")
235+
,
236+
( "EquationWarnings"
237+
, "Log warnings indicating soft-violations of conditions, i.e. exceeding the equation recursion/iteration limit "
238+
)
235239
]
236240

237241
levelToContext :: Map Text [ContextFilter]
@@ -279,6 +283,12 @@ levelToContext =
279283
, [ctxt| booster>failure,abort |]
280284
]
281285
)
286+
,
287+
( "EquationWarnings"
288+
,
289+
[ [ctxt| booster>(simplification *|function *)>warning |]
290+
]
291+
)
282292
]
283293

284294
-- Partition provided log levels into standard and custom ones, and

booster/library/Booster/Pattern/ApplyEquations.hs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,15 @@ throw = EquationT . lift . throwE
8484
catch_ ::
8585
Monad io => EquationT io a -> (EquationFailure -> EquationT io a) -> EquationT io a
8686
catch_ (EquationT op) hdlr = EquationT $ do
87+
prior <- lift . lift $ get
8788
cfg <- ask
88-
lift (runReaderT op cfg `catchE` (\e -> let EquationT fallBack = hdlr e in runReaderT fallBack cfg))
89+
lift
90+
( runReaderT op cfg
91+
`catchE` ( \e -> do
92+
let EquationT fallBack = hdlr e
93+
runReaderT (lift (lift (put prior)) >> fallBack) cfg
94+
)
95+
)
8996

9097
data EquationFailure
9198
= IndexIsNone Term
@@ -232,8 +239,8 @@ fromCache tag t = eqState $ Map.lookup t <$> gets (select tag . (.cache))
232239

233240
logWarn :: LoggerMIO m => Text -> m ()
234241
logWarn msg =
235-
logMessage' $
236-
msg <> " For more details, enable full context logging '--log-context \"*\"'"
242+
withContext "warning" $
243+
logMessage msg
237244

238245
checkForLoop :: LoggerMIO io => Term -> EquationT io ()
239246
checkForLoop t = do
@@ -965,5 +972,7 @@ simplifyConstraint' recurseIntoEvalBool = \case
965972
prior <- getState -- save prior state so we can revert
966973
eqState $ put prior{termStack = mempty, changed = False}
967974
result <- iterateEquations BottomUp PreferFunctions t
968-
eqState $ put prior
975+
-- reset change flag and term stack to prior values
976+
-- (keep the updated cache and added predicates, if any)
977+
eqState $ modify $ \s -> s{changed = prior.changed, termStack = prior.termStack}
969978
pure result

0 commit comments

Comments
 (0)