Skip to content

Handle Switch in Taclets w/o Transformer#3761

Draft
Drodt wants to merge 10 commits intoKeYProject:mainfrom
Drodt:match-switch
Draft

Handle Switch in Taclets w/o Transformer#3761
Drodt wants to merge 10 commits intoKeYProject:mainfrom
Drodt:match-switch

Conversation

@Drodt
Copy link
Member

@Drodt Drodt commented Mar 13, 2026

Intended Change

Instead of relying on the switch-to-if transformer, which may have some bugs, this PR attempts to handle switch statements purely in taclets.

The general approach is to mark the branch currently executed as the active-case.

Plan

  • Finish implementation

Type of pull request

  • Bug fix (non-breaking change which fixes an issue)
  • 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
  • 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 have checked that runtime performance has not deteriorated.
  • For new Gradle modules: I added the Gradle module to the test matrix in
    .github/workflows/tests.yml

Additional information and contact(s)

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

@codecov
Copy link

codecov bot commented Mar 13, 2026

Codecov Report

❌ Patch coverage is 28.26748% with 236 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.27%. Comparing base (a12644c) to head (1c0b416).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...ava/de/uka/ilkd/key/java/statement/ActiveCase.java 18.96% 43 Missing and 4 partials ⚠️
...va/de/uka/ilkd/key/java/recoderext/ActiveCase.java 33.89% 35 Missing and 4 partials ⚠️
...in/java/de/uka/ilkd/key/java/statement/Switch.java 13.63% 35 Missing and 3 partials ⚠️
.../uka/ilkd/key/java/visitor/CreatingASTVisitor.java 0.00% 25 Missing ⚠️
...uka/ilkd/key/java/visitor/ProgramContextAdder.java 30.00% 19 Missing and 2 partials ⚠️
...ilkd/key/java/statement/SwitchBranchSVWrapper.java 0.00% 11 Missing ⚠️
...lkd/key/java/recoderext/SwitchBranchSVWrapper.java 42.85% 8 Missing ⚠️
...rc/main/java/de/uka/ilkd/key/pp/PrettyPrinter.java 0.00% 7 Missing and 1 partial ⚠️
.../src/main/java/de/uka/ilkd/key/java/JavaTools.java 0.00% 2 Missing and 2 partials ⚠️
...main/java/de/uka/ilkd/key/java/statement/Exec.java 0.00% 2 Missing and 1 partial ⚠️
... and 20 more
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #3761      +/-   ##
============================================
- Coverage     50.34%   50.27%   -0.07%     
- Complexity    15902    15944      +42     
============================================
  Files          1597     1603       +6     
  Lines         91026    91281     +255     
  Branches      14554    14579      +25     
============================================
+ Hits          45824    45895      +71     
- Misses        39988    40145     +157     
- Partials       5214     5241      +27     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@unp1 unp1 linked an issue Mar 14, 2026 that may be closed by this pull request
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.

Implement Switch-to-If Without Transformation

1 participant