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

Error in Go generator when using typedefs in map keys

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.9.1
    • Component/s: Go - Compiler
    • Labels:
    • Patch Info:
      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

        Issue Links

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              emiraga Emir Habul

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment