Merge pull request #15 from thaven/fix/typecode-tuple

Return correct typecode for tuple
This commit is contained in:
Tristan Hume 2017-06-05 22:11:57 -07:00 committed by GitHub
commit dc9b011b94

View file

@ -143,8 +143,10 @@ string[] typeSigArr(TS...)() if(allCanDBus!TS) {
} }
int typeCode(T)() if(canDBus!T) { int typeCode(T)() if(canDBus!T) {
string sig = typeSig!T(); static if (isTuple!T)
return sig[0]; return 'r';
else
return typeSig!T()[0];
} }
unittest { unittest {
@ -169,6 +171,7 @@ unittest {
// type codes // type codes
typeCode!int().assertEqual(cast(int)('i')); typeCode!int().assertEqual(cast(int)('i'));
typeCode!bool().assertEqual(cast(int)('b')); typeCode!bool().assertEqual(cast(int)('b'));
typeCode!(Tuple!(int, string))().assertEqual(cast(int)('r'));
// ctfe-capable // ctfe-capable
static string sig = typeSig!ulong(); static string sig = typeSig!ulong();
sig.assertEqual("t"); sig.assertEqual("t");