From 7e8604daeb9239e1669c5414dd6caa37af30c4ff Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 11 Oct 2025 15:31:38 -0400 Subject: Make `{a,b,c}` shorthand for `{a:Empty(), b:Empty(), c:Empty()}` and display it that way. Same for type annotations. --- src/types.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/types.c') 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); -- cgit v1.2.3