key icon indicating copy to clipboard operation
key copied to clipboard

TestTacletEquality ignores semantic switches

Open WolframPfeifer opened this issue 8 months ago • 3 comments

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.

WolframPfeifer avatar Jun 21 '24 14:06 WolframPfeifer