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

David Reiss commented on THRIFT-544:
------------------------------------

This was committed as r982825.  It doesn't show up in the "all" tab because it 
was committed with a tag of "THRIFT-554".

> multiple enums with the same key generate invalid code
> ------------------------------------------------------
>
>                 Key: THRIFT-544
>                 URL: https://issues.apache.org/jira/browse/THRIFT-544
>             Project: Thrift
>          Issue Type: Bug
>          Components: Compiler (General)
>    Affects Versions: 0.2
>            Reporter: Ben Taitelbaum
>            Assignee: Ben Taitelbaum
>            Priority: Minor
>             Fix For: 0.4
>
>         Attachments: thrift-544_add_enum_name_to_enum_keys.patch, 
> thrift-544_prevent_redefining_consts.patch
>
>
> The current generator produces multiple -define statements with the same 
> name, which isn't valid erlang code (and also isn't valid semantically if we 
> want two different values).
> {code:title=EnumTest.thrift|borderStyle=solid}
> enum MyType1 {
>   A = 0,
>   B = 1
> }
> enum MyType2 {
>   A = 2,
>   C = 4
> }
> {code}
> produces:
> {code:title=enumTest_types.hrl|borderStyle=solid}
> -ifndef(_enumTest_types_included).
> -define(_enumTest_types_included, yeah).
> -define(enumTest_A, 0).
> -define(enumTest_B, 1).
> -define(enumTest_A, 2).
> -define(enumTest_C, 4).
> -endif.
> {code}
> In the patched version, it produces this:
> {code:title=enumTest_types.hrl|borderStyle=solid}
> -ifndef(_enumTest_types_included).
> -define(_enumTest_types_included, yeah).
> -define(enumTest_MyType1_A, 0).
> -define(enumTest_MyType1_B, 1).
> -define(enumTest_MyType2_A, 2).
> -define(enumTest_MyType2_C, 4).
> -endif.
> {code}

-- 
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