[ 
https://issues.apache.org/jira/browse/THRIFT-3584?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15130529#comment-15130529
 ] 

ASF GitHub Bot commented on THRIFT-3584:
----------------------------------------

Github user nsuke commented on the pull request:

    https://github.com/apache/thrift/pull/826#issuecomment-179283037
  
    OK, "read" was not a precise word.
    The problem I was trying to describe is about receiving boolean return 
value (not field) that happened to be `false`.
    At a quick glance, it seems that `if result.success then` in generated code 
can be fixed in the same way as this.
    
    If you're running the test mentioned in the other patch, you can uncomment 
the line `assertEqual(client:testBool(false), ...` and verify locally.
    



> the value(false) for parameter self.argBool will be lost when condition is 
> 'if self.argBool then' .
> ---------------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-3584
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3584
>             Project: Thrift
>          Issue Type: Bug
>          Components: Lua - Compiler
>    Affects Versions: 0.9.3
>         Environment: Linux Windows
>            Reporter: WangYaofu
>             Fix For: 0.9.4
>
>
> To check element of self whether nil or not,avoid the value(false) of BOOL is 
> lost.
> eg.
> {code:title=Before}
>   if self.argBool then
>     oprot:writeFieldBegin('argBool', TType.BOOL, 13)
>     oprot:writeBool(self.argBool)
>     oprot:writeFieldEnd()
>   end
> {code}
> {code:title=After}
>   if self.argBool ~= nil then
>     oprot:writeFieldBegin('argBool', TType.BOOL, 13)
>     oprot:writeBool(self.argBool)
>     oprot:writeFieldEnd()
>   end
> {code}
> Why:
>   the value(false) for parameter self.argBool will be lost when condition is 
> 'if self.argBool then' as before.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to