Skip to content

4.0.2.6 - Conditional Statement: not taking true path when 'contains' function is in multi-variant evaluation #145

@umbravi

Description

@umbravi

I just picked up Genie4 for the first time after being away from the game for a few years. A chunk of my scripts aren't working correctly because the 'if' conditional isn't evaluating correctly when there are more than one evaluation in a statement AND the contains function is one of the evaluations.

When 'contains' (or '!contains') function is part of a multi-variant evaluation, the 'if' conditional is not correctly evaluating.

Given script names "test.cmd":

debug 10

if (true && true) then echo true
if contains("put|Put|get|Get", "%1") then echo 1 is put or get
if "%2" == "" then echo 2 is empty
if (contains("put|Put|get|Get", "%1") || "%2" == "") then echo 1 should be put or get or 2 should be empty
if (contains("put", "%1") && "%2" == "") then echo 1 should be put and 2 should be empty
if (!contains("inverse", "%1")) then echo 1 is not inverse
if (!contains("inverse multi", "%1") && "%2" == "") then echo 1 should not be inverse multi and 2 should be empty

Exit:
exit

And command: .test put

output is:

test.cmd(5): [if (true && true) then]
test.cmd(5): [echo true]
true
test.cmd(6): [if contains("put|Put|get|Get", "put") then]
test.cmd(6): [echo 1 is put or get]
1 is put or get
test.cmd(7): [if "" == "" then]
test.cmd(7): [echo 2 is empty]
2 is empty
test.cmd(8): [if (contains("put|Put|get|Get", "put") || "" == "") then]
test.cmd(9): [if (contains("put", "put") && "" == "") then]
test.cmd(10): [if (!contains("inverse", "put")) then]
test.cmd(10): [echo 1 is not inverse]
1 is not inverse
test.cmd(11): [if (!contains("inverse multi", "put") && "" == "") then]
test.cmd(13): [Exit:]
test.cmd(14): [exit]

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions