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/formatter/types.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/formatter/types.c') diff --git a/src/formatter/types.c b/src/formatter/types.c index 670405f6..929c8ff9 100644 --- a/src/formatter/types.c +++ b/src/formatter/types.c @@ -19,7 +19,8 @@ Text_t format_type(type_ast_t *type) { } case TableTypeAST: { DeclareMatch(table, type, TableTypeAST); - Text_t code = Texts("{", format_type(table->key), ":", format_type(table->value)); + Text_t code = Texts("{", format_type(table->key)); + if (table->value != NULL) code = Texts(code, ":", format_type(table->value)); if (table->default_value) { OptionalText_t val = format_inline_code(table->default_value, (Table_t){}); assert(val.tag != TEXT_NONE); -- cgit v1.2.3