summary refs log tree commit diff stats
path: root/lib/system.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2019-01-29 14:31:43 +0100
committerAraq <rumpf_a@web.de>2019-01-29 14:31:43 +0100
commit07a0a61875f4f5c7ac74acfd0c7dd4e4eb333dce (patch)
tree274cffecbae0c7e2f55b5fafa1d8c347ce1307f8 /lib/system.nim
parenta58f5b6023744da9f44e6ab8b1c748002b2bbcc0 (diff)
downloadNim-07a0a61875f4f5c7ac74acfd0c7dd4e4eb333dce.tar.gz
fixes #9149 [backport]
Diffstat (limited to 'lib/system.nim')
-rw-r--r--lib/system.nim10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/system.nim b/lib/system.nim
index 0241b92e0..4951961ca 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -4307,15 +4307,17 @@ proc `==`*(x, y: cstring): bool {.magic: "EqCString", noSideEffect,
 when defined(nimNoNilSeqs2):
   when not compileOption("nilseqs"):
     when defined(nimHasUserErrors):
-      proc `==`*(x: string; y: type(nil)): bool {.
+      # 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); y: string): bool {.
+      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)): bool {.error.} = discard
-      proc `==`*(x: type(nil); y: string): bool {.error.} = discard
+      proc `==`*(x: string; y: type(nil) | type(nil)): bool {.error.} = discard
+      proc `==`*(x: type(nil) | type(nil); y: string): bool {.error.} = discard
 
 template closureScope*(body: untyped): untyped =
   ## Useful when creating a closure in a loop to capture local loop variables by