Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
0.7
-
None
-
None
-
Windows 7 / .net 4.0
-
Patch Available
Description
If I have a struct with a property of type enum with a default value specified, and the default value is negative, then the code generated is incorrect and has a syntax error.
E.G. thrift file like this:
enum ReturnType {
SuccessTypeA = 2
SuccessUnknownType = 1,
FailUnknown = -1,
OtherFailure = -2
}
struct ReturnInformation {
1: required ReturnType RetType = ReturnType.FailUnknown;
}
Generates a constructor like this:
public MatchInformation() { this._MatchType = (MatchTypes)-1; }
which fails with an exception "To cast a negative value, you must enclose the value in parentheses".
I have updated the code to always put the enum constant value in parentheses (positive or negative), but need to get the compiler built and tested before I can submit a patch. Any chance someone could do this for me?