Skip to content

Do not ignore --strategy all #2231

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Nov 5, 2020
Merged

Do not ignore --strategy all #2231

merged 16 commits into from
Nov 5, 2020

Conversation

andreiburdusa
Copy link
Contributor


Fixes #2205

Reviewer checklist
  • Test coverage: stack test --coverage
  • Public API documentation: stack haddock

@andreiburdusa andreiburdusa marked this pull request as ready for review October 29, 2020 19:14
Copy link
Contributor

@MirceaS MirceaS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all looks in order to me but let's wait for Ana's review as well

@ttuegel ttuegel requested review from ttuegel and removed request for ana-pantilie November 3, 2020 15:05
Comment on lines 301 to 303
exitCodePatterns <- do
pat <- Logic.scatter $ fmap mkGetExitCode `MultiOr.map` finalConfig
Pattern.simplifyTopConfiguration pat
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to gather the branches here, and remove Logic.observeAllT in takeExitCode, below. Otherwise, we would return ExitFailure 111 when all the branches agree, if any branch would return \bottom.

Suggested change
exitCodePatterns <- do
pat <- Logic.scatter $ fmap mkGetExitCode `MultiOr.map` finalConfig
Pattern.simplifyTopConfiguration pat
exitCodePatterns <-
do
pat <- Logic.scatter $ fmap mkGetExitCode `MultiOr.map` finalConfig
Pattern.simplifyTopConfiguration pat
& MultiOr.gather

Comment on lines 304 to 310
let exitList =
extractExit . Pattern.term
<$> Foldable.toList exitCodePatterns
exitCode =
case nubOrd exitList of
[exit] -> exit
_ -> ExitFailure 111
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need nubOrd here if we use MultiOr.gather above:

Suggested change
let exitList =
extractExit . Pattern.term
<$> Foldable.toList exitCodePatterns
exitCode =
case nubOrd exitList of
[exit] -> exit
_ -> ExitFailure 111
let exitCode =
case toList (MultiOr.map Pattern.term exitCodePatterns) of
[exitTerm] -> extractExit exitTerm
_ -> ExitFailure 111

@ttuegel ttuegel self-requested a review November 4, 2020 15:08
Copy link
Contributor

@ttuegel ttuegel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some suggestions for clean-up, but this looks pretty good.

=> VerifiedModule StepperAttributes
-- ^ The main module
-> Pattern VariableName
-> OrPattern.OrPattern VariableName
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this type was changed, let's change the name of the argument to configs instead.

Comment on lines 297 to 307
exitCodePatterns <-
do
pat <- Logic.scatter $ fmap mkGetExitCode `MultiOr.map` finalConfig
Pattern.simplifyTopConfiguration pat
& MultiOr.gather
let flatExitCodePatterns = MultiOr.flatten exitCodePatterns
exitCode =
case toList (MultiOr.map Pattern.term flatExitCodePatterns) of
[exitTerm] -> extractExit exitTerm
_ -> ExitFailure 111
return exitCode
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
exitCodePatterns <-
do
pat <- Logic.scatter $ fmap mkGetExitCode `MultiOr.map` finalConfig
Pattern.simplifyTopConfiguration pat
& MultiOr.gather
let flatExitCodePatterns = MultiOr.flatten exitCodePatterns
exitCode =
case toList (MultiOr.map Pattern.term flatExitCodePatterns) of
[exitTerm] -> extractExit exitTerm
_ -> ExitFailure 111
return exitCode
exitCodePatterns <-
do
config <- Logic.scatter configs
Pattern.simplifyTopConfiguration (mkGetExitCode <$> config)
>>= Logic.scatter
& MultiOr.gather
let exitCode =
case toList (MultiOr.map Pattern.term exitCodePatterns) of
[exitTerm] -> extractExit exitTerm
_ -> ExitFailure 111
return exitCode

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ttuegel If I use gather :: (Ord a, TopBottom a, MonadLogic m) => m a -> m (MultiOr a) there, then the lambda function given to takeExitCode has to return a MonadLogic result. Then how can I change its signature to
takeExitCode :: (([Sort] -> Symbol) -> simplifier ExitCode)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I meant to suggest using MultiOr.observeAllT instead of MultiOr.gather.

resolve = resolveInternalSymbol indexedModule . noLocationId

takeExitCode
:: (([Sort] -> Symbol) -> LogicT simplifier ExitCode)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an extra LogicT here:

Suggested change
:: (([Sort] -> Symbol) -> LogicT simplifier ExitCode)
:: (([Sort] -> Symbol) -> simplifier ExitCode)

Comment on lines 323 to 327
Just mkGetExitCodeSymbol ->
Logic.runLogicT
(act mkGetExitCodeSymbol)
(\a _ -> pure a)
(pure $ ExitFailure 111)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now this function is simply

    takeExitCode act =
        resolve "LblgetExitCode"
        & maybe (pure ExitSuccess) act

@rv-jenkins rv-jenkins merged commit 015cdb8 into runtimeverification:master Nov 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--strategy all is ignored
4 participants