Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
0.9.1
-
None
-
Windows 7
-
Patch Available
Description
Compiling a thrift file containing const definitions for basetype variables results in static properties public static whatsits being generated. Should generate const properties public const whatsits.
Current version generates this from test/ConstantsDemo.thrift
public static class ConstantsDemoConstants { public static int myInt = 3; public static int hex_const = 31; public static int GEN_ME = -3523553; public static double GEn_DUB = 325.532; public static double GEn_DU = 85.2355; public static string GEN_STRING = "asldkjasfd"; public static Dictionary<int, int> GEN_MAP = new Dictionary<int, int>(); public static List<int> GEN_LIST = new List<int>(); ...
The code should instead look like this.
public static class ConstantsDemoConstants { public const int myInt = 3; public const int hex_const = 31; public const int GEN_ME = -3523553; public const double GEn_DUB = 325.532; public const double GEn_DU = 85.2355; public const string GEN_STRING = "asldkjasfd"; public static Dictionary<int, int> GEN_MAP = new Dictionary<int, int>(); public static List<int> GEN_LIST = new List<int>(); ...
A patch for this change is supplied.
As i don't really know yet how the testing for these kind of changes is done i haven't supplied one. But generating all the .thrift files in test with a before and after version of the compiler and comparing the output of both looked good to me.
Attachments
Attachments
Issue Links
- relates to
-
THRIFT-2653 improved Delphi const generation
- Closed