summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorVarriount <Varriount@users.noreply.github.com>2014-07-24 18:18:41 -0400
committerVarriount <Varriount@users.noreply.github.com>2014-07-24 18:18:41 -0400
commitba394e6d3649839d73c5ae3a12e6f1ff6d66e802 (patch)
treed52a8fd19c78fafc167a2deecf30a00cdd1a3307 /lib
parent99aaefeaaecf015ee6d2432ed3a48c963b395eb6 (diff)
parent18003ff1966fc54ed1b2b39988dda6961ce35c80 (diff)
downloadNim-ba394e6d3649839d73c5ae3a12e6f1ff6d66e802.tar.gz
Merge pull request #1410 from Varriount/flyx-ptables_fix
Flyx ptables fix
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/collections/tables.nim7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/pure/collections/tables.nim b/lib/pure/collections/tables.nim
index ce9df09e1..dcf2ab481 100644
--- a/lib/pure/collections/tables.nim
+++ b/lib/pure/collections/tables.nim
@@ -246,7 +246,8 @@ template equalsImpl() =
     # different insertion orders mean different 'data' seqs, so we have
     # to use the slow route here:
     for key, val in s:
-      if not hasKey(t, key): return false
+      # prefix notation leads to automatic dereference in case of PTable
+      if not t.hasKey(key): return false
       if t[key] != val: return false
     return true
   
@@ -332,7 +333,9 @@ proc `$`*[A, B](t: PTable[A, B]): string =
   dollarImpl()
 
 proc `==`*[A, B](s, t: PTable[A, B]): bool =
-  equalsImpl()
+  if isNil(s): result = isNil(t)
+  elif isNil(t): result = false
+  else: result = equalsImpl()
 
 proc newTableFrom*[A, B, C](collection: A, index: proc(x: B): C): PTable[C, B] =
   ## Index the collection with the proc provided.