You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Joe Bruner (JIRA)" <ji...@apache.org> on 2015/03/09 19:44:38 UTC

[jira] [Updated] (THRIFT-3037) Can not build Go code when using typedef in IDL

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

Joe Bruner updated THRIFT-3037:
-------------------------------
    Description: 
{code}
// Base.thrift
namespace go a.X.c
struct Foo {
    1: required string s
}
{code}

and the dependent file

{code}
// Child.thrift
namespace go a.Y.c
include "Base.thrift"

typedef Base.Foo Foo // <---- This is what causes the problem

struct Bar {
    1:Foo f  // <-- Will error
    // 1:Base.Foo f   Need to comment out typedef and use this instead
}
{code}

Compiling the thrift as is works, but when you go to install the a.Y.c package will produce:
{code}
/scratch/go/src/a/Y/c/ttypes.go:78: cannot use c.Foo literal (type *c.Foo) as type *Foo in assignment
/scratch/go/src/a/Y/c/ttypes.go:79: p.F.Read undefined (type *Foo has no field or method Read)
/scratch/go/src/a/Y/c/ttypes.go:105: p.F.Write undefined (type *Foo has no field or method Write)
{code}
If I comment out the typedef and swap the lines in Bar then everything works fine. This appears to only happen in Go.

  was:
// Base.thrift
namespace go a.X.c
struct Foo {
    1: required string s
}

and the dependant file

// Child.thrift
namespace go a.Y.c
include "Base.thrift"

typedef Base.Foo Foo // <---- This is what causes the problem

struct Bar {
    1:Foo f  // <-- Will error
    // 1:Base.Foo f   Need to comment out typedef and use this instead
}

Compiling the thrift as is works, but when you go to install the a.Y.c package will produce:

/scratch/go/src/a/Y/c/ttypes.go:78: cannot use c.Foo literal (type *c.Foo) as type *Foo in assignment
/scratch/go/src/a/Y/c/ttypes.go:79: p.F.Read undefined (type *Foo has no field or method Read)
/scratch/go/src/a/Y/c/ttypes.go:105: p.F.Write undefined (type *Foo has no field or method Write)

If I comment out the typedef and swap the lines in Bar then everything works fine. This appears to only happen in Go.


> Can not build Go code when using typedef in IDL
> -----------------------------------------------
>
>                 Key: THRIFT-3037
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3037
>             Project: Thrift
>          Issue Type: Bug
>          Components: Go - Compiler
>    Affects Versions: 0.9.2
>            Reporter: Joe Bruner
>
> {code}
> // Base.thrift
> namespace go a.X.c
> struct Foo {
>     1: required string s
> }
> {code}
> and the dependent file
> {code}
> // Child.thrift
> namespace go a.Y.c
> include "Base.thrift"
> typedef Base.Foo Foo // <---- This is what causes the problem
> struct Bar {
>     1:Foo f  // <-- Will error
>     // 1:Base.Foo f   Need to comment out typedef and use this instead
> }
> {code}
> Compiling the thrift as is works, but when you go to install the a.Y.c package will produce:
> {code}
> /scratch/go/src/a/Y/c/ttypes.go:78: cannot use c.Foo literal (type *c.Foo) as type *Foo in assignment
> /scratch/go/src/a/Y/c/ttypes.go:79: p.F.Read undefined (type *Foo has no field or method Read)
> /scratch/go/src/a/Y/c/ttypes.go:105: p.F.Write undefined (type *Foo has no field or method Write)
> {code}
> If I comment out the typedef and swap the lines in Bar then everything works fine. This appears to only happen in Go.



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