Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-5540

Can't use a typedef for a container type containing enums in a constant

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.16.0
    • 0.17.0
    • Compiler (General)
    • None

    Description

      This small thrift file fails to compile.

      enum SomeEnum {
          A,
          B,
          C
      }
      typedef map<SomeEnum, i32> SomeMap
      const SomeMap MY_MAP = {
          SomeEnum.A: 123,
          SomeEnum.B: 456,
          SomeEnum.C: 789
      }
       

      Trying to compile this thrift file results in this error: 

      [FAILURE:generation:1] Error: have identifier "SomeEnum.A", but unset enum on line!

       

      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.

      Attachments

        Issue Links

          Activity

            People

              jensg Jens Geyer
              rchomium Raymond Chee
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m