summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/collections/tables.nim24
-rw-r--r--lib/stdlib.nimble2
-rw-r--r--lib/system.nim10
3 files changed, 21 insertions, 15 deletions
diff --git a/lib/pure/collections/tables.nim b/lib/pure/collections/tables.nim
index 2bdf77125..bee0a41b2 100644
--- a/lib/pure/collections/tables.nim
+++ b/lib/pure/collections/tables.nim
@@ -438,7 +438,7 @@ proc `$`*[A, B](t: TableRef[A, B]): string =
   dollarImpl()
 
 proc `==`*[A, B](s, t: TableRef[A, B]): bool =
-  ## The `==` operator for hash tables. Returns ``true`` iff either both tables 
+  ## The `==` operator for hash tables. Returns ``true`` iff either both tables
   ## are ``nil`` or none is ``nil`` and the content of both tables contains the
   ## same key-value pairs. Insert order does not matter.
   if isNil(s): result = isNil(t)
@@ -616,8 +616,8 @@ proc `$`*[A, B](t: OrderedTable[A, B]): string =
   dollarImpl()
 
 proc `==`*[A, B](s, t: OrderedTable[A, B]): bool =
-  ## The `==` operator for ordered hash tables. Both the content and the order
-  ## must be equal for this to return ``true``.
+  ## The `==` operator for ordered hash tables. Returns true iff both the
+  ## content and the order are equal.
   if s.counter == t.counter:
     forAllOrderedPairs:
       if s.data[h] != t.data[h]: return false
@@ -768,9 +768,12 @@ proc `$`*[A, B](t: OrderedTableRef[A, B]): string =
   dollarImpl()
 
 proc `==`*[A, B](s, t: OrderedTableRef[A, B]): bool =
-  ## The `==` operator for ordered hash tables. Both the content and the order
-  ## must be equal for this to return ``true``.
-  result = s[] == t[]
+  ## The `==` operator for ordered hash tables. Returns true iff either both
+  ## tables are ``nil`` or none is ``nil`` and the content and the order of
+  ## both are equal.
+  if isNil(s): result = isNil(t)
+  elif isNil(t): result = false
+  else: result = s[] == t[]
 
 proc sort*[A, B](t: OrderedTableRef[A, B],
                  cmp: proc (x,y: (A, B)): int) =
@@ -1070,9 +1073,12 @@ proc `$`*[A](t: CountTableRef[A]): string =
   dollarImpl()
 
 proc `==`*[A](s, t: CountTableRef[A]): bool =
-  ## The `==` operator for count tables. Returns ``true`` iff both tables
-  ## contain the same keys with the same count. Insert order does not matter.
-  result = s[] == t[]
+  ## The `==` operator for count tables. Returns ``true`` iff either both tables
+  ## are ``nil`` or none is ``nil`` and both contain the same keys with the same
+  ## count. Insert order does not matter.
+  if isNil(s): result = isNil(t)
+  elif isNil(t): result = false
+  else: result = s[] == t[]
 
 proc inc*[A](t: CountTableRef[A], key: A, val = 1) =
   ## increments `t[key]` by `val`.
diff --git a/lib/stdlib.nimble b/lib/stdlib.nimble
index 5238d900b..6949bfcc4 100644
--- a/lib/stdlib.nimble
+++ b/lib/stdlib.nimble
@@ -1,6 +1,6 @@
 [Package]
 name          = "stdlib"
-version       = "0.15.2"
+version       = "0.15.3"
 author        = "Dominik Picheta"
 description   = "Nim's standard library."
 license       = "MIT"
diff --git a/lib/system.nim b/lib/system.nim
index 7ec74250f..9925079c7 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -1827,7 +1827,7 @@ const
   NimMinor*: int = 15
     ## is the minor number of Nim's version.
 
-  NimPatch*: int = 2
+  NimPatch*: int = 3
     ## is the patch number of Nim's version.
 
   NimVersion*: string = $NimMajor & "." & $NimMinor & "." & $NimPatch
@@ -2189,16 +2189,16 @@ proc `==` *[T](x, y: seq[T]): bool {.noSideEffect.} =
     else:
       proc seqToPtr[T](x: seq[T]): pointer {.asmNoStackFrame, nosideeffect.} =
         asm """return `x`"""
-    
+
     if seqToPtr(x) == seqToPtr(y):
       return true
-      
+
   if x.isNil or y.isNil:
     return false
-  
+
   if x.len != y.len:
     return false
-    
+
   for i in 0..x.len-1:
     if x[i] != y[i]:
       return false