From 43630d14f0409e6842e2b3211348da32019589a2 Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Mon, 9 Nov 2020 21:39:50 +1100 Subject: [PATCH] Make lang/ast Str methods return non-empty for nil --- lang/ast/string.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lang/ast/string.go b/lang/ast/string.go index 29f45132..57806e48 100644 --- a/lang/ast/string.go +++ b/lang/ast/string.go @@ -21,7 +21,7 @@ import ( // Str returns a string form of n. func (n *Expr) Str(tm *t.Map) string { if n == nil { - return "" + return "«nilExpr»" } if n.id0 == 0 && n.id1 == 0 { return tm.ByID(n.id2) @@ -191,7 +191,7 @@ var opStrings = [...]string{ // Str returns a string form of n. func (n *TypeExpr) Str(tm *t.Map) string { if n == nil { - return "" + return "«nilTypeExpr»" } if n.Decorator() == 0 && n.Min() == nil && n.Max() == nil { return n.QID().Str(tm)