diff options
author | Yuriy Glukhov <yutiy.glukhov@gmail.com> | 2016-05-31 12:38:25 +0300 |
---|---|---|
committer | Yuriy Glukhov <yutiy.glukhov@gmail.com> | 2016-05-31 12:38:25 +0300 |
commit | ed96b09e6110cf75bde324f741cdf5da205e81af (patch) | |
tree | 890ef96d567ee00190df555489037ec78c632d56 /lib/system.nim | |
parent | f3fdad0eda8664f71e265b7ecc41477a7490331c (diff) | |
download | Nim-ed96b09e6110cf75bde324f741cdf5da205e81af.tar.gz |
Fix dollar for non printable/accessible fields. Fixes #4236.
Diffstat (limited to 'lib/system.nim')
-rw-r--r-- | lib/system.nim | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/system.nim b/lib/system.nim index 8180f27cd..3a5415b87 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -2296,12 +2296,15 @@ proc `$`*[T: tuple|object](x: T): string = if not firstElement: result.add(", ") result.add(name) result.add(": ") - when compiles(value.isNil): - if value.isNil: result.add "nil" - else: result.add($value) + when compiles($value): + when compiles(value.isNil): + if value.isNil: result.add "nil" + else: result.add($value) + else: + result.add($value) + firstElement = false else: - result.add($value) - firstElement = false + result.add("...") result.add(")") proc collectionToString[T: set | seq](x: T, b, e: string): string = |