From 3a5815d4bd000cb250e3736db7ad02f63d065bfe Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Fri, 6 Dec 2024 15:18:25 -0500 Subject: Improvements and fixes for assigning to table keys --- types.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'types.c') diff --git a/types.c b/types.c index 78d52f51..189cec89 100644 --- a/types.c +++ b/types.c @@ -43,7 +43,11 @@ CORD type_to_cord(type_t *t) { } case TableType: { auto table = Match(t, TableType); - return CORD_asprintf("{%r:%r}", type_to_cord(table->key_type), type_to_cord(table->value_type)); + if (table->value_type) + return CORD_asprintf("{%r:%r}", type_to_cord(table->key_type), type_to_cord(table->value_type)); + else + return CORD_asprintf("{%r=%.*s}", type_to_cord(table->key_type), + table->default_value->end - table->default_value->start, table->default_value->start); } case SetType: { auto set = Match(t, SetType); -- cgit v1.2.3