Skip to content

Nicer error message for parse errors#3417

Merged
5 commits merged into
KeYProject:mainfrom
FliegendeWurst:nicer-errors
Apr 15, 2024
Merged

Nicer error message for parse errors#3417
5 commits merged into
KeYProject:mainfrom
FliegendeWurst:nicer-errors

Conversation

@FliegendeWurst
Copy link
Copy Markdown
Member

@FliegendeWurst FliegendeWurst commented Feb 21, 2024

Intended Change

#3406 leads to user-facing ParseCancellationExceptions, which are not debuggable. This PR enhances the user experience by actually showing the error in the context of the input file, and listing the found token and the expected token types. Previously, only the class name of the exception was displayed.

Type of pull request

  • Bug fix (non-breaking change which fixes an issue)
  • Refactoring (behaviour should not change or only minimally change)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • There are changes to the (Java) code
  • There are changes to the taclet rule base
  • There are changes to the deployment/CI infrastructure (gradle, github, ...)
  • Other:

Ensuring quality

  • I made sure that introduced/changed code is well documented (javadoc and inline comments).
  • I made sure that new/changed end-user features are well documented (https://github.com/KeYProject/key-docs).
  • I added new test case(s) for new functionality.
  • I have tested the feature as follows: I tested the error reporting using the file below
  • I have checked that runtime performance has not deteriorated.

missing_semicolon.key

\rules {
   missingSemicolon {
      \find(0=0)
      \replacewith(1=1)
  }
}

\problem { 0=0 }

Additional information and contact(s)

The contributions within this pull request are licensed under GPLv2 (only) for inclusion in KeY.

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 21, 2024

Codecov Report

Attention: 11 lines in your changes are missing coverage. Please review.

Comparison is base (1fb0c10) 37.77% compared to head (4d3b3ad) 37.78%.

Files Patch % Lines
...main/java/de/uka/ilkd/key/util/ExceptionTools.java 72.50% 9 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #3417      +/-   ##
============================================
+ Coverage     37.77%   37.78%   +0.01%     
- Complexity    17031    17037       +6     
============================================
  Files          2076     2076              
  Lines        126950   126992      +42     
  Branches      21381    21387       +6     
============================================
+ Hits          47952    47981      +29     
- Misses        73092    73102      +10     
- Partials       5906     5909       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MarcoScaletta
Copy link
Copy Markdown
Contributor

\rules {
wrongTypeSchemaVar {
\schemaVar update x, x2;
\find(0=0)
\replacewith(1=1)
};
}

\problem { true }

@FliegendeWurst
Copy link
Copy Markdown
Member Author

I added another case that handles your problematic input.

@github-merge-queue github-merge-queue Bot closed this pull request by merging all changes into KeYProject:main in 7254776 Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants