[jira] [Commented] (THRIFT-4031) Go plugin generates invalid code for lists of typedef'ed built-in types

2017-03-04 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on THRIFT-4031:


Github user asfgit closed the pull request at:

https://github.com/apache/thrift/pull/1207


> Go plugin generates invalid code for lists of typedef'ed built-in types
> ---
>
> Key: THRIFT-4031
> URL: https://issues.apache.org/jira/browse/THRIFT-4031
> Project: Thrift
>  Issue Type: Bug
>  Components: Go - Compiler
>Affects Versions: 0.10.0
> Environment: Thrift version 0.10.0
> go version go1.7.4 linux/386
>Reporter: Benoit Sigoure
>Assignee: Can Celasun
>Priority: Critical
> Fix For: 0.11.0
>
>
> Reproduction:
> {code}
> mkdir /tmp/bug
> cd /tmp/bug
> cat >test.thrift < typedef i32 foo
> struct s {
>  1:list a
> }
> EOF
> mkdir _build
> thrift -out _build --gen go:package=pkg -r test.thrift
> {code}
> Then try to compile the resulting {{go build _build/pkg/test.go}} and you'll 
> get:
> {code}
> _build/pkg/test.go:81: cannot use _elem0 (type int32) as type Foo in append
> {code}
> Here's the generated code with line numbers and a couple comments I added:
> {code}
>  67 func (p *S)  ReadField1(iprot thrift.TProtocol) error {
>  68   _, size, err := iprot.ReadListBegin()
>  69   if err != nil {
>  70 return thrift.PrependError("error reading list begin: ", err)
>  71   }
>  72   tSlice := make([]Foo, 0, size)  // The slice contain Foo values
>  73   p.A =  tSlice
>  74   for i := 0; i < size; i ++ {
>  75 var _elem0 int32
>  76 if v, err := iprot.ReadI32(); err != nil {
>  77 return thrift.PrependError("error reading field 0: ", err)
>  78 } else {
>  79 _elem0 = v
>  80 }
>  81 p.A = append(p.A, _elem0)  // Here the code should do append(p.A, 
> Foo(_elem0))
>  82   }
>  83   if err := iprot.ReadListEnd(); err != nil {
>  84 return thrift.PrependError("error reading list end: ", err)
>  85   }
>  86   return nil
>  87 }
> {code}
> This was working fine with 0.9.3 so this is a regression in 0.10.0.  With 
> 0.9.3 the slice {{tSlice}} is a {{[]int32}}, as opposed to a {{[]Foo}}.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (THRIFT-4031) Go plugin generates invalid code for lists of typedef'ed built-in types

2017-03-03 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on THRIFT-4031:


GitHub user dcelasun opened a pull request:

https://github.com/apache/thrift/pull/1207

THRIFT-4031: Fix invalid Go code generation for list of typedef'ed types

This commit reverts 12d430e723b020f7a8ce42a40c19edf88f948367 which caused 
invalid code to be generated for certain types.

See THRIFT-4031 for details.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/dcelasun/thrift master

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/thrift/pull/1207.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1207


commit c5609762b717db771985c8d3f74befda3764d180
Author: D. Can Celasun 
Date:   2017-03-03T11:03:24Z

THRIFT-4031: Fix invalid code generation for list of typedef'ed built-in 
types

This commit reverts 12d430e723b020f7a8ce42a40c19edf88f948367 which
caused invalid code to be generated for certain types.

See THRIFT-4031 for details.




