summary refs log tree commit diff stats
path: root/lib/system.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2018-09-25 00:28:39 +0200
committerAraq <rumpf_a@web.de>2018-09-25 00:28:39 +0200
commit548fc778c9b7048f474bf53c5d665bb8425e3343 (patch)
treebfae68122544db324cbb01b032eab1795ed6e0b8 /lib/system.nim
parent8029a649ba2cd394cad1749c017d5758cdcdbd4c (diff)
downloadNim-548fc778c9b7048f474bf53c5d665bb8425e3343.tar.gz
.error for routines now can also have a custom error message; improve error message for 'nil' strings
Diffstat (limited to 'lib/system.nim')
-rw-r--r--lib/system.nim12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/system.nim b/lib/system.nim
index 49e6a396d..28c4f62ab 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -4112,8 +4112,16 @@ proc `==`*(x, y: cstring): bool {.magic: "EqCString", noSideEffect,
 
 when defined(nimNoNilSeqs2):
   when not compileOption("nilseqs"):
-    proc `==`*(x: string; y: type(nil)): bool {.error.} = discard
-    proc `==`*(x: type(nil); y: string): bool {.error.} = discard
+    when defined(nimHasUserErrors):
+      proc `==`*(x: string; y: 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 {.
+          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
 
 template closureScope*(body: untyped): untyped =
   ## Useful when creating a closure in a loop to capture local loop variables by