Fix bogus translation of nested conditionals with elseif clauses
This is an old bug that was present before Maxima 5.0. It doesn't
appear that this bug was present in Macsyma because I haven't found
any evidence that elseif existed in Macsyma.
The translation of a conditional with another conditional directly
nested in an elseif clause has been totally wrong. Using else-if
(else if) instead of elseif would work fine.
An example of some particularly bad behavior:
if false then
'wtf1
elseif false then
if true then
'wtf2
else
'wtf3
else
correct
was being incorrectly translated like
if false then
'wtf1
else if true then
'wtf2
else
'wtf3
So this would yield wtf2 instead of correct.
Some portions of code were not updated to correctly handle elseif
when it was first introduced. See commits
d89c9965 and
4cc510ca for
some late fixes related to elseif.
The problem in the translator has been due to an optimization for
the else-if case. The check for when to apply the optimization was
not particularly careful and the introduction of elseif caused the
translator to incorrectly apply the optimization technique to elseif
clauses like the one above.
The optimization is still useful for the else-if case, so we're
keeping it. We're just more careful about when to apply it now.
No problems with the test suite or share test suite.
tests/rtest_translator.mac runs as expected, with new tests.