diff options
author | Araq <rumpf_a@web.de> | 2018-08-08 11:21:56 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2018-08-08 11:21:56 +0200 |
commit | de263a43c615199f66440d8d27fe4fb7da3435e3 (patch) | |
tree | bd6d01d6fc87b586f3db11b411c133ccd702403c /lib/system.nim | |
parent | 19bfa9b889a3279e4b7eb4195534c8d586898f73 (diff) | |
download | Nim-de263a43c615199f66440d8d27fe4fb7da3435e3.tar.gz |
deprecate isNil for strings and seqs
Diffstat (limited to 'lib/system.nim')
-rw-r--r-- | lib/system.nim | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/system.nim b/lib/system.nim index 53605f9fd..3a82299ac 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -2321,9 +2321,9 @@ iterator mpairs*(a: var cstring): tuple[key: int, val: var char] {.inline.} = inc(i) -proc isNil*[T](x: seq[T]): bool {.noSideEffect, magic: "IsNil".} +proc isNil*[T](x: seq[T]): bool {.noSideEffect, magic: "IsNil", deprecated.} proc isNil*[T](x: ref T): bool {.noSideEffect, magic: "IsNil".} -proc isNil*(x: string): bool {.noSideEffect, magic: "IsNil".} +proc isNil*(x: string): bool {.noSideEffect, magic: "IsNil", deprecated.} proc isNil*[T](x: ptr T): bool {.noSideEffect, magic: "IsNil".} proc isNil*(x: pointer): bool {.noSideEffect, magic: "IsNil".} proc isNil*(x: cstring): bool {.noSideEffect, magic: "IsNil".} @@ -2520,7 +2520,7 @@ proc `$`*[T: tuple|object](x: T): string = result.add(name) result.add(": ") when compiles($value): - when compiles(value.isNil): + when value isnot string and value isnot seq and compiles(value.isNil): if value.isNil: result.add "nil" else: result.addQuoted(value) else: @@ -2539,7 +2539,7 @@ proc collectionToString[T](x: T, prefix, separator, suffix: string): string = else: result.add(separator) - when compiles(value.isNil): + when value isnot string and value isnot seq and compiles(value.isNil): # this branch should not be necessary if value.isNil: result.add "nil" |