diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-12-06 15:18:25 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-12-06 15:18:25 -0500 |
| commit | 3a5815d4bd000cb250e3736db7ad02f63d065bfe (patch) | |
| tree | 253f7c8afbba9bfbd08b9eb4616ed7219300f537 /types.c | |
| parent | ca14454bb03bda9794ffcb0c0745cf6978b595fc (diff) | |
Improvements and fixes for assigning to table keys
Diffstat (limited to 'types.c')
| -rw-r--r-- | types.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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); |
