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

Jens Geyer edited comment on THRIFT-5690 at 3/6/23 10:15 PM:
-------------------------------------------------------------

> Best guess can be related with 
> https://issues.apache.org/jira/browse/THRIFT-5626

This is also reproducible with 0.9.1 and most likely earlier. So it is sort of 
by design. Probably not explicitly written down, but defacto expected.

In your specific case you can easily solve it by removing the empty constant 
and just put:
{code:java}
struct Test {
  10: optional Foo foo // remove the = {};
}

struct Foo {
  10: optional string bar;
}
{code}


was (Author: jensg):
> Best guess can be related with 
> https://issues.apache.org/jira/browse/THRIFT-5626

Better guess:  this is also reproducible with 0.9.1 and most likely earlier. 

In your specific case you can easily solve it by removing the empty constant 
and just put:

{code}
struct Test {
  10: optional Foo foo // remove the = {};
}

struct Foo {
  10: optional string bar;
}
{code}

> Constant expects type to be defined before
> ------------------------------------------
>
>                 Key: THRIFT-5690
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5690
>             Project: Thrift
>          Issue Type: Bug
>          Components: Compiler (General)
>            Reporter: Bogdan Drutu
>            Priority: Major
>
> {code}
> struct Test {
> 10: optional Foo foo = {};
> }
> struct Foo {
> 10: optional string bar;
> }
> {code}
> Tried with thrift 0.18.0/0.18.1
> {code}
> [ERROR] thrift failed output: Type "Foo" not defined
> {code} 
> Best guess can be related with 
> https://issues.apache.org/jira/browse/THRIFT-5626



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

Reply via email to