summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/streams.nim10
-rw-r--r--lib/std/packedsets.nim12
-rw-r--r--lib/system.nim30
3 files changed, 17 insertions, 35 deletions
diff --git a/lib/pure/streams.nim b/lib/pure/streams.nim
index 55a4e1b85..f9d0ffc5f 100644
--- a/lib/pure/streams.nim
+++ b/lib/pure/streams.nim
@@ -1150,10 +1150,7 @@ when (NimMajor, NimMinor) < (1, 3) and defined(js):
 
   proc ssClose(s: Stream) {.compileTime.} =
     var s = StringStream(s)
-    when defined(nimNoNilSeqs):
-      s.data = ""
-    else:
-      s.data = nil
+    s.data = ""
 
   proc newStringStream*(s: string = ""): owned StringStream {.compileTime.} =
     new(result)
@@ -1253,10 +1250,7 @@ else: # after 1.3 or JS not defined
 
   proc ssClose(s: Stream) =
     var s = StringStream(s)
-    when defined(nimNoNilSeqs):
-      s.data = ""
-    else:
-      s.data = nil
+    s.data = ""
 
   proc newStringStream*(s: string = ""): owned StringStream =
     ## Creates a new stream from the string `s`.
diff --git a/lib/std/packedsets.nim b/lib/std/packedsets.nim
index 42814547c..a5101ec37 100644
--- a/lib/std/packedsets.nim
+++ b/lib/std/packedsets.nim
@@ -180,7 +180,7 @@ proc initPackedSet*[A]: PackedSet[A] =
     counter: 0,
     max: 0,
     head: nil,
-    data: when defined(nimNoNilSeqs): @[] else: nil)
+    data: @[])
   #  a: array[0..33, int] # profiling shows that 34 elements are enough
 
 proc contains*[A](s: PackedSet[A], key: A): bool =
@@ -392,10 +392,7 @@ proc clear*[A](result: var PackedSet[A]) =
   # setLen(result.data, InitIntSetSize)
   # for i in 0..InitIntSetSize - 1: result.data[i] = nil
   # result.max = InitIntSetSize - 1
-  when defined(nimNoNilSeqs):
-    result.data = @[]
-  else:
-    result.data = nil
+  result.data = @[]
   result.max = 0
   result.counter = 0
   result.head = nil
@@ -426,10 +423,7 @@ proc assign*[A](dest: var PackedSet[A], src: PackedSet[A]) =
     assert len(a) == 2
 
   if src.elems <= src.a.len:
-    when defined(nimNoNilSeqs):
-      dest.data = @[]
-    else:
-      dest.data = nil
+    dest.data = @[]
     dest.max = 0
     dest.counter = src.counter
     dest.head = nil
diff --git a/lib/system.nim b/lib/system.nim
index e5ef54fa4..a2e6675d9 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -1559,11 +1559,8 @@ proc len*[U: Ordinal; V: Ordinal](x: HSlice[U, V]): int {.noSideEffect, inline.}
   ##   assert((5..2).len == 0)
   result = max(0, ord(x.b) - ord(x.a) + 1)
 
-when defined(nimNoNilSeqs2):
-  when not compileOption("nilseqs"):
-    {.pragma: nilError, error.}
-  else:
-    {.pragma: nilError.}
+when not compileOption("nilseqs"):
+  {.pragma: nilError, error.}
 else:
   {.pragma: nilError.}
 
@@ -2942,19 +2939,16 @@ proc `==`*(x, y: cstring): bool {.magic: "EqCString", noSideEffect,
   elif x.isNil or y.isNil: result = false
   else: result = strcmp(x, y) == 0
 
-when defined(nimNoNilSeqs2) and not compileOption("nilseqs"):
-  when defined(nimHasUserErrors):
-    # bug #9149; ensure that 'type(nil)' does not match *too* well by using 'type(nil) | type(nil)'.
-    # Eventually (in 0.20?) we will be able to remove this hack completely.
-    proc `==`*(x: string; y: type(nil) | type(nil)): bool {.
-        error: "'nil' is now invalid for 'string'; compile with --nilseqs:on for a migration period".} =
-      discard
-    proc `==`*(x: type(nil) | type(nil); y: string): bool {.
-        error: "'nil' is now invalid for 'string'; compile with --nilseqs:on for a migration period".} =
-      discard
-  else:
-    proc `==`*(x: string; y: type(nil) | type(nil)): bool {.error.} = discard
-    proc `==`*(x: type(nil) | type(nil); y: string): bool {.error.} = discard
+when not compileOption("nilseqs"):
+  # bug #9149; ensure that 'type(nil)' does not match *too* well by using 'type(nil) | type(nil)',
+  # especially for converters, see tests/overload/tconverter_to_string.nim
+  # Eventually we will be able to remove this hack completely.
+  proc `==`*(x: string; y: type(nil) | type(nil)): bool {.
+      error: "'nil' is now invalid for 'string'; compile with --nilseqs:on for a migration period".} =
+    discard
+  proc `==`*(x: type(nil) | type(nil); y: string): bool {.
+      error: "'nil' is now invalid for 'string'; compile with --nilseqs:on for a migration period".} =
+    discard
 
 template closureScope*(body: untyped): untyped =
   ## Useful when creating a closure in a loop to capture local loop variables by