aboutsummaryrefslogtreecommitdiff
path: root/types.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-12-06 15:18:25 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-12-06 15:18:25 -0500
commit3a5815d4bd000cb250e3736db7ad02f63d065bfe (patch)
tree253f7c8afbba9bfbd08b9eb4616ed7219300f537 /types.c
parentca14454bb03bda9794ffcb0c0745cf6978b595fc (diff)
Improvements and fixes for assigning to table keys
Diffstat (limited to 'types.c')
-rw-r--r--types.c6
1 files changed, 5 insertions, 1 deletions
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);