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

Go map has incorrect types when used with forward-defined types

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 0.10.0
    • Go - Compiler
    • None

    Description

      Generating the following IDL results in Go code which does not compile:

      typedef map<Foo, Foo> FooMap
      struct Foo {}
      
      service Service {
          void foo(1: FooMap fooMap)
      }
      

      ./service.go:278: cannot use _key4 (type *Foo) as type Foo in map index
      ./service.go:278: cannot use _val5 (type *Foo) as type Foo in assignment

      However, if the struct precedes the typedef, the code is generated correctly:

      struct Foo {}
      typedef map<Foo, Foo> FooMap
      
      service Service {
          void foo(1: FooMap fooMap)
      }
      

      Attachments

        Issue Links

          Activity

            People

              jensg Jens Geyer
              tylertreat Tyler Treat
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: