On Mon, 25 Nov 2024, Markus Elfring wrote: > Hello, > > I would like to clarify software development consequences also for > a simple script variant for the semantic patch language (like the following). The generated code indeed does not look ideal. But it won't cause any wrong matches. The isomorphisms are applied on the ASTs, not on the soure code. So there will be a tree with a ! at the root and a || as the argument that will not match any possible source code. Maybe it would be better to add isomorphisms for the de Morgan laws rather than adding some hacks into the generic isomorphism transformation to take this issue into account. julia > > > @show_questionable_checks@ > expression e1, e2; > statement s1, s2; > @@ > if > ( > *!(e1 || e2) > ) > s1 > else > s2 > > > Questionable test result: > Markus_Elfring@Sonne:/home/altes_Heim2/elfring/Projekte/Coccinelle/janitor> spatch --parse-cocci show_questionable_OR_checks2.cocci > … > ( > > ( > > ( > if (*!*(*e1 *|| *e2*)) > | > if (*!*e1 *|| *e2) > )s1 else s2 > | > … > > > I would interpret such data display in the way that the isomorphism “paren” > was applied here. > https://gitlab.inria.fr/coccinelle/coccinelle/-/blob/04f71e76b0857ca12ec7207b26368df78d2b57d4/standard.iso#L389 > > I find the shown SmPL code transformation inappropriate at this place. > Would we like to apply De Morgan's laws instead? > https://en.wikipedia.org/wiki/De_Morgan%27s_laws > > Would we like to reconsider the application of the isomorphism for the switching > of if/else branches accordingly? > > Regards, > Markus >