Raymond Chee created THRIFT-5540:
------------------------------------

             Summary: Can't use a typedef for a container type containing enums 
in a constant
                 Key: THRIFT-5540
                 URL: https://issues.apache.org/jira/browse/THRIFT-5540
             Project: Thrift
          Issue Type: Bug
          Components: Compiler (General)
    Affects Versions: 0.16.0
            Reporter: Raymond Chee


This small thrift file fails to compile.

 
{code:java}
enum SomeEnum {
    A,
    B,
    C
}
typedef map<SomeEnum, i32> SomeMap
const SomeMap MY_MAP = {
    SomeEnum.A: 123,
    SomeEnum.B: 456,
    SomeEnum.C: 789
}
 {code}
Trying to compile this thrift file results in this error: 
{code:java}
[FAILURE:generation:1] Error: have identifier "SomeEnum.A", but unset enum on 
line!{code}
 

If I didn't use the typedef and instead declared MY_MAP with type map<SomeEnum, 
i32>, there is no issues with compilation. This issue also happens if SomeEnum 
is the value type in the map, and is also present for typedefs of lists of 
enums.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to