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

TestTacletEquality ignores semantic switches #3489

Open
WolframPfeifer opened this issue Jun 21, 2024 · 3 comments
Open

TestTacletEquality ignores semantic switches #3489

WolframPfeifer opened this issue Jun 21, 2024 · 3 comments

Comments

@WolframPfeifer
Copy link
Member

Description

While working on #3353, I noticed that changes inside of semantic switches in taclets are ignored.

For example, consider the following taclet:

    assignmentMultiplicationInt {
        \find(\modality{#normalassign}{..
                    #loc = #seCharByteShortInt0 * #seCharByteShortInt1;
                ...}\endmodality (post))
        (intRules:arithmeticSemanticsCheckingOF) {
            "Overflow check":
                \add(==> inInt(mul(#seCharByteShortInt0, #seCharByteShortInt1)))
        };
        \replacewith({#loc := javaMulInt(#seCharByteShortInt0, #seCharByteShortInt1)}
            \modality{#normalassign}{.. ...}\endmodality (post))
        \heuristics(executeIntegerAssignment)
        \displayname "multiplication"
    };

Compare the corresponding entry in the taclets.old.txt:

== assignmentMultiplicationInt (multiplication) =========================================
assignmentMultiplicationInt {
\find(#normalassign ((modal operator))|{{ ..
  #loc = #seCharByteShortInt0 * #seCharByteShortInt1;
... }}| (post))
\replacewith(update-application(elem-update(#loc (program Variable))(javaMulInt(#seCharByteShortInt0,#seCharByteShortInt1)),#normalassign(post))) 
\heuristics(executeIntegerAssignment)
Choices: programRules:Java}

Note that the part with the semantics switch

        (intRules:arithmeticSemanticsCheckingOF) {
            "Overflow check":
                \add(==> inInt(mul(#seCharByteShortInt0, #seCharByteShortInt1)))
        };

does not occur at all. Thus, changes here are not correctly detected.

Reproducible

always

Steps to reproduce

  1. Change something inside the semantics switch of the taclet mentioned above.
  2. Generate a new oracle file "taclets.new.txt" by running the method TestTacletEquality::createNewOracle and rename it to taclets.old.txt.

The file is identical to the old version, instead of correctly reflecting the changed taclet.

@mattulbrich
Copy link
Member

mattulbrich commented Jun 21, 2024 via email

@WolframPfeifer
Copy link
Member Author

Does this break/concern the taclet definitions used in KeY or is perhaps the printing to taclets.new.txt etc. broken?

The printing is broken. However, at the moment I do not know how to fix this. It seems that everything inside the by choice/taclet option switch is ignored by the toString() method of Taclet (and its subclasses).

I think there is another potential problem with the test case: Changes in the types of schema variables are not detected (their declarations are not included in the textual representation).

@unp1
Copy link
Member

unp1 commented Jun 26, 2024

The printing is broken. However, at the moment I do not know how to fix this. It seems that everything inside the by choice/taclet option switch is ignored by the toString() method of Taclet (and its subclasses).

I think the printing would need to use the corresponding TacletBuilder class. The Taclet instance itself contains only the activated goals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants