Skip to content
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

Introduce dedicated exit codes #1749

Merged
merged 5 commits into from
May 16, 2022
Merged

Introduce dedicated exit codes #1749

merged 5 commits into from
May 16, 2022

Conversation

thpani
Copy link
Collaborator

@thpani thpani commented May 13, 2022

Closes #1392

Exit with dedicated error codes for

  • type-checking errors,
  • parser errors, and
  • evaluation errors (e.g., due to unsupported language constructs and operators).

To this extent, we:

  • Add exit code 120 (the range 80–149 is unused by TLC) for type-checking errors.
  • Refactor Pass and its implementations to return an Either encapsulating the exit code or pass result.

 

  • Tests added for any new code
  • Ran make fmt-fix (or had formatting run automatically on all files edited)
  • Documentation added for any new functionality
  • Entry added to UNRELEASED.md for any new functionality

Copy link
Collaborator

@konnov konnov left a comment

Choose a reason for hiding this comment

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

Great PR! Exactly what we needed!

@thpani thpani changed the title Exit with dedicated error codes Introduce dedicated exit codes May 13, 2022
@shonfeder shonfeder enabled auto-merge May 15, 2022 15:26
@shonfeder shonfeder disabled auto-merge May 15, 2022 15:27
Copy link
Contributor

@shonfeder shonfeder left a comment

Choose a reason for hiding this comment

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

Great improvement!

I have one suggestion that I think helps with readability, and a few questions.

@thpani thpani requested a review from shonfeder May 16, 2022 09:27
Copy link
Contributor

@shonfeder shonfeder left a comment

Choose a reason for hiding this comment

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

LGTM!

thpani and others added 4 commits May 16, 2022 12:36
Co-authored-by: Shon Feder <shon@informal.systems>
Introduces the new return type PassResult = Either[TExitCode, TlaModule].
A pass returns either an exit code as Left(42) or the resulting TlaModule as Right(module).

Co-authored-by: Shon Feder <shon@informal.systems>
Co-authored-by: Shon Feder <shon@informal.systems>
@thpani thpani enabled auto-merge May 16, 2022 10:38
@codecov-commenter
Copy link

codecov-commenter commented May 16, 2022

Codecov Report

Merging #1749 (e8d98d8) into unstable (f4efe42) will increase coverage by 0.07%.
The diff coverage is 37.50%.

@@             Coverage Diff              @@
##           unstable    #1749      +/-   ##
============================================
+ Coverage     76.82%   76.89%   +0.07%     
============================================
  Files           379      379              
  Lines         11826    11824       -2     
  Branches        570      549      -21     
============================================
+ Hits           9085     9092       +7     
+ Misses         2741     2732       -9     
Impacted Files Coverage Δ
.../scala/at/forsyte/apalache/infra/passes/Pass.scala 50.00% <ø> (ø)
.../src/main/scala/at/forsyte/apalache/tla/Tool.scala 0.00% <0.00%> (ø)
...lache/tla/assignments/passes/PrimingPassImpl.scala 0.00% <0.00%> (ø)
...he/tla/assignments/passes/TransitionPassImpl.scala 0.00% <0.00%> (ø)
...e/apalache/tla/bmcmt/passes/AnalysisPassImpl.scala 0.00% <0.00%> (ø)
...ache/tla/bmcmt/passes/BoundedCheckerPassImpl.scala 0.00% <0.00%> (ø)
...tla/bmcmt/passes/ReTLAToVMTTranspilePassImpl.scala 0.00% <0.00%> (ø)
...syte/apalache/tla/bmcmt/passes/VCGenPassImpl.scala 0.00% <0.00%> (ø)
...e/apalache/tla/imp/passes/SanyParserPassImpl.scala 0.00% <0.00%> (ø)
...apalache/tla/pp/passes/ConfigurationPassImpl.scala 0.00% <0.00%> (ø)
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f4efe42...e8d98d8. Read the comment docs.

@thpani thpani merged commit 1c654a5 into unstable May 16, 2022
@thpani thpani deleted the th/typecheck-exitcode branch May 16, 2022 11:31
This was referenced May 19, 2022
@apalache-bot apalache-bot mentioned this pull request May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Designated error code when a type checking error occurs
4 participants