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

Tyler Treat updated THRIFT-3705:
--------------------------------
    Description: 
Generating the following IDL results in Go code which does not compile:

{code}
typedef map<Foo, Foo> FooMap
struct Foo {}

service Service {
    void foo(1: FooMap fooMap)
}
{code}

./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:

{code}
struct Foo {}
typedef map<Foo, Foo> FooMap

service Service {
    void foo(1: FooMap fooMap)
}
{code}

  was:
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)
}


> Go map incorrect types with map typedef
> ---------------------------------------
>
>                 Key: THRIFT-3705
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3705
>             Project: Thrift
>          Issue Type: Bug
>          Components: Go - Compiler
>            Reporter: Tyler Treat
>            Priority: Minor
>
> Generating the following IDL results in Go code which does not compile:
> {code}
> typedef map<Foo, Foo> FooMap
> struct Foo {}
> service Service {
>     void foo(1: FooMap fooMap)
> }
> {code}
> ./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:
> {code}
> struct Foo {}
> typedef map<Foo, Foo> FooMap
> service Service {
>     void foo(1: FooMap fooMap)
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to