www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Apache Thrift codegen doesn't compile with dmd v2.069.2. I'd like to

reply Lucas Burson <ljdelight+dlang gmail.com> writes:
Hi,
I'm using Apache Thrift and using the tutorial to codegen D, but 
the generated code doesn't compile with dmd v2.096.2. I submitted 
Thrift defect [1] but I'd like to try to help fix the issue.

The code is very generic and I'm looking for tips on which lines 
would need changed (or if you want to beat me to the fix, go 
ahead, but share!).
The backtrace below hints that the code in [2] isn't liked by [3].
Should I focus on the mixin and does anything jump out?


[1] https://issues.apache.org/jira/browse/THRIFT-3541
[2] 
https://github.com/apache/thrift/blob/0.9.3/lib/d/src/thrift/codegen/processor.d#L85
[3] 
https://github.com/apache/thrift/blob/0.9.3/lib/d/src/thrift/internal/codegen.d#L246

Here's a snippet of the log:
[1m../../lib/d/src/thrift/codegen/processor.d-mixin-85(107): 
[1;31mError: [mtemplate instance 
thrift.codegen.processor.TArgsStruct!(Calculator, "ping") error 
instantiating
[1m../../lib/d/src/thrift/codegen/processor.d-mixin-85(100): 
[1;31m       [minstantiated from here: process_ping!(TProtocol, 
TProtocol)
[1mserver.d(101): [1;31m       [minstantiated from here: 
TServiceProcessor!(Calculator)
[1m../../lib/d/src/thrift/codegen/processor.d-mixin-85(130): 
[1;31mError: [mtemplate instance 
thrift.codegen.processor.TResultStruct!(Calculator, "ping") error 
instantiating
[1m../../lib/d/src/thrift/codegen/processor.d-mixin-85(100): 
[1;31m       [minstantiated from here: process_ping!(TProtocol, 
TProtocol)
[1mserver.d(101): [1;31m       [minstantiated from here: 
TServiceProcessor!(Calculator)
[1m../../lib/d/src/thrift/codegen/base.d(472): [1;31mError: 
[minvalid foreach aggregate StaticFilter!(All, "key", "thrift", 
"This", "isSetFlags", "fieldMeta", "set", "unset", "isSet", 
"toString", "opEquals", "toHash", "thriftToStringImpl", 
"thriftOpEqualsImpl", "thriftToHashImpl", "read", "write")
[1m../../lib/d/src/thrift/internal/codegen.d(272): [1;31mError: 
[mtemplate instance 
thrift.internal.codegen.Target!(TArgsStruct!(SharedService, 
"getStruct"), "toHash") error instantiating
[1m../../lib/d/src/thrift/internal/codegen.d(361): [1;31m       
[minstantiated from here: Template!"toHash"
[1m../../lib/d/src/thrift/internal/codegen.d(380): [1;31m       
[minstantiated from here: Instantiate!(PApply, "toHash")
[1m../../lib/d/src/thrift/internal/codegen.d(361): [1;31m       
[minstantiated from here: Template!"toHash"
[1m../../lib/d/src/thrift/internal/codegen.d(381): [1;31m       
[m... (17 instantiations, -v to show)
Jan 11 2016
parent Lucas Burson <ljdelight+dlang gmail.com> writes:
I'm researching and found that facebook/fbthrift has the commit 
below which might work. I'll pull it in and see if it works.

"Make all fbcode D code compatible with dmd 2.068.0"
https://github.com/facebook/fbthrift/commit/aee392c7b8947712f4e3d0e3434dd3ee3d5f3540
Jan 11 2016