> Go plugin generates invalid code for lists of typedef'ed built-in types
> ---
>
> Key: THRIFT-4031
> URL: https://issues.apache.org/jira/browse/THRIFT-4031
> Project: Thrift
>  Issue Type: Bug
>  Components: Go - Compiler
>Affects Versions: 0.10.0
> Environment: Thrift version 0.10.0
> go version go1.7.4 linux/386
>Reporter: Benoit Sigoure
>Priority: Critical
>
> Reproduction:
> {code}
> mkdir /tmp/bug
> cd /tmp/bug
> cat >test.thrift < typedef i32 foo
> struct s {
>  1:list a
> }
> EOF
> mkdir _build
> thrift -out _build --gen go:package=pkg -r test.thrift
> {code}
> Then try to compile the resulting {{go build _build/pkg/test.go}} and you'll 
> get:
> {code}
> _build/pkg/test.go:81: cannot use _elem0 (type int32) as type Foo in append
> {code}
> Here's the generated code with line numbers and a couple comments I added:
> {code}
>  67 func (p *S)  ReadField1(iprot thrift.TProtocol) error {
>  68   _, size, err := iprot.ReadListBegin()
>  69   if err != nil {
>  70 return thrift.PrependError("error reading list begin: ", err)
>  71   }
>  72   tSlice := make([]Foo, 0, size)  // The slice contain Foo values
>  73   p.A =  tSlice
>  74   for i := 0; i < size; i ++ {
>  75 var _elem0 int32
>  76 if v, err := iprot.ReadI32(); err != nil {
>  77 return thrift.PrependError("error reading field 0: ", err)
>  78 } else {
>  79 _elem0 = v
>  80 }
>  81 p.A = append(p.A, _elem0)  // Here the code should do append(p.A, 
> Foo(_elem0))
>  82   }
>  83   if err := iprot.ReadListEnd(); err != nil {
>  84 return thrift.PrependError("error reading list end: ", err)
>  85   }
>  86   return nil
>  87 }
> {code}
> This was working fine with 0.9.3 so this is a regression in 0.10.0.  With 
> 0.9.3 the slice {{tSlice}} is a {{[]int32}}, as opposed to a {{[]Foo}}.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (THRIFT-4031) Go plugin generates invalid code for lists of typedef'ed built-in types

2017-02-22 Thread Jens Geyer (JIRA)

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

Jens Geyer commented on THRIFT-4031:


[~tsuna]
{quote}
For the example .thrift file that I provided, the code compile fines before 
this commit, but breaks after that commit. I imagine the commit intended to fix 
something but broke something else in the process.
{quote}

Why don't we add it to the usual tests?

[~calcifer]
That commit belongs to THRIFT-2955. I have to admit that I am not that deep 
into the subtleties of how these two (three?) issues are affecting each other. 
If you guys come to some solution that makes everybody happy (including myself) 
I will commit it. Does that sound like a plan to you?




> Go plugin generates invalid code for lists of typedef'ed built-in types
> ---
>
> Key: THRIFT-4031
> URL: https://issues.apache.org/jira/browse/THRIFT-4031
> Project: Thrift
>  Issue Type: Bug
>  Components: Go - Compiler
>Affects Versions: 0.10.0
> Environment: Thrift version 0.10.0
> go version go1.7.4 linux/386
>Reporter: Benoit Sigoure
>Priority: Critical
>
> Reproduction:
> {code}
> mkdir /tmp/bug
> cd /tmp/bug
> cat >test.thrift < typedef i32 foo
> struct s {
>  1:list a
> }
> EOF
> mkdir _build
> thrift -out _build --gen go:package=pkg -r test.thrift
> {code}
> Then try to compile the resulting {{go build _build/pkg/test.go}} and you'll 
> get:
> {code}
> _build/pkg/test.go:81: cannot use _elem0 (type int32) as type Foo in append
> {code}
> Here's the generated code with line numbers and a couple comments I added:
> {code}
>  67 func (p *S)  ReadField1(iprot thrift.TProtocol) error {
>  68   _, size, err := iprot.ReadListBegin()
>  69   if err != nil {
>  70 return thrift.PrependError("error reading list begin: ", err)
>  71   }
>  72   tSlice := make([]Foo, 0, size)  // The slice contain Foo values
>  73   p.A =  tSlice
>  74   for i := 0; i < size; i ++ {
>  75 var _elem0 int32
>  76 if v, err := iprot.ReadI32(); err != nil {
>  77 return thrift.PrependError("error reading field 0: ", err)
>  78 } else {
>  79 _elem0 = v
>  80 }
>  81 p.A = append(p.A, _elem0)  // Here the code should do append(p.A, 
> Foo(_elem0))
>  82   }
>  83   if err := iprot.ReadListEnd(); err != nil {
>  84 return thrift.PrependError("error reading list end: ", err)
>  85   }
>  86   return nil
>  87 }
> {code}
> This was working fine with 0.9.3 so this is a regression in 0.10.0.  With 
> 0.9.3 the slice {{tSlice}} is a {{[]int32}}, as opposed to a {{[]Foo}}.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (THRIFT-4031) Go plugin generates invalid code for lists of typedef'ed built-in types

2017-02-21 Thread Can Celasun (JIRA)

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

Can Celasun commented on THRIFT-4031:
-

[~jensg] that commit was a while ago, but do you remember why that was 
necessary? Maybe it can be reverted?

> Go plugin generates invalid code for lists of typedef'ed built-in types
> ---
>
> Key: THRIFT-4031
> URL: https://issues.apache.org/jira/browse/THRIFT-4031
> Project: Thrift
>  Issue Type: Bug
>  Components: Go - Compiler
>Affects Versions: 0.10.0
> Environment: Thrift version 0.10.0
> go version go1.7.4 linux/386
>Reporter: Benoit Sigoure
>Priority: Critical
>
> Reproduction:
> {code}
> mkdir /tmp/bug
> cd /tmp/bug
> cat >test.thrift < typedef i32 foo
> struct s {
>  1:list a
> }
> EOF
> mkdir _build
> thrift -out _build --gen go:package=pkg -r test.thrift
> {code}
> Then try to compile the resulting {{go build _build/pkg/test.go}} and you'll 
> get:
> {code}
> _build/pkg/test.go:81: cannot use _elem0 (type int32) as type Foo in append
> {code}
> Here's the generated code with line numbers and a couple comments I added:
> {code}
>  67 func (p *S)  ReadField1(iprot thrift.TProtocol) error {
>  68   _, size, err := iprot.ReadListBegin()
>  69   if err != nil {
>  70 return thrift.PrependError("error reading list begin: ", err)
>  71   }
>  72   tSlice := make([]Foo, 0, size)  // The slice contain Foo values
>  73   p.A =  tSlice
>  74   for i := 0; i < size; i ++ {
>  75 var _elem0 int32
>  76 if v, err := iprot.ReadI32(); err != nil {
>  77 return thrift.PrependError("error reading field 0: ", err)
>  78 } else {
>  79 _elem0 = v
>  80 }
>  81 p.A = append(p.A, _elem0)  // Here the code should do append(p.A, 
> Foo(_elem0))
>  82   }
>  83   if err := iprot.ReadListEnd(); err != nil {
>  84 return thrift.PrependError("error reading list end: ", err)
>  85   }
>  86   return nil
>  87 }
> {code}
> This was working fine with 0.9.3 so this is a regression in 0.10.0.  With 
> 0.9.3 the slice {{tSlice}} is a {{[]int32}}, as opposed to a {{[]Foo}}.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (THRIFT-4031) Go plugin generates invalid code for lists of typedef'ed built-in types

2017-02-21 Thread Benoit Sigoure (JIRA)

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

Benoit Sigoure commented on THRIFT-4031:


For the example {{.thrift}} file that I provided, the code compile fines before 
this commit, but breaks after that commit.  I imagine the commit intended to 
fix something but broke something else in the process.

