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

Sylwester Lachiewicz commented on THRIFT-3491:
----------------------------------------------

Still reproducible with the 0.24.0 compiler. THRIFT-6197 collects this and four 
sibling reports under the one root cause in the Go generator, with the IDL and 
the exact compiler errors for a typedef declared after use, a typedef of a 
struct, and a typedef of a struct from an included file. Leaving this issue 
open; a fix for THRIFT-6197 should close it.

> Invalid Go Code From Service Signatures With Typedef'd Structs
> --------------------------------------------------------------
>
>                 Key: THRIFT-3491
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3491
>             Project: Thrift
>          Issue Type: Bug
>          Components: Go - Compiler
>    Affects Versions: 0.9.3
>            Reporter: Tom Deering
>            Assignee: Duru Can Celasun
>            Priority: Major
>              Labels: golang, service, typedef
>
> Thrift 0.9.3 produces invalid Go code when service definitions are written in 
> terms of type-deffed structs.
> {code}
> namespace go bug
> struct Foo {
>       1:string s,
> }
> typedef Foo Bar
> service BarService {
>       Bar getBar()
> }
> {code}
> Attempting to compile the Go code that Thrift outputs yields the following 
> errors.
> {code}
> bug/barservice.go:192: cannot use retval (type Bar) as type *Bar in assignment
> bug/barservice.go:323: cannot use Foo literal (type *Foo) as type *Bar in 
> assignment
> bug/barservice.go:324: p.Success.Read undefined (type *Bar has no field or 
> method Read)
> bug/barservice.go:351: p.Success.Write undefined (type *Bar has no field or 
> method Write)
> {code}
> Inspecting the Go code, it appears that the Go compiler is telling the truth.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to