KeYProject / key

KeY Theorem Prover for Deductive Java Verification
https://key-project.org
Other
41 stars 24 forks source link

Add ADT Destructors #3420

Closed Drodt closed 5 months ago

Drodt commented 5 months ago

Intended Change

This PR adds deconstructors for ADTs defined in KeY files. Let's say you have a file like

\datatypes {
  List = Nil | Cons(any head, List tail)
}

Previously, a sort List and two functions List Nil and List Cons(any, List) were generated. Now, we also define two additional functions: any head(List) and List tail(List), with the additional rules head(Cons(h, t)) = h and tail(Cons(h, t)) = t.

Additionally, we now raise exceptions, when ADT definitions overwrite functions defined elsewhere. If two deconstructors should be defined, an exception is also raised. But, two deconstructors with the same name and return type are permitted.

Type of pull request

Ensuring quality

Additional information and contact(s)

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

codecov[bot] commented 5 months ago

Codecov Report

Attention: Patch coverage is 94.36620% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 37.90%. Comparing base (1fb0c10) to head (9f72a2d).

Files Patch % Lines
.../key/nparser/builder/FunctionPredicateBuilder.java 71.42% 3 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #3420 +/- ## ============================================ + Coverage 37.77% 37.90% +0.13% - Complexity 17031 17064 +33 ============================================ Files 2076 2076 Lines 126950 127017 +67 Branches 21381 21388 +7 ============================================ + Hits 47952 48152 +200 + Misses 73092 72957 -135 - Partials 5906 5908 +2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.