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

Error in Go generator when using typedefs in map keys

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.9.1
    • Go - Compiler
    • Patch Available

    Description

      When following is written in .thrift input

        typedef i32 MyType
        typedef map<MyType, i32> ComplexMapType
      

      Generator builds the following:

        type ComplexMapType map[int32]int32
      

      This patch changes the type definition to be

        type ComplexMapType map[MyType]int32
      

      Since, there is really no need to resolve key type from MyType into int32. Compiler would throw error on lines like these:

        complex_var = make(map[MyType]int32, size)
      

      also,

        var _key1 MyType
        ...
        complex_var[_key1] = _val2
      

      Attachments

        1. thrift-map-keys.patch
          2 kB
          Emir Habul

        Issue Links

          Activity

            People

              Unassigned Unassigned
              emiraga Emir Habul
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: