From ce4e877702d361acd511b14364c26956c06a63d7 Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Sun, 26 Jul 2015 18:15:19 +0100 Subject: `$` for tuples/objects now handles a nil value correctly. Fixes #3149. --- lib/system.nim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/system.nim') 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(")") -- cgit 1.4.1-2-gfad0