[ 
https://issues.apache.org/jira/browse/THRIFT-4173?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17066996#comment-17066996
 ] 

Jens Geyer commented on THRIFT-4173:
------------------------------------

Could you please clarify? I mean the both of you. Either we need to add some 
missing info or it has been resolved, in which case it could be closed..

> Go: thrift compiler generates wrong code for list of aliased type 
> ------------------------------------------------------------------
>
>                 Key: THRIFT-4173
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4173
>             Project: Thrift
>          Issue Type: Bug
>          Components: Compiler (General)
>    Affects Versions: 0.10.0
>         Environment: Linux amd64/Mac OS Sierra
>            Reporter: Andrii Degtiarov
>            Priority: Major
>
> Thrift code bellow produced incorrect Go code.
> In the generated code {noformat}var _elem1 int8{noformat} should be 
> {noformat}var _elem1 StatType{noformat} and {noformat}temp := 
> int8(v){noformat} should be {noformat}temp := StatType(v){noformat}
> Thrift:
> {code}
> typedef i8 StatType
> struct SomeStruct {
>  1: list<StatType> stats;
> }
> {code}
> Generated code:
> {code}
> func (p *CSVAnalyzeTaskPayload)  ReadField1(iprot thrift.TProtocol) error {
>   _, size, err := iprot.ReadListBegin()
>   if err != nil {
>     return thrift.PrependError("error reading list begin: ", err)
>   }
>   tSlice := make([]StatType, 0, size)
>   p.Stats =  tSlice
>   for i := 0; i < size; i ++ {
> var _elem1 int8
>     if v, err := iprot.ReadByte(); err != nil {
>     return thrift.PrependError("error reading field 0: ", err)
> } else {
>     temp := int8(v)
>     _elem1 = temp
> }
>     p.Stats = append(p.Stats, _elem1)
>   }
>   if err := iprot.ReadListEnd(); err != nil {
>     return thrift.PrependError("error reading list end: ", err)
>   }
>   return nil
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to