thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Igor Ribeiro de Assis (JIRA)" <j...@apache.org>
Subject [jira] Updated: (THRIFT-868) Referencing constant values doesn't work with with typedef types
Date Mon, 04 Oct 2010 20:16:33 GMT

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

Igor Ribeiro de Assis updated THRIFT-868:
-----------------------------------------

    Attachment: THRIFT-868-v1_Referencing_constant_values_dont_work_with_typedefs.patch

> Referencing constant values doesn't work with with typedef types
> ----------------------------------------------------------------
>
>                 Key: THRIFT-868
>                 URL: https://issues.apache.org/jira/browse/THRIFT-868
>             Project: Thrift
>          Issue Type: Bug
>          Components: Compiler (General)
>    Affects Versions: 0.4
>            Reporter: Jeff DeCew
>            Priority: Minor
>             Fix For: 0.6
>
>         Attachments: THIRFT-868_Referencing_constant_values_dont_work_with_typedefs.patch,
THRIFT-868-v1_Referencing_constant_values_dont_work_with_typedefs.patch
>
>
> Setting a constant's value to the value of another constant does not work when the types
are typedefs.  The workaround is easy, but it devalues the typedef.
> Here's my example input:
> {code:title=Test.thrift}
> // test with strings
> const string str_a = "foo"
> const string str_b = str_a
> typedef string MyString
> const MyString mystr_a = "bar"
> const MyString mystr_b = mystr_a // results in empty string
> // Test with ints
> const i32 int_x = 42
> const i32 int_y = int_x
> typedef i32 MyInt
> const MyInt myint_x = 29
> const MyInt myint_y = myint_x // causes compiler error - code generator ends prematurely
> {code}
> Which erroneously results in the following:
> {code:title=Constants.java}
> public class Constants {
>     public static final String str_a = "foo";
>     public static final String str_b = "foo";
>     public static final String mystr_a = "bar";
>     public static final String mystr_b = "";
>     public static final int int_x = 42;
>     public static final int int_y = 42;
>     public static final int myint_x = 29;
>     public static final int 
> <<eof>>
> {code}
> The string typedef fails silently, ignoring the value and using "" instead, while the
i32 typedef successfully parses, but causes the code generator to error out mid-file.  There
are clearly two very different symptoms here, but my gut tells me that they have the same
root cause.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message