You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jens Geyer (Jira)" <ji...@apache.org> on 2022/03/17 08:50:00 UTC

[jira] [Resolved] (THRIFT-5540) Can't use a typedef for a container type containing enums in a constant

     [ https://issues.apache.org/jira/browse/THRIFT-5540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jens Geyer resolved THRIFT-5540.
--------------------------------
    Fix Version/s: 0.17.0
       Resolution: Fixed

> 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
>            Assignee: Jens Geyer
>            Priority: Minor
>             Fix For: 0.17.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> 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 it also happens for typedefs of lists of enums.



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