diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-10-11 15:31:38 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-10-11 15:31:38 -0400 |
| commit | 7e8604daeb9239e1669c5414dd6caa37af30c4ff (patch) | |
| tree | 8fcab61a296381280902a3fc7b2d8456e2a9b227 /src/types.c | |
| parent | 25fa8ace21f0f6874f5b3ad1248e0e5d21190c84 (diff) | |
Make `{a,b,c}` shorthand for `{a:Empty(), b:Empty(), c:Empty()}` and
display it that way. Same for type annotations.
Diffstat (limited to 'src/types.c')
| -rw-r--r-- | src/types.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/types.c b/src/types.c index bf986c80..d08755a2 100644 --- a/src/types.c +++ b/src/types.c @@ -37,7 +37,9 @@ Text_t type_to_text(type_t *t) { } case TableType: { DeclareMatch(table, t, TableType); - return Texts("{", type_to_text(table->key_type), "=", type_to_text(table->value_type), "}"); + return (table->value_type && table->value_type != EMPTY_TYPE) + ? Texts("{", type_to_text(table->key_type), ":", type_to_text(table->value_type), "}") + : Texts("{", type_to_text(table->key_type), "}"); } case ClosureType: { return type_to_text(Match(t, ClosureType)->fn); |
