[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Bug with logical operator or misunderstanding?
- From: Sean Bolton <sean@...>
- Date: Tue, 25 Jan 2011 14:30:09 -0800
On Jan 25, 2011, at 2:47 AM, Ryota Hirose wrote:
2011/1/25 Ryota Hirose <hirose.ryota@gmail.com>
I got a shorter patch, for 5.1.4, but I don't have confidence
that this is correct for other cases.
I'm sorry, it's a reversed patch. I attached correct patch in this
mail.
And I tested 'constructs.lua' in Lua 5.1 test suite. This patch
worked fine.
Ryota Hirose
<lcode.c.diff>
Hmm, we're not there yet. Your patch 5.1.4 yields the correct results
for these two cases:
assert((((1 or false) and true) or false) == true)
assert((((1 or 2) and true) or false) == true)
but it doesn't fix these cases:
assert(((nil and true) or false and true) == false)
assert((((nil and true) or false) and true) == false)
Note that the Lua 5.1 test suite has no specific checks for these
expressions, and the Lua 5.2.0-alpha test suite only checks for the
first and fourth ones (and Lua 5.2.0-alpha still fails on the second
and third.)
Thanks,
-Sean