system.fields|fieldPairs for objects

This commit is contained in:
Araq 2013-02-18 17:23:26 +01:00
commit d15981adbc
5 changed files with 170 additions and 37 deletions

View file

@ -938,7 +938,8 @@ proc matchTypeClass*(bindings: var TIdTable, typeClass, t: PType): bool =
of tyTypeClass:
match = matchTypeClass(bindings, req, t)
else: nil
elif t.kind in {tyObject}:
elif t.kind in {tyObject} and req.len != 0:
# empty 'object' is fine as constraint in a type class
match = sameType(t, req)
if tfAny in typeClass.flags: