[ https://issues.apache.org/jira/browse/THRIFT-27?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13012136#comment-13012136 ]
Anthony Molinaro commented on THRIFT-27: ---------------------------------------- Doesn't seem to work with nested types. To try this out, I tried compiling the test structures in the test/erl directory. {noformat} % cd test/erl && make mkdir -p ebin erlc -Igen/include -Iinclude -I../../lib/erl/include -o ebin src/test_server.erl /Users/molinaro/projects/opensource/thrift/test/erl/gen/include/thriftTest_types.hrl:23: syntax error before: Xtruct /Users/molinaro/projects/opensource/thrift/test/erl/gen/include/thriftTest_types.hrl:43: syntax error before: Xtruct /Users/molinaro/projects/opensource/thrift/test/erl/gen/include/thriftTest_types.hrl:47: syntax error before: EmptyStruct /Users/molinaro/projects/opensource/thrift/test/erl/gen/include/thriftTest_types.hrl:59: syntax error before: Bonk /Users/molinaro/projects/opensource/thrift/test/erl/gen/include/thriftTest_types.hrl:74: syntax error before: Bools src/test_server.erl:97: record xtruct2 undefined src/test_server.erl:98: record xtruct2 undefined src/test_server.erl:195: record xception2 undefined /Users/molinaro/projects/opensource/thrift/test/erl/gen/include/thriftTest_types.hrl:14: Warning: type bool() is now called boolean(); please use the new name instead /Users/molinaro/projects/opensource/thrift/test/erl/gen/include/thriftTest_types.hrl:15: Warning: type bool() is now called boolean(); please use the new name instead make: *** [ebin/test_server.beam] Error 1 {noformat} Looking at the generated hrl file I see this {noformat} -record(xtruct, {string_thing :: string(), byte_thing :: integer(), i32_thing :: integer(), i64_thing :: integer()}). -record(xtruct2, {byte_thing :: integer(), struct_thing = #Xtruct{}, i32_thing :: integer()}). {noformat} So seems like you are using the type's defined in the file and not the erlang equivalent? Also, looks like for type annotations you are using bool(), the compiler warns and states you should use boolean() instead. > Generated erlang types don't contain default values for records > --------------------------------------------------------------- > > Key: THRIFT-27 > URL: https://issues.apache.org/jira/browse/THRIFT-27 > Project: Thrift > Issue Type: Improvement > Components: Erlang - Compiler > Environment: commit 289ec8413908ca2e5245641029b719909483adf5 > Reporter: Todd Lipcon > Attachments: diff.txt > > Original Estimate: 2h > Remaining Estimate: 2h > > When generating code for the following structure: > {code} > struct ColumnDescriptor { > 1:Text name, > 2:i32 maxVersions = 3, > 3:string compression = "NONE", > 4:bool inMemory = 0, > 5:i32 maxValueLength = 2147483647, > 6:string bloomFilterType = "NONE", > 7:i32 bloomFilterVectorSize = 0, > 8:i32 bloomFilterNbHashes = 0 > } > {code} > the generated record is: > {code} > -record(columnDescriptor, {name, maxVersions, compression, inMemory, > maxValueLength, bloomFilterType, bloomFilterVectorSize, bloomFilterNbHashes}). > {code} > The generated record should have default values added. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira