diff options
author | Dominik Picheta <dominikpicheta@googlemail.com> | 2015-07-26 18:15:19 +0100 |
---|---|---|
committer | Dominik Picheta <dominikpicheta@googlemail.com> | 2015-07-26 18:15:19 +0100 |
commit | ce4e877702d361acd511b14364c26956c06a63d7 (patch) | |
tree | 2b8da7335f890421352bc0dbd8bc89e97fb86dd3 /lib/system.nim | |
parent | a88131ed4a660d6eba543a11c2df66c04cdd3908 (diff) | |
download | Nim-ce4e877702d361acd511b14364c26956c06a63d7.tar.gz |
`$` for tuples/objects now handles a nil value correctly. Fixes #3149.
Diffstat (limited to 'lib/system.nim')
-rw-r--r-- | lib/system.nim | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/system.nim b/lib/system.nim index c5b0e0cc7..91495f31a 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -2173,7 +2173,11 @@ proc `$`*[T: tuple|object](x: T): string = if not firstElement: result.add(", ") result.add(name) result.add(": ") - result.add($value) + when compiles(value.isNil): + if value.isNil: result.add "nil" + else: result.add($value) + else: + result.add($value) firstElement = false result.add(")") |