[
https://issues.apache.org/jira/browse/THRIFT-473?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12704368#action_12704368
]
Bryan Duxbury commented on THRIFT-473:
--------------------------------------
As far as I can tell, what happens is that the ONE in second.thrift doesn't get
detected as a constant, so it gets parsed as an "unquoted string" (see
THRIFT-472). This behavior is usually used to create the left-hand side names
of enums and such.
I'm not sure where the external constants can be retrieved from in the current
organization, so if someone who knows the compiler could chime in, that would
be great.
> constant structs that contain enum fields don't allow use of enums from
> external thrift files
> ---------------------------------------------------------------------------------------------
>
> Key: THRIFT-473
> URL: https://issues.apache.org/jira/browse/THRIFT-473
> Project: Thrift
> Issue Type: Bug
> Components: Compiler (General)
> Affects Versions: 0.1
> Reporter: Bryan Duxbury
> Priority: Minor
>
> Ok... this one is a little tricky to explain. Take this example Thrift def:
> {code}
> enum my_enum {
> ONE = 1, TWO = 2
> }
> struct my_struct {
> 1: my_enum enum_field;
> }
> const my_struct MY_STRUCT {'enum_field': ONE}
> {code}
> In this code, a constant of a struct type that contains an enum field can be
> declared by using just the constant name that we care about. This works today.
> Now, take another example:
> (first.thrift)
> {code}
> enum my_enum {
> ONE = 1, TWO = 2
> }
> struct my_struct {
> 1: my_enum enum_field;
> }
> {code}
> (second.thrift)
> {code}
> include "first.thrift"
> const my_struct MY_STRUCT {'enum_field': ONE}
> {code}
> If you do this, then you get an error that causes the compiler to quit. I
> think this is a valid use case, so it should probably be made to work.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.