> Go plugin generates invalid code for lists of typedef'ed built-in types
> ---
>
> Key: THRIFT-4031
> URL: https://issues.apache.org/jira/browse/THRIFT-4031
> Project: Thrift
>  Issue Type: Bug
>  Components: Go - Compiler
>Affects Versions: 0.10.0
> Environment: Thrift version 0.10.0
> go version go1.7.4 linux/386
>Reporter: Benoit Sigoure
>Priority: Critical
>
> Reproduction:
> {code}
> mkdir /tmp/bug
> cd /tmp/bug
> cat >test.thrift < typedef i32 foo
> struct s {
>  1:list a
> }
> EOF
> mkdir _build
> thrift -out _build --gen go:package=pkg -r test.thrift
> {code}
> Then try to compile the resulting {{go build _build/pkg/test.go}} and you'll 
> get:
> {code}
> _build/pkg/test.go:81: cannot use _elem0 (type int32) as type Foo in append
> {code}
> Here's the generated code with line numbers and a couple comments I added:
> {code}
>  67 func (p *S)  ReadField1(iprot thrift.TProtocol) error {
>  68   _, size, err := iprot.ReadListBegin()
>  69   if err != nil {
>  70 return thrift.PrependError("error reading list begin: ", err)
>  71   }
>  72   tSlice := make([]Foo, 0, size)  // The slice contain Foo values
>  73   p.A =  tSlice
>  74   for i := 0; i < size; i ++ {
>  75 var _elem0 int32
>  76 if v, err := iprot.ReadI32(); err != nil {
>  77 return thrift.PrependError("error reading field 0: ", err)
>  78 } else {
>  79 _elem0 = v
>  80 }
>  81 p.A = append(p.A, _elem0)  // Here the code should do append(p.A, 
> Foo(_elem0))
>  82   }
>  83   if err := iprot.ReadListEnd(); err != nil {
>  84 return thrift.PrependError("error reading list end: ", err)
>  85   }
>  86   return nil
>  87 }
> {code}
> This was working fine with 0.9.3 so this is a regression in 0.10.0.  With 
> 0.9.3 the slice {{tSlice}} is a {{[]int32}}, as opposed to a {{[]Foo}}.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (THRIFT-4031) Go plugin generates invalid code for lists of typedef'ed built-in types

2017-02-21 Thread Can Celasun (JIRA)

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

Can Celasun commented on THRIFT-4031:
-

Seems this was intentional: 
https://github.com/apache/thrift/commit/12d430e723b020f7a8ce42a40c19edf88f948367

Does it compile fine if you revert that commit?

> Go plugin generates invalid code for lists of typedef'ed built-in types
> ---
>
> Key: THRIFT-4031
> URL: https://issues.apache.org/jira/browse/THRIFT-4031
> Project: Thrift
>  Issue Type: Bug
>  Components: Go - Compiler
>Affects Versions: 0.10.0
> Environment: Thrift version 0.10.0
> go version go1.7.4 linux/386
>Reporter: Benoit Sigoure
>Priority: Critical
>
> Reproduction:
> {code}
> mkdir /tmp/bug
> cd /tmp/bug
> cat >test.thrift < typedef i32 foo
> struct s {
>  1:list a
> }
> EOF
> mkdir _build
> thrift -out _build --gen go:package=pkg -r test.thrift
> {code}
> Then try to compile the resulting {{go build _build/pkg/test.go}} and you'll 
> get:
> {code}
> _build/pkg/test.go:81: cannot use _elem0 (type int32) as type Foo in append
> {code}
> Here's the generated code with line numbers and a couple comments I added:
> {code}
>  67 func (p *S)  ReadField1(iprot thrift.TProtocol) error {
>  68   _, size, err := iprot.ReadListBegin()
>  69   if err != nil {
>  70 return thrift.PrependError("error reading list begin: ", err)
>  71   }
>  72   tSlice := make([]Foo, 0, size)  // The slice contain Foo values
>  73   p.A =  tSlice
>  74   for i := 0; i < size; i ++ {
>  75 var _elem0 int32
>  76 if v, err := iprot.ReadI32(); err != nil {
>  77 return thrift.PrependError("error reading field 0: ", err)
>  78 } else {
>  79 _elem0 = v
>  80 }
>  81 p.A = append(p.A, _elem0)  // Here the code should do append(p.A, 
> Foo(_elem0))
>  82   }
>  83   if err := iprot.ReadListEnd(); err != nil {
>  84 return thrift.PrependError("error reading list end: ", err)
>  85   }
>  86   return nil
>  87 }
> {code}
> This was working fine with 0.9.3 so this is a regression in 0.10.0.  With 
> 0.9.3 the slice {{tSlice}} is a {{[]int32}}, as opposed to a {{[]Foo}}.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)