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

Christian Lavoie edited comment on THRIFT-787 at 9/25/10 9:20 PM:
------------------------------------------------------------------

Actually, this is now handled in parse/t_enum.*, the resolve_values call. It's 
implemented redundantly in (as far as I can tell) all generators the same way:

{noformat}
 286   for (c_iter = constants.begin(); c_iter != constants.end(); ++c_iter) {
 287     if ((*c_iter)->has_value()) {
 288       value = (*c_iter)->get_value();
 289     } else {
 290       ++value; // THIS WILL NEVER EXECUTE
 291     }
 292     string name = capitalize((*c_iter)->get_name());
 293 
 294     f_types_ <<
 295       indent() << name << " -> " << value << endl;
 296   }
{noformat}

(or the appropriate variant thereof)

So this patch is now redundant (thanks to resolve_values, the else branch of 
that if statement is never taken in the generators). Cleanup patch incoming as 
soon as I have a setup where I can run tests.

      was (Author: clavoie):
    Actually, this is now handled in parse/t_enum.*, the resolve_values call. 
It's implemented redundantly in (as far as I can tell) all generators the same 
way:

 286   for (c_iter = constants.begin(); c_iter != constants.end(); ++c_iter) {
 287     if ((*c_iter)->has_value()) {
 288       value = (*c_iter)->get_value();
 289     } else {
 290       ++value; // THIS WILL NEVER EXECUTE
 291     }
 292     string name = capitalize((*c_iter)->get_name());
 293 
 294     f_types_ <<
 295       indent() << name << " -> " << value << endl;
 296   }

(or the appropriate variant thereof)

So this patch is now redundant (thanks to resolve_values, the else branch of 
that if statement is never taken in the generators). Cleanup patch incoming as 
soon as I have a setup where I can run tests.
  
> Enums are not read correctly
> ----------------------------
>
>                 Key: THRIFT-787
>                 URL: https://issues.apache.org/jira/browse/THRIFT-787
>             Project: Thrift
>          Issue Type: Bug
>          Components: Haskell - Compiler
>    Affects Versions: 0.1
>         Environment: All platforms
>            Reporter: Spiridon Eliopoulos
>            Assignee: Spiridon Eliopoulos
>            Priority: Minor
>         Attachments: 0001--THRIFT-787-Fix-bug-in-enum-deserialization.patch
>
>
> The Haskell (and OCaml) generators emit incorrect code for enum 
> deserilalization. The value counter is not reset to -1 before the 
> deserialization function is generated.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to